tsnet: add AuthKey support.

Set a TS_AUTHKEY environment variable to "tskey-01234..."

Signed-off-by: Denton Gentry <dgentry@tailscale.com>
pull/2614/head
Denton Gentry 3 years ago committed by Denton Gentry
parent 8bdf878832
commit 0796c53404

@ -177,11 +177,12 @@ func (s *Server) start() error {
err = lb.Start(ipn.Options{ err = lb.Start(ipn.Options{
StateKey: ipn.GlobalDaemonStateKey, StateKey: ipn.GlobalDaemonStateKey,
UpdatePrefs: prefs, UpdatePrefs: prefs,
AuthKey: os.Getenv("TS_AUTHKEY"),
}) })
if err != nil { if err != nil {
return fmt.Errorf("starting backend: %w", err) return fmt.Errorf("starting backend: %w", err)
} }
if os.Getenv("TS_LOGIN") == "1" { if os.Getenv("TS_LOGIN") == "1" || os.Getenv("TS_AUTHKEY") != "" {
s.lb.StartLoginInteractive() s.lb.StartLoginInteractive()
} }
return nil return nil

Loading…
Cancel
Save