SSH
kbox keeps your SSH keys and connection details and hands them to ssh, git and rsync. Private keys are decrypted in memory and never written to disk.
Store an SSH key
Add a record of type SSH key:
- SSH host alias: the name you'll type, as in
ssh <alias>. It is filled in from the title until you edit it. - HostName, User and Port: where to connect.
- Private key: the OpenSSH private key, unencrypted.
- ssh_config options: any extra directive, for example
LocalForward 35434 localhost:5432orServerAliveInterval 60.
Connect once
kbox ssh adds the key to your running ssh-agent for five minutes, connects, and removes it when you disconnect:
kbox ssh db-tunnel # connect
kbox ssh db-tunnel -- -v # pass extra flags to ssh
kbox ssh db-tunnel --ttl 60 # keep the key in the agent for 60 s
It needs an agent to be running. If SSH_AUTH_SOCK isn't set, start one with eval "$(ssh-agent -s)".
Always-on agent
kbox agent runs a persistent ssh-agent that serves every SSH key in your vault from memory, and writes an ssh config with a Host block per key, so the connection details come from the vault too. kbox setup installs it as a systemd user service and adds one Include line to ~/.ssh/config:
kbox setup
systemctl --user enable --now kbox-agent
ssh db-tunnel # alias, host and key all from the vault
git pull # uses it too
Your ~/.ssh/config
kbox never rewrites your config. It adds that one Include line and manages its own files, which live in $XDG_RUNTIME_DIR (memory). When the agent isn't running those files are gone, the include matches nothing, and ssh falls back to your normal config. kbox hosts use IdentityAgent, so your usual agent stays in charge of everything else.
New and removed keys
The agent re-reads the vault every five minutes (--refresh), so changes appear without a restart. Passphrase-protected keys are skipped by the agent; use kbox ssh for those.
To see what the agent has loaded:
SSH_AUTH_SOCK=$XDG_RUNTIME_DIR/kbox-agent.sock ssh-add -l