Minor fixes

Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
Knut Ahlers 2018-08-22 10:33:42 +02:00
parent 0d368603f4
commit 42e943b1a8
Signed by: luzifer
GPG key ID: DC2729FDD34BE99E

View file

@ -1,7 +1,5 @@
#!/bin/bash #!/bin/bash
set -euo pipefail
set -e
set -o pipefail
source "${HOME}/bin/script_framework.sh" source "${HOME}/bin/script_framework.sh"
@ -22,8 +20,8 @@ chmod 0700 ${HELPER}
trap "rm ${HELPER}" EXIT trap "rm ${HELPER}" EXIT
cat -s <<EOF >${HELPER} cat -s <<EOF >${HELPER}
#!/bin/bash #!/bin/bash -eu
vault read -field=private "/secret/ssh-key/\$1" | exec ssh-add -t 3600 - vault read -field=private "secret/ssh-key/\$1" | exec ssh-add -t 3600 -
EOF EOF
for KEY_NAME in $@; do for KEY_NAME in $@; do
@ -36,7 +34,7 @@ for KEY_NAME in $@; do
fi fi
# Retrieve key from LastPass # Retrieve key from LastPass
PWD=$(vault read -field=passphrase "/secret/ssh-key/${KEY_NAME}") PWD=$(vault read -field=passphrase "secret/ssh-key/${KEY_NAME}")
# In case LastPass exitted non-zero we have no password # In case LastPass exitted non-zero we have no password
if ! [ $? -eq 0 ]; then if ! [ $? -eq 0 ]; then
error "[${KEY_NAME}] Unable to get password. Not trying to unlock." error "[${KEY_NAME}] Unable to get password. Not trying to unlock."