Added renewal deploy hook to reload services.

see #522
This commit is contained in:
Antoine Nguyen
2024-04-26 14:55:48 +02:00
parent 47468d3f72
commit c0bdc22c4c

View File

@@ -146,6 +146,17 @@ class LetsEncryptCertificate(CertificateBackend):
cfg_file = "/etc/letsencrypt/renewal/{}.conf".format(self.hostname)
pattern = "s/authenticator = standalone/authenticator = nginx/"
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):