28 lines
702 B
Bash
Executable File
28 lines
702 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
|
|
cat fullchain.pem key.pem > combined.pem
|
|
local rc=$?
|
|
[ $rc = 1 ] && $restart_action
|
|
[ $rc != 0 ] && exit $rc
|
|
}
|
|
|
|
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
|