Merge pull request #552 from modoboa/fix/le_renewal_hook
Added renewal deploy hook to reload services.
This commit is contained in:
@@ -146,6 +146,17 @@ class LetsEncryptCertificate(CertificateBackend):
|
|||||||
cfg_file = "/etc/letsencrypt/renewal/{}.conf".format(self.hostname)
|
cfg_file = "/etc/letsencrypt/renewal/{}.conf".format(self.hostname)
|
||||||
pattern = "s/authenticator = standalone/authenticator = nginx/"
|
pattern = "s/authenticator = standalone/authenticator = nginx/"
|
||||||
utils.exec_cmd("perl -pi -e '{}' {}".format(pattern, cfg_file))
|
utils.exec_cmd("perl -pi -e '{}' {}".format(pattern, cfg_file))
|
||||||
|
with open("/etc/letsencrypt/renewal-hooks/deploy/reload-services.sh", "w") as fp:
|
||||||
|
fp.write(f"""#!/bin/bash
|
||||||
|
|
||||||
|
HOSTNAME=$(basename $RENEWED_LINEAGE)
|
||||||
|
|
||||||
|
if [ "$HOSTNAME" = "{self.hostname}" ]
|
||||||
|
then
|
||||||
|
systemctl reload dovecot
|
||||||
|
systemctl reload postfix
|
||||||
|
fi
|
||||||
|
""")
|
||||||
|
|
||||||
|
|
||||||
def get_backend(config):
|
def get_backend(config):
|
||||||
|
|||||||
Reference in New Issue
Block a user