2017-11-15 00:48:22 +01:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
zulip_conf_get_boolean() {
|
|
|
|
# Get a boolean flag from zulip.conf, using the Python
|
|
|
|
# `configparser` library's conventions for what counts as true.
|
|
|
|
# Treat absent and invalid values as false.
|
|
|
|
value=$(crudini --get /etc/zulip/zulip.conf "$1" "$2" 2>/dev/null)
|
|
|
|
case "$(echo "$value" | tr A-Z a-z)" in
|
|
|
|
1|yes|true|on) return 0 ;;
|
|
|
|
*) return 1 ;;
|
|
|
|
esac
|
|
|
|
}
|
|
|
|
|
|
|
|
if ! zulip_conf_get_boolean certbot auto_renew; then
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
2018-07-22 20:56:24 +02:00
|
|
|
deploy_hook="${ZULIP_CERTBOT_DEPLOY_HOOK:-service nginx reload}"
|
|
|
|
|
2017-11-15 00:48:22 +01:00
|
|
|
/usr/local/sbin/certbot-auto renew --quiet \
|
2017-11-15 22:57:10 +01:00
|
|
|
--webroot --webroot-path=/var/lib/zulip/certbot-webroot/ \
|
2018-07-22 20:56:24 +02:00
|
|
|
--deploy-hook "$deploy_hook"
|