dotfiles

My collection of dotfiles
git clone git://git.noxz.tech/dotfiles
Log | Files | Refs

commit 40554adb2586f20681a65cf89586c53034563270
parent d152fbc3b327eabe3f3029b6e967226f8d8acc2a
Author: Chris Noxz <chris@noxz.tech>
Date:   Sat, 20 Jun 2020 11:07:06 +0200

[bin] do not store imported keys on disk

Diffstat:
Mbin/.local/bin/ssh-add-pass | 1-
Mbin/.local/bin/ssh-agent-init | 19++++++++++++++++++-
2 files changed, 18 insertions(+), 2 deletions(-)

diff --git a/bin/.local/bin/ssh-add-pass b/bin/.local/bin/ssh-add-pass @@ -7,7 +7,6 @@ fi PASS="$(cat - | sed -e "s|\"|\\\"|g")" - expect <<EOF spawn ssh-add "$1" expect { diff --git a/bin/.local/bin/ssh-agent-init b/bin/.local/bin/ssh-agent-init @@ -1,14 +1,31 @@ #!/bin/sh +# initialized? +[ -f "$HOME/.tmp/.ssh-agent-init-done" ] && return + +# clear key store ssh-add -D + +# load keys from pass set -- $(ls "$XDG_DATA_HOME/pass/ssh"); for key do + # extract key + touch "$HOME/.ssh/keys/.$key.key" + chmod 600 "$HOME/.ssh/keys/.$key.key" + pass ssh/$key/private > "$HOME/.ssh/keys/.$key.key" + + # import key passphrase pass ssh/$key/passphrase | ssh-add-pass "$HOME/.ssh/keys/.$key.key" \ - 2>&1 >/dev/null && printf '[%s+%s] identity added: %s%s%s\n' \ + 2>/dev/null >/dev/null && printf '[%s+%s] identity added: %s%s%s\n' \ "$(tput setaf 10)" \ "$(tput sgr0)" \ "$(tput setaf 15)" \ "$key" \ "$(tput sgr0)" + + # remove key once it's loaded + rm -f "$HOME/.ssh/keys/.$key.key" done + +# done! touch "$HOME/.tmp/.ssh-agent-init-done"