icinga2-container/usr/bin/update-certs

29 lines
711 B
Bash
Executable File

#!/bin/sh
set -eux
gen_cert() {
local app="$1"; shift
local restart_action="$1"; shift
cd "/etc/ssl/letsencrypt/$app"
mkdir -p "/etc/ssl/letsencrypt/$app"
set +e
simp_le --email joerg@higgsboson.tk \
-f account_key.json \
-f fullchain.pem \
-f key.pem \
$(for domain in "$@"; do echo "-d $domain"; done) \
--default_root /var/www/letsenrypt
local rc=$?
[ $rc = 1 ] && $restart_action
[ $rc != 0 ] && exit $rc
set -e
cat fullchain.pem key.pem > combined.pem
}
gen_cert "nginx" "nginx -s reload" "status.higgsboson.tk" "stats.higgsboson.tk"
gen_cert "influxdb" "s6-svc -t /var/run/s6/services/influxdb" "influxdb.higgsboson.tk"
touch /etc/ssl/letsencrypt/last-check