Files
letsencrypt-renew/letsencrypt-renew.sh
T
golderweb 840573ffd3 Use a per domain config file
To be able to use multiple different domains/certificates in one
uberspace. Call per each domain with domain=domain.tld environment
variable set.
2017-02-09 20:14:56 +01:00

15 lines
534 B
Bash
Executable File

#!/bin/bash
PATH=/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin
# sleep for a random time so not all certificates get renewed at the same time
sleep 473
openssl x509 -checkend $(( 21 * 86400 )) -in ~/.config/letsencrypt/live/${domain}/cert.pem > /dev/null
if [ \$? != 0 ]; then
# run let's encrypt
letsencrypt certonly -c ~/.config/letsencrypt/cli-${domain}.ini
# import certificate
uberspace-add-certificate -k ~/.config/letsencrypt/live/${domain}/privkey.pem -c ~/.config/letsencrypt/live/${domain}/cert.pem
fi