wormhole ssh: have send-key write the client's ~/.ssh/config entry (after exchange of host/user info)
Problem
wormhole ssh send-key / accept-key automates only half of the key
setup: the public key lands in the server's authorized_keys, but the
client side is left unfinished:
- If the key uses a non-default filename (e.g.
id_ed25519_foo),sshnever offers it automatically — it only auto-triesid_rsa,id_ecdsa,id_ed25519, and the_skvariants. - The user must manually discover this and hand-write a
~/.ssh/configblock (Host,HostName,User,IdentityFile,IdentitiesOnly) before the passwordless login actually works.
So after running the "friction removal" step, the user still types passwords and gets no indication of what remains to be done.
Proposal
The wormhole channel is bidirectional, so accept-key could send back
the information send-key needs — the login username and a suggested
hostname/address — and send-key could then offer to append a config
stub:
Host <suggested-alias>
HostName <host>
User <user>
IdentityFile ~/.ssh/<key-name>
IdentitiesOnly yes
Notes on safety:
- Append-only; never rewrite existing
Hostblocks. If aHoststanza for that alias/hostname already exists, skip or print the suggested block for manual review instead. - Prompt before writing, with a
--no-configopt-out flag (and/or a--config-alias <name>flag to choose the alias). - A
~/.ssh/config.d/drop-in file could be an alternative to editing the main config, for users whose main config hasInclude config.d/*.
Even a minimal version — printing the suggested block with a "paste this into ~/.ssh/config" hint, when the key has a non-default name — would remove most of the confusion.
Current workaround
Manually adding to ~/.ssh/config:
Host mybox
HostName myip
User myuser
IdentityFile ~/.ssh/id_ed25519_foo
IdentitiesOnly yes
Source: magic-wormhole/magic-wormhole