From 8de957ddcfda8ef87d73a221c0594015134eebe2 Mon Sep 17 00:00:00 2001 From: Erich Eckner Date: Thu, 18 Apr 2019 10:11:12 +0200 Subject: lo-status: allow symmetric encryption --- lo-status | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/lo-status b/lo-status index 5abf9a7..1030eb4 100755 --- a/lo-status +++ b/lo-status @@ -2,13 +2,26 @@ cd "$(dirname "$0")" +if [ -f '/mnt/key/192.168.0.1' ]; then + ${gpg_options}='--passphrase-file /mnt/key/192.168.0.1' +fi + +credentials=$( + gpg -d ${gpg_options} --no-tty --batch -o - credentials.gpg 2>/dev/null +) +err=$? +if [ ${err} -ne 0 ]; then + >&2 echo 'gpg decrypt error' + exit ${err} +fi + curl \ -Ss \ --resolve backup-lo.ddns.eckner.net:443:backup-lo.vpn.ddns.eckner.net:443 \ 'https://backup-lo.ddns.eckner.net/chassis.html' \ --cacert backup-lo.crt \ --digest \ - --user "$(gpg -d -o - credentials.gpg 2>/dev/null)" \ + --user "${credentials}" \ | sed ' s,^.*Power Status:\([^<>]*\).*$,\1, t -- cgit v1.2.3-70-g09d2