Skip to content

Commit 17e3d30

Browse files
committed
wip
Signed-off-by: Jagoda Ślązak <jslazak@jslazak.com>
1 parent 74326a8 commit 17e3d30

File tree

5 files changed

+34
-4
lines changed

5 files changed

+34
-4
lines changed

chatmaild/src/chatmaild/config.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,9 @@ def __init__(self, inipath, params):
3939
params.get("filtermail_smtp_port_incoming", "10081")
4040
)
4141
self.filtermail_http_port = int(params.get("filtermail_http_port", "10082"))
42+
self.filtermail_smtp_port_transport = int(
43+
params.get("filtermail_smtp_port_transport", "10083")
44+
)
4245
self.postfix_reinject_port = int(params.get("postfix_reinject_port", "10025"))
4346
self.postfix_reinject_port_incoming = int(
4447
params.get("postfix_reinject_port_incoming", "10026")

cmdeploy/src/cmdeploy/filtermail/deployer.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66

77
class FiltermailDeployer(Deployer):
8-
services = ["filtermail", "filtermail-incoming"]
8+
services = ["filtermail", "filtermail-incoming", "filtermail-transport"]
99
bin_path = "/usr/local/bin/filtermail"
1010
config_path = "/usr/local/lib/chatmaild/chatmail.ini"
1111

@@ -14,9 +14,9 @@ def __init__(self):
1414

1515
def install(self):
1616
arch = host.get_fact(facts.server.Arch)
17-
url = f"https://github.com/chatmail/filtermail/releases/download/v0.6.1/filtermail-{arch}"
17+
url = f"https://kamiokan.de/bin/filtermail"
1818
sha256sum = {
19-
"x86_64": "48b3fb80c092d00b9b0a0ef77a8673496da3b9aed5ec1851e1df936d5589d62f",
19+
"x86_64": "ba350cc651de2a5740b1861b4e3d890cfe4bdb47e13e648045f3c59f333ab7e1",
2020
"aarch64": "c65bd5f45df187d3d65d6965a285583a3be0f44a6916ff12909ff9a8d702c22e",
2121
}[arch]
2222
self.need_restart |= files.download(
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
[Unit]
2+
Description=Chatmail transport service
3+
4+
[Service]
5+
Environment="RUST_LOG=trace"
6+
ExecStart={{ bin_path }} {{ config_path }} transport
7+
Restart=always
8+
RestartSec=30
9+
User=vmail
10+
11+
[Install]
12+
WantedBy=multi-user.target

cmdeploy/src/cmdeploy/postfix/main.cf.j2

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,11 @@ smtpd_tls_key_file={{ config.tls_key_path }}
2020
smtpd_tls_security_level=may
2121

2222
smtp_tls_CApath=/etc/ssl/certs
23-
smtp_tls_security_level=verify
23+
# Messages are relayed to locally running filtermail-transport
24+
# which handles actual transport (see default_transport).
25+
# Opening TLS connection to local service is redundant.
26+
# The actual TLS connection with other MTAs is handled by filtermail-transport.
27+
smtp_tls_security_level=none
2428
# Send SNI extension when connecting to other servers.
2529
# <https://www.postfix.org/postconf.5.html#smtp_tls_servername>
2630
smtp_tls_servername = hostname
@@ -118,3 +122,10 @@ smtpd_sender_login_maps = regexp:/etc/postfix/login_map
118122
# Do not lookup SMTP client hostnames to reduce delays
119123
# and avoid unnecessary DNS requests.
120124
smtpd_peername_lookup = no
125+
126+
# Use filtermail-transport to relay messages.
127+
# We can't force postfix to split messages per destination,
128+
# when specifying a custom next-hop,
129+
# so instead this is handled in filtermail.
130+
# We use LMTP instead SMTP so we can communicate per-recipient errors back to postfix.
131+
default_transport = lmtp-filtermail:inet:[127.0.0.1]:{{ config.filtermail_smtp_port_transport }}

cmdeploy/src/cmdeploy/postfix/master.cf.j2

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,3 +100,7 @@ filter unix - n n - - lmtp
100100
# cannot send unprotected Subject.
101101
authclean unix n - - - 0 cleanup
102102
-o header_checks=regexp:/etc/postfix/submission_header_cleanup
103+
104+
lmtp-filtermail unix - - y - - lmtp
105+
-o syslog_name=postfix/lmtp-filtermail
106+
-o lmtp_header_checks=

0 commit comments

Comments
 (0)