-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathcertbot.cron
27 lines (22 loc) · 1 KB
/
certbot.cron
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/bin/sh
if test -f /var/log/letsencrypt/letsencrypt.log; then
# Preserve previous log until next run
mv /var/log/letsencrypt/letsencrypt.log /var/log/letsencrypt/letsencrypt.log.old;
fi
SNIKKET_CERTBOT_KEY_OPTIONS=${SNIKKET_CERTBOT_KEY_OPTIONS:---reuse-key}
su letsencrypt -- -c "certbot certonly -n --webroot --webroot-path /var/www \
--cert-path /etc/ssl/certbot \
--keep $SNIKKET_CERTBOT_OPTIONS $SNIKKET_CERTBOT_KEY_OPTIONS \
--agree-tos --email \"$SNIKKET_ADMIN_EMAIL\" --expand \
--config-dir /snikket/letsencrypt \
--domain \"$SNIKKET_DOMAIN\" --domain \"share.$SNIKKET_DOMAIN\" \
--domain \"groups.$SNIKKET_DOMAIN\"
"
sed -n '/^{/,/^}/p' /var/log/letsencrypt/letsencrypt.log \
| jq -r '(select(.status=="invalid").challenges | .[].error?.detail ), select(.detail).detail' \
> /var/log/letsencrypt/errors.log;
if test -s /var/log/letsencrypt/errors.log; then
touch /snikket/letsencrypt/has-errors;
elif test -f /snikket/letsencrypt/has-errors; then
rm /snikket/letsencrypt/has-errors;
fi