summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorCarlo Sala <carlosalag@protonmail.com>2024-10-15 13:02:12 +0200
committerGitHub <noreply@github.com>2024-10-15 13:02:12 +0200
commit09a94672003b21b8a3d8d15d31098641e7f3a4db (patch)
treeab004d4917b645c4d7fb5609f6a1bdf0ae35d6e1 /plugins
parentb3ba8da4218c3b9e1e5e45e1d4c00d312ff7226b (diff)
downloadzsh-09a94672003b21b8a3d8d15d31098641e7f3a4db.tar.gz
zsh-09a94672003b21b8a3d8d15d31098641e7f3a4db.tar.bz2
zsh-09a94672003b21b8a3d8d15d31098641e7f3a4db.zip
Revert "feat(ssh-agent): add keys regardless of filename (#12741)" (#12761)
This reverts commit d2d5155d41cbe183ef172fef1e83a29d116a5af6. Closes #12743 Closes #12745 Closes #12758
Diffstat (limited to 'plugins')
-rw-r--r--plugins/ssh-agent/ssh-agent.plugin.zsh17
1 files changed, 7 insertions, 10 deletions
diff --git a/plugins/ssh-agent/ssh-agent.plugin.zsh b/plugins/ssh-agent/ssh-agent.plugin.zsh
index becd5ea17..83548648b 100644
--- a/plugins/ssh-agent/ssh-agent.plugin.zsh
+++ b/plugins/ssh-agent/ssh-agent.plugin.zsh
@@ -39,16 +39,13 @@ function _add_identities() {
return
fi
- # If no keys specified in zstyle, add default keys.
- # Mimics calling ssh-add with no arguments.
- if [[ ${#identities[@]} -eq 0 ]]; then
- # Iterate over files in .ssh folder.
- for file in "$HOME/.ssh"/*; do
- # Check if file is a regular file and starts with "-----BEGIN OPENSSH PRIVATE KEY-----".
- if [[ -f "$file" && $(command head -n 1 "$file") =~ ^-----BEGIN\ OPENSSH\ PRIVATE\ KEY----- ]]; then
- # Add filename (without path) to identities array.
- identities+=("${file##*/}")
- fi
+ # add default keys if no identities were set up via zstyle
+ # this is to mimic the call to ssh-add with no identities
+ if [[ ${#identities} -eq 0 ]]; then
+ # key list found on `ssh-add` man page's DESCRIPTION section
+ for id in id_rsa id_dsa id_ecdsa id_ed25519 id_ed25519_sk identity; do
+ # check if file exists
+ [[ -f "$HOME/.ssh/$id" ]] && identities+=($id)
done
fi