|
| 1 | +# 33. 1Password SSH Agent Allowlist |
| 2 | + |
| 3 | +Date: 2026-05-04 |
| 4 | + |
| 5 | +## Status |
| 6 | + |
| 7 | +Accepted |
| 8 | + |
| 9 | +## Context |
| 10 | + |
| 11 | +`ssh/config.d/auth` (see [ADR 26](0026-versioned-ssh-config-with-config-d.md)) |
| 12 | +points `Host *`'s `IdentityAgent` at the 1Password agent socket. Every ssh |
| 13 | +connection that doesn't have a more specific `IdentityAgent` lands there, and |
| 14 | +1Password offers up keys from the unlocked vault. |
| 15 | + |
| 16 | +By default, 1Password's agent offers _every_ SSH key item in every vault the |
| 17 | +account can see. On a single-purpose machine that's fine. On a machine with |
| 18 | +both work and personal contexts, it's noisy and occasionally wrong: |
| 19 | + |
| 20 | +- Servers that allow multiple keys for a user may auth with whichever one |
| 21 | + shows up first, even if it isn't the "right" one |
| 22 | +- 1Password prompts for biometric/system approval per key offer, and offering |
| 23 | + irrelevant keys means more prompts to dismiss |
| 24 | +- The personal-agent key from [ADR 31](0031-role-scoped-agent-git-identity.md) |
| 25 | + lives on disk + macOS Keychain by design, but is also stored in 1Password |
| 26 | + vault as a backup. That entry should never be _offered_ by the 1Password |
| 27 | + agent (the on-disk + Keychain path is what claude-agent uses), even though |
| 28 | + it's fine for it to live in the vault for reference. |
| 29 | + |
| 30 | +On the work laptop specifically, `ssh-add -l` against the 1Password socket |
| 31 | +listed seven keys, including the personal-agent key. That's the immediate |
| 32 | +trigger. |
| 33 | + |
| 34 | +## Decision |
| 35 | + |
| 36 | +Manage `~/.config/1Password/ssh/agent.toml` as a role-aware symlink into the |
| 37 | +dotfiles repo. The file in the repo is an allowlist of 1Password items by |
| 38 | +title, scoped per-role. |
| 39 | + |
| 40 | +### Implementation |
| 41 | + |
| 42 | +**`config/1password/agent.toml.<role>`** holds the allowlist for that role. |
| 43 | +On the work laptop, only Gusto-related items are listed: |
| 44 | + |
| 45 | +```toml |
| 46 | +[[ssh-keys]] |
| 47 | +item = "Gusto Laptop id_ed25519" |
| 48 | + |
| 49 | +[[ssh-keys]] |
| 50 | +item = "Gusto Signing Key" |
| 51 | + |
| 52 | +[[ssh-keys]] |
| 53 | +item = "homebrew-gusto_deploy_key" |
| 54 | +``` |
| 55 | + |
| 56 | +Listed `[[ssh-keys]]` entries are an allowlist: 1Password offers only those |
| 57 | +items, regardless of what else lives in the vault. `item` matches the |
| 58 | +1Password item title (not the SSH key comment). |
| 59 | + |
| 60 | +**`sshconfig.sh`** appends a section that resolves |
| 61 | +`config/1password/agent.toml.$DOTPICKLES_ROLE` and symlinks it to |
| 62 | +`~/.config/1Password/ssh/agent.toml` if the source file exists and the |
| 63 | +1Password app dir is present. The role-aware path means a new machine joining |
| 64 | +under a different role doesn't accidentally inherit another machine's |
| 65 | +allowlist; it just skips the link until the role's file exists. |
| 66 | + |
| 67 | +**`functions.sh`'s `link_directory_contents`** skip list adds |
| 68 | +`config/1password`. Without that, the auto-linker would try to symlink the |
| 69 | +directory itself to `~/.config/1password` (lowercase), which 1Password |
| 70 | +ignores -- it reads the capital-P path. Listing it as a skip alongside |
| 71 | +`config/fish` matches the existing pattern for "directory managed by its own |
| 72 | +installer." |
| 73 | + |
| 74 | +### Why per-role rather than per-host |
| 75 | + |
| 76 | +1Password's `agent.toml` does support `host = "..."` filters per key, which |
| 77 | +would let one file describe behavior for both work and personal hosts. But |
| 78 | +the dotfiles role system already cleanly partitions "this is a work laptop" |
| 79 | +from "this is a personal laptop," and the simplest mental model is "the |
| 80 | +allowlist is whatever the role file says." A future iteration could add |
| 81 | +host-scoping inside a role file (e.g. work laptop allows the Gusto signing |
| 82 | +key for github.com only) without changing the role-based selection. |
| 83 | + |
| 84 | +### Alternatives Considered |
| 85 | + |
| 86 | +1. **Single allowlist with `host =` filters covering both machines** |
| 87 | + |
| 88 | + - Pros: one file describes everything |
| 89 | + - Cons: every machine's vault still has to share the same item titles; |
| 90 | + a vault rename on one machine breaks behavior on the other; harder to |
| 91 | + reason about |
| 92 | + - Rejected: role-based selection is a cleaner cut |
| 93 | + |
| 94 | +2. **Delete the personal-agent key from the 1Password vault** |
| 95 | + |
| 96 | + - Pros: no allowlist needed; problem disappears |
| 97 | + - Cons: loses the "key is backed up in 1Password" property, which is the |
| 98 | + reason it was added in the first place |
| 99 | + - Rejected: the user wants the key in the vault for reference |
| 100 | + |
| 101 | +3. **Stop using the 1Password agent altogether on the work laptop** |
| 102 | + |
| 103 | + - Pros: removes a class of identity-leak issues |
| 104 | + - Cons: defeats 1Password as the auth UX for the entire flow, including |
| 105 | + non-agent uses; significantly larger change for one annoyance |
| 106 | + - Rejected: too broad |
| 107 | + |
| 108 | +## Consequences |
| 109 | + |
| 110 | +### Positive |
| 111 | + |
| 112 | +- 1Password offers only the keys relevant to the active role, cutting the |
| 113 | + work laptop from 7 offered keys to 3 |
| 114 | +- The personal-agent key stays in 1Password vault for backup but is not |
| 115 | + offered by the 1Password agent on any machine, preserving ADR 31's |
| 116 | + "agent key auth path is on-disk + Keychain only" property |
| 117 | +- A new role file (`agent.toml.<role>`) is a one-file change to add another |
| 118 | + machine type |
| 119 | +- Existing `link` helper handles the symlink lifecycle (creation, rewriting, |
| 120 | + conflict prompts) without bespoke shell |
| 121 | + |
| 122 | +### Negative |
| 123 | + |
| 124 | +- One more file to keep in sync per role. When a new key is added to the |
| 125 | + vault for that role, it has to be added to the allowlist or it won't be |
| 126 | + offered. Failure mode is "key isn't found," which is loud rather than |
| 127 | + silent |
| 128 | +- 1Password item _titles_ are the matching key. Renaming an item in |
| 129 | + 1Password silently breaks the allowlist until the file is updated |
| 130 | +- The capital-P quirk (`~/.config/1Password/` vs the rest of `~/.config/`'s |
| 131 | + lowercase convention) means the skip list and the explicit symlink in |
| 132 | + sshconfig.sh are necessary; a reader who doesn't know the quirk might |
| 133 | + wonder why config/1password isn't auto-linked like everything else under |
| 134 | + config/ |
0 commit comments