From 889e18f803ce1ebecb60719a0ab23605b1fda93a Mon Sep 17 00:00:00 2001 From: missytake Date: Wed, 22 Nov 2023 16:01:06 +0100 Subject: [PATCH] generate-dns-zone.sh doesn't need to support CHATMAIL_SERVER env var for now, let's assume A/AAAA point to the chatmail server, too --- .../src/deploy_chatmail/__init__.py | 6 ++--- .../src/deploy_chatmail/nginx/mta-sts.txt.j2 | 2 +- scripts/generate-dns-zone.sh | 23 +++++++------------ 3 files changed, 12 insertions(+), 19 deletions(-) diff --git a/deploy-chatmail/src/deploy_chatmail/__init__.py b/deploy-chatmail/src/deploy_chatmail/__init__.py index 9f1df331..48dfb564 100644 --- a/deploy-chatmail/src/deploy_chatmail/__init__.py +++ b/deploy-chatmail/src/deploy_chatmail/__init__.py @@ -245,7 +245,7 @@ def _configure_dovecot(mail_server: str, debug: bool = False) -> bool: return need_restart -def _configure_nginx(domain: str, mail_server: str) -> bool: +def _configure_nginx(domain: str, debug: bool = False) -> bool: """Configures nginx HTTP server.""" need_restart = False @@ -275,7 +275,7 @@ def _configure_nginx(domain: str, mail_server: str) -> bool: user="root", group="root", mode="644", - config={"mail_server": mail_server}, + config={"domain_name": domain}, ) need_restart |= mta_sts_config.changed @@ -333,7 +333,7 @@ def deploy_chatmail(mail_domain: str, mail_server: str, dkim_selector: str) -> N dovecot_need_restart = _configure_dovecot(mail_server, debug=debug) postfix_need_restart = _configure_postfix(mail_domain, debug=debug) opendkim_need_restart = _configure_opendkim(mail_domain, dkim_selector) - nginx_need_restart = _configure_nginx(mail_domain, mail_server) + nginx_need_restart = _configure_nginx(mail_domain) mta_sts_need_restart = _install_mta_sts_daemon() # deploy web pages and info if we have them diff --git a/deploy-chatmail/src/deploy_chatmail/nginx/mta-sts.txt.j2 b/deploy-chatmail/src/deploy_chatmail/nginx/mta-sts.txt.j2 index 34d117e7..fc60e936 100644 --- a/deploy-chatmail/src/deploy_chatmail/nginx/mta-sts.txt.j2 +++ b/deploy-chatmail/src/deploy_chatmail/nginx/mta-sts.txt.j2 @@ -1,4 +1,4 @@ version: STSv1 mode: enforce -mx: {{ config.mail_server }} +mx: {{ config.domain_name }} max_age: 2419200 diff --git a/scripts/generate-dns-zone.sh b/scripts/generate-dns-zone.sh index 4243f6d4..4e99621f 100755 --- a/scripts/generate-dns-zone.sh +++ b/scripts/generate-dns-zone.sh @@ -1,6 +1,5 @@ #!/bin/sh : ${CHATMAIL_DOMAIN:=c1.testrun.org} -: ${CHATMAIL_SERVER:=$CHATMAIL_DOMAIN} : ${CHATMAIL_SSH:=$CHATMAIL_DOMAIN} set -e @@ -9,22 +8,16 @@ EMAIL="root@$CHATMAIL_DOMAIN" ACME_ACCOUNT_URL="$($SSH -- acmetool account-url)" cat <