24 lines
456 B
Bash
Executable file
24 lines
456 B
Bash
Executable file
#!/bin/sh
|
|
|
|
if [ $# -ne 1 ]; then
|
|
echo "Usage: $(basename "$0") <hostname>" 1>&2
|
|
exit 1
|
|
fi
|
|
|
|
TARGET=$1
|
|
|
|
ENC=/srv/private/keystore/${TARGET}.asc
|
|
KEY=/srv/private/ssh/id_rsa
|
|
|
|
if [ ! -f "${KEY}" ]; then
|
|
echo "ERR: Cannot find encryption key file ${KEY}" 1>&2
|
|
exit 1
|
|
fi
|
|
|
|
if [ ! -f "${ENC}" ]; then
|
|
echo "ERR: Cannot find password entry for ${TARGET}" 1>&2
|
|
exit 1
|
|
fi
|
|
|
|
base64 -d "${ENC}" | openssl rsautl -decrypt -raw -inkey "${KEY}"
|
|
echo
|