From 73df8a111b6d042eadd49e4811432066c0314025 Mon Sep 17 00:00:00 2001 From: William Mantly Date: Tue, 30 Jul 2024 20:36:41 -0400 Subject: [PATCH] shell script to pull certs from redis --- ops/cert.sh | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 ops/cert.sh diff --git a/ops/cert.sh b/ops/cert.sh new file mode 100644 index 0000000..d74469c --- /dev/null +++ b/ops/cert.sh @@ -0,0 +1,23 @@ +#!/usr/bin/env bash +# William Mantly +# MIT License +# https://github.com/wmantly + +ME="$(basename "$(test -L "$0" && readlink "$0" || echo "$0")")" + +if [ "$1" == "--help" ] || [ "$1" == "-h" ]; then + echo "Usage: $ME [domain] [cert]" + echo "Usage: $ME chat.theta42.com cert_pem" + echo "This will extract the cert and private key from the proxy for given domain" + echo "Valid cert options, only one at a time: 'cert_pem', 'expiry', 'fullchain_pem', 'privkey_pem'" + + exit 0 +fi + +if [ "$2" == "" ]; then + (>&2 echo "This command takes exectly 2 arguments. See $ME --help") + + exit 1 +fi + +redis-cli get "$1:latest" | python3 -c "import json;print( json.loads(input())['$2'] )"