From d41f6a8752e648f3b3b6a0850431840f644015ad Mon Sep 17 00:00:00 2001 From: David Crawshaw Date: Tue, 28 Feb 2023 13:48:20 -0800 Subject: [PATCH] tsnet: do not error on NeedsMachineAuth for Up It turns out even with an AuthKey that pre-approves devices on a tailnet with machine auth turned on, we still temporarily see the NeedsMachineAuth state. So remove that error (for now). Signed-off-by: David Crawshaw --- tsnet/tsnet.go | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/tsnet/tsnet.go b/tsnet/tsnet.go index 92e595d6c..1ff6b6ecf 100644 --- a/tsnet/tsnet.go +++ b/tsnet/tsnet.go @@ -233,8 +233,7 @@ func (s *Server) Up(ctx context.Context) (*ipnstate.Status, error) { return nil, fmt.Errorf("tsnet.Up: backend: %s", *n.ErrMessage) } if s := n.State; s != nil { - switch *s { - case ipn.Running: + if *s == ipn.Running { status, err := lc.Status(ctx) if err != nil { return nil, fmt.Errorf("tsnet.Up: %w", err) @@ -243,15 +242,13 @@ func (s *Server) Up(ctx context.Context) (*ipnstate.Status, error) { return nil, errors.New("tsnet.Up: running, but no ip") } return status, nil - case ipn.NeedsMachineAuth: - return nil, errors.New("tsnet.Up: tailnet requested machine auth") } - // TODO: in the future, return an error on NeedsLogin - // to improve the UX of trying out the tsnet package. + // TODO: in the future, return an error on ipn.NeedsLogin + // and ipn.NeedsMachineAuth to improve the UX of trying + // out the tsnet package. // // Unfortunately today, even when using an AuthKey we - // briefly see a NeedsLogin state. It would be nice - // to fix that. + // briefly see these states. It would be nice to fix. } } }