fix: pin sish tunnel auth to the dedicated key with IdentitiesOnly - #551
Merged
Conversation
Without it, a forwarded ssh-agent (present when dev is re-run inside tmux after an SSH login) offers its keys before the -i file: sish's TOFU authenticator pins the first accepted key per username, so an agent key winning the first-ever connection silently locks the VM out of its tunnel once that agent disappears. Agent keys could also exhaust the SSH server's MaxAuthTries (6) before the tunnel key is offered. Found by a sish v2.23.0 source review of the auth webhook contract. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01ErBUiAYTosnpbF9hvUj3Dn
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
One flag on the autossh invocation:
-o IdentitiesOnly=yes.A sish v2.23.0 source review of the tunnel auth flow found two failure modes when it's absent (both require a forwarded ssh-agent, which appears whenever
devis re-run from a tmux session after an SSH login — and everydevrun restarts autossh):-ifile identities. sish calls the TOFU authenticator once per offered key, and the first accepted key is pinned to the username forever. If an agent key wins the VM's first-ever connection, everything works until the agent disappears (detach/reboot → systemd path) — then every reconnect is akey mismatch403 and the tunnel is dead until the user's file insish_users/is deleted by hand.IdentitiesOnly=yesrestricts the client to exactly~/.ssh/sish_tunnel_key_id_ed25519, eliminating both. No behavior change for the systemd boot path (no agent there) — this hardens the interactive re-run path.🤖 Generated with Claude Code
https://claude.ai/code/session_01ErBUiAYTosnpbF9hvUj3Dn