mirror of
				https://github.com/tailscale/tailscale.git
				synced 2025-11-04 00:55:11 +00:00 
			
		
		
		
	tailscale/cmd: Warn for up --force-reauth over SSH without accepting the risk (#7575)
Fixes #6377 Signed-off-by: James Sanderson <jsanderson@tailscale.com>
This commit is contained in:
		
				
					committed by
					
						
						GitHub
					
				
			
			
				
	
			
			
			
						parent
						
							f34590d9ed
						
					
				
				
					commit
					9534783758
				
			@@ -1071,6 +1071,32 @@ func TestUpdatePrefs(t *testing.T) {
 | 
			
		||||
			},
 | 
			
		||||
			env: upCheckEnv{backendState: "Running"},
 | 
			
		||||
		},
 | 
			
		||||
		{
 | 
			
		||||
			name:             "force_reauth_over_ssh_no_risk",
 | 
			
		||||
			flags:            []string{"--force-reauth"},
 | 
			
		||||
			sshOverTailscale: true,
 | 
			
		||||
			curPrefs: &ipn.Prefs{
 | 
			
		||||
				ControlURL:       "https://login.tailscale.com",
 | 
			
		||||
				AllowSingleHosts: true,
 | 
			
		||||
				CorpDNS:          true,
 | 
			
		||||
				NetfilterMode:    preftype.NetfilterOn,
 | 
			
		||||
			},
 | 
			
		||||
			env:          upCheckEnv{backendState: "Running"},
 | 
			
		||||
			wantErrSubtr: "aborted, no changes made",
 | 
			
		||||
		},
 | 
			
		||||
		{
 | 
			
		||||
			name:             "force_reauth_over_ssh",
 | 
			
		||||
			flags:            []string{"--force-reauth", "--accept-risk=lose-ssh"},
 | 
			
		||||
			sshOverTailscale: true,
 | 
			
		||||
			curPrefs: &ipn.Prefs{
 | 
			
		||||
				ControlURL:       "https://login.tailscale.com",
 | 
			
		||||
				AllowSingleHosts: true,
 | 
			
		||||
				CorpDNS:          true,
 | 
			
		||||
				NetfilterMode:    preftype.NetfilterOn,
 | 
			
		||||
			},
 | 
			
		||||
			wantJustEditMP: nil,
 | 
			
		||||
			env:            upCheckEnv{backendState: "Running"},
 | 
			
		||||
		},
 | 
			
		||||
	}
 | 
			
		||||
	for _, tt := range tests {
 | 
			
		||||
		t.Run(tt.name, func(t *testing.T) {
 | 
			
		||||
 
 | 
			
		||||
@@ -409,6 +409,12 @@ func updatePrefs(prefs, curPrefs *ipn.Prefs, env upCheckEnv) (simpleUp bool, jus
 | 
			
		||||
		return false, nil, err
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if env.upArgs.forceReauth && isSSHOverTailscale() {
 | 
			
		||||
		if err := presentRiskToUser(riskLoseSSH, `You are connected over Tailscale; this action will result in your SSH session disconnecting.`, env.upArgs.acceptedRisks); err != nil {
 | 
			
		||||
			return false, nil, err
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	tagsChanged := !reflect.DeepEqual(curPrefs.AdvertiseTags, prefs.AdvertiseTags)
 | 
			
		||||
 | 
			
		||||
	simpleUp = env.flagSet.NFlag() == 0 &&
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user