mirror of
https://github.com/tailscale/tailscale.git
synced 2025-08-20 01:47:33 +00:00
safesocket: return an error for LocalTCPPortAndToken for tailscaled (#15144)
fixes tailscale/corp#26806 Fixes a regression where LocalTCPPortAndToken needs to error out early if we're not running as sandboxed macos so that we attempt to connect using the normal unix machinery. Signed-off-by: Jonathan Nobels <jonathan@tailscale.com>
This commit is contained in:
@@ -37,14 +37,16 @@ type safesocketDarwin struct {
|
||||
sameuserproofFD *os.File // file descriptor for macos app store sameuserproof file
|
||||
sharedDir string // shared directory for location of sameuserproof file
|
||||
|
||||
checkConn bool // Check macsys safesocket port before returning it
|
||||
isMacSysExt func() bool // For testing only to force macsys
|
||||
checkConn bool // Check macsys safesocket port before returning it
|
||||
isMacSysExt func() bool // For testing only to force macsys
|
||||
isSandboxedMacos func() bool // For testing only to force macOS sandbox
|
||||
}
|
||||
|
||||
var ssd = safesocketDarwin{
|
||||
isMacSysExt: version.IsMacSysExt,
|
||||
checkConn: true,
|
||||
sharedDir: "/Library/Tailscale",
|
||||
isMacSysExt: version.IsMacSysExt,
|
||||
isSandboxedMacos: version.IsSandboxedMacOS,
|
||||
checkConn: true,
|
||||
sharedDir: "/Library/Tailscale",
|
||||
}
|
||||
|
||||
// There are three ways a Darwin binary can be run: as the Mac App Store (macOS)
|
||||
@@ -66,6 +68,10 @@ func localTCPPortAndTokenDarwin() (port int, token string, err error) {
|
||||
ssd.mu.Lock()
|
||||
defer ssd.mu.Unlock()
|
||||
|
||||
if !ssd.isSandboxedMacos() {
|
||||
return 0, "", ErrNoTokenOnOS
|
||||
}
|
||||
|
||||
if ssd.port != 0 && ssd.token != "" {
|
||||
return ssd.port, ssd.token, nil
|
||||
}
|
||||
|
Reference in New Issue
Block a user