tailscale/cmd/derper
Aaron Klotz 95671b71a6 ipn, safesocket: use Windows token in LocalAPI
On Windows, the idiomatic way to check access on a named pipe is for
the server to impersonate the client on its current OS thread, perform
access checks using the client's access token, and then revert the OS
thread's access token back to its true self.

The access token is a better representation of the client's rights than just
a username/userid check, as it represents the client's effective rights
at connection time, which might differ from their normal rights.

This patch updates safesocket to do the aforementioned impersonation,
extract the token handle, and then revert the impersonation. We retain
the token handle for the remaining duration of the connection (the token
continues to be valid even after we have reverted back to self).

Since the token is a property of the connection, I changed ipnauth to wrap
the concrete net.Conn to include the token. I then plumbed that change
through ipnlocal, ipnserver, and localapi as necessary.

I also added a PermitLocalAdmin flag to the localapi Handler which I intend
to use for controlling access to a few new localapi endpoints intended
for configuring auto-update.

Updates https://github.com/tailscale/tailscale/issues/755

Signed-off-by: Aaron Klotz <aaron@tailscale.com>
2023-10-26 09:43:19 -06:00
..
bootstrap_dns_test.go cmd/derper: count bootstrap dns unique lookups. 2023-08-17 08:02:56 -07:00
bootstrap_dns.go cmd/derper: count bootstrap dns unique lookups. 2023-08-17 08:02:56 -07:00
cert.go cmd/derper: disable http2 2023-04-26 20:45:32 -07:00
depaware.txt ipn, safesocket: use Windows token in LocalAPI 2023-10-26 09:43:19 -06:00
derper_test.go net/packet: split off checksum munging into different pkg 2023-10-11 14:25:58 -07:00
derper.go cmd/derper,tsweb: consistently add HTTP security headers (#8579) 2023-07-11 11:53:46 -07:00
mesh.go derp: include src IPs in mesh watch messages 2023-08-16 08:46:52 -07:00
websocket.go net/wsconn: accept a remote addr string and plumb it through 2023-08-29 16:57:16 -07:00