From 7e6f8ddfba606d2577a992c4dc636b8065551b7c Mon Sep 17 00:00:00 2001 From: link2xt Date: Fri, 14 Feb 2025 03:14:15 +0000 Subject: [PATCH 1/5] Simplify SPF record There is no need to explicitly specify domain for `a` rule. --- cmdeploy/src/cmdeploy/chatmail.zone.j2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmdeploy/src/cmdeploy/chatmail.zone.j2 b/cmdeploy/src/cmdeploy/chatmail.zone.j2 index f0ba176..c3352a0 100644 --- a/cmdeploy/src/cmdeploy/chatmail.zone.j2 +++ b/cmdeploy/src/cmdeploy/chatmail.zone.j2 @@ -16,7 +16,7 @@ www.{{ mail_domain }}. CNAME {{ mail_domain }}. ; ; Recommended DNS entries for interoperability and security-hardening ; -{{ mail_domain }}. TXT "v=spf1 a:{{ mail_domain }} ~all" +{{ mail_domain }}. TXT "v=spf1 a ~all" _dmarc.{{ mail_domain }}. TXT "v=DMARC1;p=reject;adkim=s;aspf=s" {% if acme_account_url %} From 5cfdb0698f7726e6546dd1f7653b9d400cd267b6 Mon Sep 17 00:00:00 2001 From: adb Date: Sun, 16 Feb 2025 13:18:42 +0100 Subject: [PATCH 2/5] use old crypt lib in python < 3.11 (#483) --- chatmaild/pyproject.toml | 2 +- chatmaild/src/chatmaild/doveauth.py | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/chatmaild/pyproject.toml b/chatmaild/pyproject.toml index 079b4bc..3c3302c 100644 --- a/chatmaild/pyproject.toml +++ b/chatmaild/pyproject.toml @@ -12,7 +12,7 @@ dependencies = [ "deltachat-rpc-client", "filelock", "requests", - "crypt-r", + "crypt-r >= 3.13.1 ; python_version >= '3.11'", ] [tool.setuptools] diff --git a/chatmaild/src/chatmaild/doveauth.py b/chatmaild/src/chatmaild/doveauth.py index 7aed3b5..e6292a3 100644 --- a/chatmaild/src/chatmaild/doveauth.py +++ b/chatmaild/src/chatmaild/doveauth.py @@ -3,7 +3,10 @@ import logging import os import sys -import crypt_r +try: + import crypt_r +except ImportError: + import crypt as crypt_r from .config import Config, read_config from .dictproxy import DictProxy From 49907c78a36bbef1cf38d5f4b632e6d5306311e5 Mon Sep 17 00:00:00 2001 From: link2xt Date: Sun, 16 Feb 2025 15:15:31 +0000 Subject: [PATCH 3/5] Add changelog entry for crypt compatibility --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index f5c1380..f0594fe 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,9 @@ - improve secure-join message detection ([#473](https://github.com/deltachat/chatmail/pull/473)) +- use old crypt lib in python < 3.11 + ([#483](https://github.com/deltachat/chatmail/pull/483)) + ## 1.5.0 2024-12-20 - cmdeploy dns: always show recommended DNS records From 667a987dfcb61531d9c805cc71e1feae35acefa1 Mon Sep 17 00:00:00 2001 From: link2xt Date: Sun, 16 Feb 2025 15:43:17 +0000 Subject: [PATCH 4/5] Remove MTA-STS daemon --- cmdeploy/src/cmdeploy/__init__.py | 58 ++++++------------------ cmdeploy/src/cmdeploy/postfix/main.cf.j2 | 4 +- 2 files changed, 16 insertions(+), 46 deletions(-) diff --git a/cmdeploy/src/cmdeploy/__init__.py b/cmdeploy/src/cmdeploy/__init__.py index f50e563..f89f169 100644 --- a/cmdeploy/src/cmdeploy/__init__.py +++ b/cmdeploy/src/cmdeploy/__init__.py @@ -224,42 +224,21 @@ def _configure_opendkim(domain: str, dkim_selector: str = "dkim") -> bool: return need_restart -def _install_mta_sts_daemon() -> bool: - need_restart = False +def _uninstall_mta_sts_daemon() -> None: + # Remove configuration. + files.file("/etc/mta-sts-daemon.yml", present=False) - config = files.put( - name="upload postfix-mta-sts-resolver config", - src=importlib.resources.files(__package__).joinpath( - "postfix/mta-sts-daemon.yml" - ), - dest="/etc/mta-sts-daemon.yml", - user="root", - group="root", - mode="644", + files.directory("/usr/local/lib/postfix-mta-sts-resolver", present=False) + + files.file("/etc/systemd/system/mta-sts-daemon.service", present=False) + + systemd.service( + name="Stop MTA-STS daemon", + service="mta-sts-daemon.service", + daemon_reload=True, + running=False, + enabled=False, ) - need_restart |= config.changed - - server.shell( - name="install postfix-mta-sts-resolver with pip", - commands=[ - "python3 -m virtualenv /usr/local/lib/postfix-mta-sts-resolver", - "/usr/local/lib/postfix-mta-sts-resolver/bin/pip install postfix-mta-sts-resolver", - ], - ) - - systemd_unit = files.put( - name="upload mta-sts-daemon systemd unit", - src=importlib.resources.files(__package__).joinpath( - "postfix/mta-sts-daemon.service" - ), - dest="/etc/systemd/system/mta-sts-daemon.service", - user="root", - group="root", - mode="644", - ) - need_restart |= systemd_unit.changed - - return need_restart def _configure_postfix(config: Config, debug: bool = False) -> bool: @@ -663,8 +642,8 @@ def deploy_chatmail(config_path: Path, disable_mail: bool) -> None: debug = False dovecot_need_restart = _configure_dovecot(config, debug=debug) postfix_need_restart = _configure_postfix(config, debug=debug) - mta_sts_need_restart = _install_mta_sts_daemon() nginx_need_restart = _configure_nginx(config) + _uninstall_mta_sts_daemon() _remove_rspamd() opendkim_need_restart = _configure_opendkim(mail_domain, "opendkim") @@ -677,15 +656,6 @@ def deploy_chatmail(config_path: Path, disable_mail: bool) -> None: restarted=opendkim_need_restart, ) - systemd.service( - name="Start and enable MTA-STS daemon", - service="mta-sts-daemon.service", - daemon_reload=True, - running=True, - enabled=True, - restarted=mta_sts_need_restart, - ) - # Dovecot should be started before Postfix # because it creates authentication socket # required by Postfix. diff --git a/cmdeploy/src/cmdeploy/postfix/main.cf.j2 b/cmdeploy/src/cmdeploy/postfix/main.cf.j2 index 973ca71..33ab571 100644 --- a/cmdeploy/src/cmdeploy/postfix/main.cf.j2 +++ b/cmdeploy/src/cmdeploy/postfix/main.cf.j2 @@ -20,9 +20,9 @@ smtpd_tls_key_file=/var/lib/acme/live/{{ config.mail_domain }}/privkey smtpd_tls_security_level=may smtp_tls_CApath=/etc/ssl/certs -smtp_tls_security_level=may +smtp_tls_security_level=verify smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache -smtp_tls_policy_maps = socketmap:inet:127.0.0.1:8461:postfix +smtp_tls_policy_maps = inline:{nauta.cu=may} smtpd_tls_protocols = >=TLSv1.2 # Disable anonymous cipher suites From 5633582d315f608836166377144d67fd103c7afd Mon Sep 17 00:00:00 2001 From: link2xt Date: Sun, 16 Feb 2025 21:27:15 +0000 Subject: [PATCH 5/5] Add changelog entry for MTA-STS daemon removal --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index f0594fe..180ed75 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,9 @@ - use old crypt lib in python < 3.11 ([#483](https://github.com/deltachat/chatmail/pull/483)) +- remove MTA-STS daemon + ([#488](https://github.com/deltachat/chatmail/pull/488)) + ## 1.5.0 2024-12-20 - cmdeploy dns: always show recommended DNS records