Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.4.0
1.4.1
1 change: 1 addition & 0 deletions dotfiles/ssh-config
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

Host *
AddKeysToAgent yes
UseKeychain yes
ServerAliveInterval 60
ServerAliveCountMax 3

Expand Down
20 changes: 20 additions & 0 deletions modules/07-ssh.sh
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,26 @@ elif [ -f "$OP_CONF" ]; then
mbp_log_step "1Password agent not found — removed stale config"
fi

# Add all discovered keys to the agent with Keychain persistence
# This stores passphrases in macOS Keychain so they survive reboots
if [ "$KEY_COUNT" -gt 0 ]; then
for key in "$SSH_DIR"/*; do
[ -f "$key" ] || continue
[[ "$key" == *.pub ]] && continue
[[ "$(basename "$key")" == "known_hosts"* ]] && continue
[[ "$(basename "$key")" == "authorized_keys" ]] && continue
[[ "$(basename "$key")" == "config"* ]] && continue
[[ "$(basename "$key")" == "environment" ]] && continue

# --apple-use-keychain stores the passphrase so it persists across sessions
if ssh-add --apple-use-keychain "$key" 2>/dev/null; then
mbp_log_step "added to agent: $(basename "$key")"
else
mbp_log_warn "could not add $(basename "$key") to agent — you may need to run: ssh-add --apple-use-keychain $key"
fi
done
fi

mbp_log_ok "SSH: $KEY_COUNT keys secured"

state_set_module_ok "ssh"
Expand Down
Loading