Skip to content

Commit

Permalink
Merge pull request #552 from modoboa/fix/le_renewal_hook
Browse files Browse the repository at this point in the history
Added renewal deploy hook to reload services.
  • Loading branch information
tonioo authored Apr 26, 2024
2 parents a187e08 + 015a535 commit b099337
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions modoboa_installer/ssl.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,17 @@ def generate_cert(self):
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):
Expand Down

0 comments on commit b099337

Please sign in to comment.