diff options
| author | Can Celik <ogulcancelik@gmail.com> | 2026-09-22 19:12:29 +0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-09-22 19:12:29 +0300 |
| commit | 1c6397b1cddb288099ed212a5979732698bd72c2 (patch) | |
| tree | 0574b428903ea1ce106bc7ba36e213c0418aa9f4 /src/client/endpoint | |
| parent | 7237703dc59102cf3097e833eb896b314007b548 (diff) | |
fix: reuse ssh authentication and add machine recovery commands (#4490)
* fix: reuse ssh authentication and add in-app mfa recovery
refs #3763
* refactor: move ssh recovery to machine cli
refs #3763
Diffstat (limited to 'src/client/endpoint')
| -rw-r--r-- | src/client/endpoint/supervisor.rs | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/src/client/endpoint/supervisor.rs b/src/client/endpoint/supervisor.rs index a5154156..ff86ac77 100644 --- a/src/client/endpoint/supervisor.rs +++ b/src/client/endpoint/supervisor.rs @@ -210,7 +210,13 @@ impl EndpointSupervisors { state.online_since.get_or_insert(now); state.next_attempt = None; } - ClientEndpointStatus::Attention | ClientEndpointStatus::Disabled => { + ClientEndpointStatus::Attention => { + state.online_since = None; + // Authentication or configuration may be repaired outside this client. + state.next_attempt = + (!endpoint_id.is_local()).then_some(now + Duration::from_secs(30)); + } + ClientEndpointStatus::Disabled => { state.online_since = None; state.next_attempt = None; } @@ -278,11 +284,11 @@ fn connect_once( (stream, Box::new(())) } ConnectTarget::Ssh(profile) => { - let connected = crate::remote::connect_saved_ssh(profile.id.as_str(), &profile.target, &profile.session).map_err(|error| { - if failure_needs_attention(&error) { - std::io::Error::new(error.kind(), format!("{error}. Run `{}` interactively to approve setup, then restart this client", crate::remote::saved_ssh_bootstrap_command(&profile.target, &profile.session))) - } else { error } - })?; + let connected = crate::remote::connect_saved_ssh( + profile.id.as_str(), + &profile.target, + &profile.session, + )?; (connected.stream, Box::new(connected.bridge)) } }; @@ -517,7 +523,7 @@ mod tests { } #[test] - fn ssh_recovery_rejects_stale_generations_and_stops_retries_for_attention() { + fn ssh_recovery_rejects_stale_generations_and_rechecks_attention() { let now = Instant::now(); let mut supervisors = EndpointSupervisors::new(&[profile()], now); let endpoint_id = ClientEndpointId::Ssh(profile().id); @@ -535,6 +541,9 @@ mod tests { Some(now + INITIAL_RETRY_DELAY) ); assert!(supervisors.record_status(&endpoint_id, 4, ClientEndpointStatus::Attention, now)); - assert!(supervisors.endpoints[&endpoint_id].next_attempt.is_none()); + assert_eq!( + supervisors.endpoints[&endpoint_id].next_attempt, + Some(now + Duration::from_secs(30)) + ); } } |
