feat(mutagen): pair a host the first time we ssh into it - #179
Merged
Conversation
The peers list was a curated list of one, which is the shape that guarantees it goes stale. A zsh wrapper hands the argv to a small script that works out the destination, skips what should not be paired, and creates the session once.
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.
Decided operational policy for this module, now that the sync actually works (#177, #178):
peers.mutagen sync listis the check.Both of the last two are now written in the module header, because "we decided not to" is invisible otherwise.
How
sshgets a zsh wrapper that passes the argv it was given tomutagen-sync-ensure, after the session ends and without touching ssh's own behaviour or exit code. Running it afterwards is deliberate: a second connection during the session would ask the Bitwarden agent to approve again, and on a host carrying port forwards it would fail outright (#177).The script digs the destination out of argv the way ssh would, then declines to pair:
*.*,*:*) — a one-off, and it would name the sync directory after something that changes*-sync— our own alias for a hostpeersalready ownsgithub,localhostIdentity is
user_hostname_portfromssh -G, which resolves aliases locally, sorpi4/rpi/raspberrypicollapse to one key instead of becoming three sessions pointed at the same remote directory:Pairing needs an unattended login: reachability and the remote parent directory are one
ssh -o BatchMode=yes ... mkdir -pround trip, and a host that wants a password is skipped rather than left waiting on a prompt nobody can see.Checked
Driven against stub
ssh/mutagenbinaries: