Keys in 1Password, Bitwarden and other SSH agents

Your SSH keys can stay in 1Password, Bitwarden, KeePassXC, Secretive, Pageant or another SSH agent. MorphGate signs in with them through the agent, so the private key never enters MorphGate's vault. This works on Linux, macOS and Windows.

How it works

In a host or identity (see Hosts, groups and identities), choose SSH agent as the sign-in, then pick the Agent:

  • System agent: the agent your system runs. On Linux and macOS, the one SSH_AUTH_SOCK points to; on Windows, the OpenSSH agent.
  • 1Password and Bitwarden.
  • Secretive (macOS).
  • Pageant, PuTTY's agent (Windows).
  • Other socket or pipe: any other agent, by the socket it listens on (on Windows, its named pipe, such as \\.\pipe\my-agent). Enter it under Socket or pipe and choose Look.

MorphGate knows where 1Password, Bitwarden and Secretive listen, so there's nothing to set up for them in MorphGate. Each agent in the list shows how many keys it holds now, or not running here. If the one you choose isn't running, MorphGate says why below it.

Under Key, leave Any key it holds to offer every key in turn, or pick one key to offer only that one. Certificates the agent holds are offered before plain keys. The password manager may ask you to approve each use.

The host keeps the agent's name and, if you picked one, the key's fingerprint, never a path on your computer (except for Other socket or pipe). On another device, the same host signs in through that device's agent.

Set it up

1Password

  1. In 1Password, open Settings → Developer and turn on Use the SSH agent. Add or import your keys as SSH key items.
  2. In MorphGate, choose 1Password as the agent. On Windows, 1Password's agent takes the place of the OpenSSH agent, so System agent reaches it too.

Bitwarden

  1. In the Bitwarden desktop app, open Settings and turn on Enable SSH agent. Add or import your keys as SSH key items.
  2. In MorphGate, choose Bitwarden as the agent. MorphGate finds the agent of the usual install and of the Flatpak and Snap versions. On Windows, Bitwarden's agent takes the place of the OpenSSH agent. The Mac App Store version keeps its socket elsewhere: choose Other socket or pipe and enter the path from Bitwarden's help pages.

KeePassXC

Turn on Settings → SSH Agent → Enable SSH Agent integration, and in each entry with a key, Add key to agent when database is opened. KeePassXC hands its keys to the agent your system already runs: choose System agent in MorphGate (or Pageant, if KeePassXC uses Pageant on Windows).

Secretive (macOS)

Secretive keeps keys in your Mac's Secure Enclave. Choose Secretive as the agent.

Pageant (Windows)

Start Pageant and load your keys into it, then choose Pageant as the agent.

When the system agent isn't found

On Linux and macOS, System agent uses SSH_AUTH_SOCK from the environment MorphGate started in. MorphGate started from the dock or the applications menu does not read the export lines in your shell's profile. If System agent says not running here, either choose Other socket or pipe and enter the agent's socket, or give MorphGate the variable:

  • Linux: on most distributions, a file such as ~/.config/environment.d/ssh-agent.conf with a line SSH_AUTH_SOCK=… (the socket's path) sets it for the whole desktop session. Sign out and back in. Or start MorphGate from a terminal where it is set.
  • macOS: in Terminal, launchctl setenv SSH_AUTH_SOCK … (the socket's path) gives it to apps you start from then on, until you restart the Mac. Quit and reopen MorphGate.

In a terminal with the same SSH_AUTH_SOCK, ssh-add -l lists the keys the agent offers.

Security keys

Keys on a hardware security key (FIDO2, key types starting with sk-) work through an agent. When one has to sign, MorphGate shows Touch your security key and the host it signs in to.

Agent forwarding

Forward the SSH agent in a host's editor lets programs on that host use your agent's keys while you're connected, for example git or ssh to another server. It's off unless you turn it on.

  • It forwards the agent the host signs in with, or the system agent if the host signs in another way.
  • Only terminal sessions to the host itself forward the agent; jump hosts, file browsing and tunnels don't.
  • While you're connected, anyone with root on that host can use your agent's keys too. Only turn it on for hosts you trust.

Good to know

  • Too many keys: servers usually stop after about six failed keys ("Too many authentication failures"). Pick the host's key under Key, so only that one is offered.
  • No keys offered: if the agent holds no keys, or not the key you picked, MorphGate says so instead of connecting. A locked password manager is the usual reason: unlock it and connect again.
  • Sync: a host set to SSH agent syncs as it is. On another device, that device's agent has to hold the key. A path under Other socket or pipe has to be right on every device.
  • Teams: a shared host can use the agent too. With Any key it holds, each member signs in with a key from their own password manager. With one key picked, only members whose agent holds that key can sign in.