mirror of
https://github.com/tailscale/tailscale.git
synced 2026-02-07 14:32:32 -05:00
ipn/ipnlocal: skip AuthKey use if profiles exist (#18619)
If any profiles exist and an Authkey is provided via syspolicy, the AuthKey is ignored on backend start, preventing re-auth attempts. This is useful for one-time device provisioning scenarios, skipping authKey use after initial setup when the authKey may no longer be valid. updates #18618 Signed-off-by: Will Hannah <willh@tailscale.com>
This commit is contained in:
@@ -2478,7 +2478,9 @@ func (b *LocalBackend) startLocked(opts ipn.Options) error {
|
||||
|
||||
if b.state != ipn.Running && b.conf == nil && opts.AuthKey == "" {
|
||||
sysak, _ := b.polc.GetString(pkey.AuthKey, "")
|
||||
if sysak != "" {
|
||||
if sysak != "" && len(b.pm.Profiles()) > 0 && b.state != ipn.NeedsLogin {
|
||||
logf("not setting opts.AuthKey from syspolicy; login profiles exist, state=%v", b.state)
|
||||
} else if sysak != "" {
|
||||
logf("setting opts.AuthKey by syspolicy, len=%v", len(sysak))
|
||||
opts.AuthKey = strings.TrimSpace(sysak)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user