tailscale/cmd
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
..
addlicense all: update tools that manage copyright headers 2023-01-27 15:36:29 -08:00
cloner cmd/cloner: fix typo in test type's name 2023-09-30 10:18:18 -07:00
containerboot cmd/containerboot: revert to using tailscale up 2023-10-16 12:00:44 -07:00
derper ipn, safesocket: use Windows token in LocalAPI 2023-10-26 09:43:19 -06:00
derpprobe prober: migrate to Prometheus metric library 2023-04-11 08:37:32 +01:00
dist cmd/dist,release/dist: add distsign signing hooks (#9070) 2023-08-24 14:36:47 -07:00
get-authkey all: use cmpx.Or where it made sense 2023-06-07 22:06:24 -07:00
gitops-pusher .github,cmd/gitops-pusher: update to checkout@v4 2023-09-04 15:12:57 -07:00
hello all: update copyright and license headers 2023-01-27 15:36:29 -08:00
k8s-operator cmd/k8s-operator: allow cleanup of cluster resources for deleted devices (#9917) 2023-10-23 16:22:55 +01:00
mkmanifest cmd/mkmanifest, cmd/tailscale, cmd/tailscaled: remove Windows arm32 resources from OSS 2023-03-01 15:45:12 -07:00
mkpkg go.mod: upgrade nfpm to v2 (#8786) 2023-08-03 13:00:45 -07:00
mkversion version/mkversion: open-source version generation logic 2023-02-18 05:21:05 +00:00
nardump all: update copyright and license headers 2023-01-27 15:36:29 -08:00
netlogfmt go.mod: update github.com/go-json-experiment/json (#9508) 2023-09-21 14:19:27 -07:00
nginx-auth tailcfg,all: add and use Node.IsTagged() 2023-03-13 08:44:25 -07:00
pgproxy various: add golangci-lint, fix issues (#7905) 2023-04-17 18:38:24 -04:00
printdep cmd/printdep: print correct toolchain URL 2023-02-11 17:57:36 +00:00
proxy-to-grafana tailcfg,all: add and use Node.IsTagged() 2023-03-13 08:44:25 -07:00
sniproxy sniproxy allows configuration of hostname 2023-10-08 15:53:52 -07:00
speedtest all: update copyright and license headers 2023-01-27 15:36:29 -08:00
ssh-auth-none-demo all: replace deprecated ioutil references 2023-08-23 23:53:19 +01:00
stunc all: update copyright and license headers 2023-01-27 15:36:29 -08:00
sync-containers all: adjust some build tags for plan9 2023-08-24 15:42:35 -07:00
tailscale ipn, safesocket: use Windows token in LocalAPI 2023-10-26 09:43:19 -06:00
tailscaled ipn, safesocket: use Windows token in LocalAPI 2023-10-26 09:43:19 -06:00
testcontrol all: update copyright and license headers 2023-01-27 15:36:29 -08:00
testwrapper tstest, tstest/integration, github/workflows: shard integration tests 2023-10-16 20:09:24 -07:00
tsconnect cmd/tsconnect/wasm: add missing tstun.Wrapper.Start call 2023-10-18 17:24:02 -07:00
tsshd all: update copyright and license headers 2023-01-27 15:36:29 -08:00
viewer cmd/cloner: add regression test for slice nil/empty semantics 2023-09-29 19:00:40 -07:00