From ee2b858661dfc92809d54e2f9102b2c20c8aaada Mon Sep 17 00:00:00 2001 From: missytake Date: Sun, 11 Jan 2026 23:57:27 +0100 Subject: [PATCH] postfix: hardcode IP addresses of relays without DNS, drop messages to nine --- README.md | 14 ++++++++++++-- cmdeploy/src/cmdeploy/postfix/deployer.py | 14 +++++++++++++- cmdeploy/src/cmdeploy/postfix/main.cf.j2 | 3 +++ cmdeploy/src/cmdeploy/postfix/transport | 5 +++++ 4 files changed, 33 insertions(+), 3 deletions(-) create mode 100644 cmdeploy/src/cmdeploy/postfix/transport diff --git a/README.md b/README.md index 5076faef..d0973cc2 100644 --- a/README.md +++ b/README.md @@ -3,13 +3,23 @@ With this branch, you don't need DNS at all, just a VPS with an IPv4 address, -let's take `77.42.80.106` as an example: +let's take `77.42.80.106` as an example. +First, choose a random domain name (it doesn't need working DNS) +and create a chatmail.ini config file: ``` cmdeploy init whatever.you.want +``` + +Then, in `cmdeploy/src/cmdeploy/postfix/transport`, +remove the line corresponding to your relay, +and add other for relays you know. +Now you can deploy the relay to your IP address: + +``` cmdeploy run --skip-dns-check --ssh-host 77.42.80.106 ``` -Then you can login with a `dclogin://` code like this: +Finally, you can login with a `dclogin://` code like this, with the correct "domain name" and IP address: `dclogin:s0m3r4nd0@whatever.you.want?p=w7i8da7h8uads92ycc2rufyl&v=1&ih=77.42.80.106&sh=77.42.80.106&sp=443&ip=443&ic=3&sc=3` diff --git a/cmdeploy/src/cmdeploy/postfix/deployer.py b/cmdeploy/src/cmdeploy/postfix/deployer.py index 34cbffa4..280b1b3e 100644 --- a/cmdeploy/src/cmdeploy/postfix/deployer.py +++ b/cmdeploy/src/cmdeploy/postfix/deployer.py @@ -60,7 +60,19 @@ class PostfixDeployer(Deployer): mode="644", ) need_restart |= lmtp_header_cleanup.changed - + # Transport map that discards messages to nine.testrun.org + transport_map = files.put( + src=get_resource("postfix/transport"), + dest="/etc/postfix/transport", + user="root", + group="root", + mode="644", + ) + need_restart |= transport_map.changed + if transport_map.changed: + server.shell( + commands=["postmap /etc/postfix/transport"], + ) # Login map that 1:1 maps email address to login. login_map = files.put( src=get_resource("postfix/login_map"), diff --git a/cmdeploy/src/cmdeploy/postfix/main.cf.j2 b/cmdeploy/src/cmdeploy/postfix/main.cf.j2 index 487bf00c..88f31ac6 100644 --- a/cmdeploy/src/cmdeploy/postfix/main.cf.j2 +++ b/cmdeploy/src/cmdeploy/postfix/main.cf.j2 @@ -83,6 +83,9 @@ mua_client_restrictions = permit_sasl_authenticated, reject mua_sender_restrictions = reject_sender_login_mismatch, permit_sasl_authenticated, reject mua_helo_restrictions = permit_mynetworks, reject_invalid_helo_hostname, reject_non_fqdn_helo_hostname, permit +# Discard messages to nine.testrun.org +transport_maps = hash:/etc/postfix/transport + # 1:1 map MAIL FROM to SASL login name. smtpd_sender_login_maps = regexp:/etc/postfix/login_map diff --git a/cmdeploy/src/cmdeploy/postfix/transport b/cmdeploy/src/cmdeploy/postfix/transport new file mode 100644 index 00000000..12903044 --- /dev/null +++ b/cmdeploy/src/cmdeploy/postfix/transport @@ -0,0 +1,5 @@ +no-dns.chatmail.at smtp:[77.42.80.106] +no-dns2.testrun.org smtp:[77.42.86.249] + +nine.testrun.org discard: +* :