From 39f5f6499834e191d6c90ba74516a5ab0b60bb3c Mon Sep 17 00:00:00 2001 From: link2xt Date: Mon, 15 Apr 2024 14:08:32 +0000 Subject: [PATCH] Reload Dovecot and Postfix when TLS certificate updates (#271) --- CHANGELOG.md | 3 +++ cmdeploy/src/cmdeploy/__init__.py | 1 - cmdeploy/src/cmdeploy/acmetool/__init__.py | 19 ++++++++----------- cmdeploy/src/cmdeploy/acmetool/acmetool.hook | 2 ++ 4 files changed, 13 insertions(+), 12 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 16f2f514..39a0bec5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,9 @@ ## untagged +- Reload Dovecot and Postfix when TLS certificate updates + ([#271](https://github.com/deltachat/chatmail/pull/271)) + - Use forked version of dovecot without hardcoded delays ([#270](https://github.com/deltachat/chatmail/pull/270)) diff --git a/cmdeploy/src/cmdeploy/__init__.py b/cmdeploy/src/cmdeploy/__init__.py index ab7006d1..df77bc3c 100644 --- a/cmdeploy/src/cmdeploy/__init__.py +++ b/cmdeploy/src/cmdeploy/__init__.py @@ -530,7 +530,6 @@ def deploy_chatmail(config_path: Path) -> None: # Deploy acmetool to have TLS certificates. deploy_acmetool( - nginx_hook=True, domains=[mail_domain, f"mta-sts.{mail_domain}", f"www.{mail_domain}"], ) diff --git a/cmdeploy/src/cmdeploy/acmetool/__init__.py b/cmdeploy/src/cmdeploy/acmetool/__init__.py index 811b821c..ccf11784 100644 --- a/cmdeploy/src/cmdeploy/acmetool/__init__.py +++ b/cmdeploy/src/cmdeploy/acmetool/__init__.py @@ -5,7 +5,7 @@ from pyinfra import host from pyinfra.facts.systemd import SystemdStatus -def deploy_acmetool(nginx_hook=False, email="", domains=[]): +def deploy_acmetool(email="", domains=[]): """Deploy acmetool.""" apt.packages( name="Install acmetool", @@ -20,16 +20,13 @@ def deploy_acmetool(nginx_hook=False, email="", domains=[]): mode="644", ) - if nginx_hook: - files.put( - src=importlib.resources.files(__package__) - .joinpath("acmetool.hook") - .open("rb"), - dest="/usr/lib/acme/hooks/nginx", - user="root", - group="root", - mode="744", - ) + files.put( + src=importlib.resources.files(__package__).joinpath("acmetool.hook").open("rb"), + dest="/usr/lib/acme/hooks/nginx", + user="root", + group="root", + mode="744", + ) files.template( src=importlib.resources.files(__package__).joinpath("response-file.yaml.j2"), diff --git a/cmdeploy/src/cmdeploy/acmetool/acmetool.hook b/cmdeploy/src/cmdeploy/acmetool/acmetool.hook index 9ee11f45..f139e06a 100644 --- a/cmdeploy/src/cmdeploy/acmetool/acmetool.hook +++ b/cmdeploy/src/cmdeploy/acmetool/acmetool.hook @@ -3,3 +3,5 @@ set -e EVENT_NAME="$1" [ "$EVENT_NAME" = "live-updated" ] || exit 42 systemctl restart nginx.service +systemctl reload dovecot.service +systemctl reload postfix.service