summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2019-04-18 10:11:12 +0200
committerErich Eckner <git@eckner.net>2019-04-18 10:11:12 +0200
commit8de957ddcfda8ef87d73a221c0594015134eebe2 (patch)
treea32338fb9216db9738e0cd6bdefe67f603b75c9e
parenta5a96b1f63c84f32d4fe95f5e6a27f78c43c7519 (diff)
downloadlo-status-8de957ddcfda8ef87d73a221c0594015134eebe2.tar.xz
lo-status: allow symmetric encryption
-rwxr-xr-xlo-status15
1 files changed, 14 insertions, 1 deletions
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,^.*<TR><TD><STRONG>Power Status:</STRONG></TD><TD>\([^<>]*\)</TD></TR>.*$,\1,
t