From 037ce191540f19287d266ce1517d661a6dee41e5 Mon Sep 17 00:00:00 2001 From: Jonathan Golder Date: Thu, 9 Feb 2017 20:08:34 +0100 Subject: [PATCH] Initial Version as in Uberspace Wiki https://wiki.uberspace.de/webserver:https#automatisieren_von_let_s_encrypt --- letsencrypt-renew.sh | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100755 letsencrypt-renew.sh diff --git a/letsencrypt-renew.sh b/letsencrypt-renew.sh new file mode 100755 index 0000000..5d010ce --- /dev/null +++ b/letsencrypt-renew.sh @@ -0,0 +1,14 @@ +#!/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 + # import certificate + uberspace-add-certificate -k ~/.config/letsencrypt/live/${domain}/privkey.pem -c ~/.config/letsencrypt/live/${domain}/cert.pem +fi