mirror of
https://github.com/tailscale/tailscale.git
synced 2026-11-24 10:41:19 -08:00
updates tailscale/corp#48949 updates tailscale/corp#25687 Credit to Keita Sode (SYZD Research) and Jaeyeong Lee for the initial report. The macsys credential file is written 0640 and chowned to the admin group so that members of that group, and only those members, can read the LocalAPI token. Several failure modes silently defeated that. The mode passed to OpenFile is masked by the process umask, so a umask of 0027 or 0077 leaves the file 0600 and no administrator can read the token. Set the mode explicitly after creating the file. Do this only for macsys; the sandboxed variant's mode is deliberately left alone rather than widened back up to 0666. The gid was hardcoded to 80. Resolve the admin group by name instead, matching how admin membership is determined elsewhere - ipnauth's isLocalAdmin resolves "admin" via util/groupmember - and keep 80 as a fallback so a failed lookup behaves as it did before. This also makes the code correct on a host where "admin" is not gid 80. The corresponding GUI client changes to modify the GUI spawned CLI behaviour can be found here: https://github.com/tailscale/corp/pull/50603 Change-Id: I73ddc77b3b9551b7169edf71e35385752893decd Signed-off-by: Jonathan Nobels <[email protected]>