You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
tailscale/ipn/ipnauth
Nick Khyl 2917ea8d0e ipn/ipnauth, safesocket: defer named pipe client's token retrieval until ipnserver needs it
An error returned by net.Listener.Accept() causes the owning http.Server to shut down.
With the deprecation of net.Error.Temporary(), there's no way for the http.Server to test
whether the returned error is temporary / retryable or not (see golang/go#66252).

Because of that, errors returned by (*safesocket.winIOPipeListener).Accept() cause the LocalAPI
server (aka ipnserver.Server) to shut down, and tailscaled process to exit.

While this might be acceptable in the case of non-recoverable errors, such as programmer errors,
we shouldn't shut down the entire tailscaled process for client- or connection-specific errors,
such as when we couldn't obtain the client's access token because the client attempts to connect
at the Anonymous impersonation level. Instead, the LocalAPI server should gracefully handle
these errors by denying access and returning a 401 Unauthorized to the client.

In tailscale/tscert#15, we fixed a known bug where Caddy and other apps using tscert would attempt
to connect at the Anonymous impersonation level and fail. However, we should also fix this on the tailscaled
side to prevent a potential DoS, where a local app could deliberately open the Tailscale LocalAPI named pipe
at the Anonymous impersonation level and cause tailscaled to exit.

In this PR, we defer token retrieval until (*WindowsClientConn).Token() is called and propagate the returned token
or error via ipnauth.GetConnIdentity() to ipnserver, which handles it the same way as other ipnauth-related errors.

Fixes #18212
Fixes tailscale/tscert#13

Signed-off-by: Nick Khyl <nickk@tailscale.com>
1 day ago
..
access.go ipn/ipnauth,util/syspolicy: improve comments 11 months ago
actor.go control/controlclient, ipn: add client audit logging (#14950) 10 months ago
actor_windows.go ipn/ipnauth: implement WindowsActor 11 months ago
ipnauth.go all: use buildfeature constants in a few more places 3 months ago
ipnauth_omit_unixsocketidentity.go feature/featuretags, all: add build features, use existing ones in more places 3 months ago
ipnauth_unix_creds.go ipn/ipnauth: fix a null pointer panic in GetConnIdentity 3 months ago
ipnauth_windows.go ipn/ipnauth, safesocket: defer named pipe client's token retrieval until ipnserver needs it 1 day ago
policy.go all: use buildfeature constants in a few more places 3 months ago
self.go ipn/{ipnauth,ipnlocal,localapi}: make EditPrefs return an error if changing exit node is restricted by policy 6 months ago
test_actor.go ipn/ipn{auth,server}: update ipnauth.Actor to carry a context 11 months ago