mirror of
https://github.com/chatmail/relay.git
synced 2026-05-14 18:04:38 +00:00
Compare commits
12 Commits
default-pa
...
link2xt/ww
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f7cdfbd929 | ||
|
|
891b510c39 | ||
|
|
3765bc1697 | ||
|
|
825285d12b | ||
|
|
7391a17ff8 | ||
|
|
b6622fc68e | ||
|
|
75b41641f0 | ||
|
|
30a61972fb | ||
|
|
bcc54602ee | ||
|
|
f9998d5721 | ||
|
|
8605ceba5e | ||
|
|
30bcf9ff77 |
@@ -157,6 +157,6 @@ While this file is present, account creation will be blocked.
|
|||||||
[acmetool](https://hlandau.github.io/acmetool/) listens on port 80 (http).
|
[acmetool](https://hlandau.github.io/acmetool/) listens on port 80 (http).
|
||||||
|
|
||||||
Delta Chat apps will, however, discover all ports and configurations
|
Delta Chat apps will, however, discover all ports and configurations
|
||||||
automatically by reading the [autoconfig XML file](https://web.archive.org/web/20210624004729/https://developer.mozilla.org/en-US/docs/Mozilla/Thunderbird/Autoconfiguration) from the chatmail service.
|
automatically by reading the [autoconfig XML file](https://www.ietf.org/archive/id/draft-bucksch-autoconfig-00.html) from the chatmail service.
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -91,7 +91,7 @@ def lookup_passdb(db, config: Config, user, cleartext_password):
|
|||||||
VALUES (?, ?, ?)"""
|
VALUES (?, ?, ?)"""
|
||||||
conn.execute(q, (user, encrypted_password, int(time.time())))
|
conn.execute(q, (user, encrypted_password, int(time.time())))
|
||||||
return dict(
|
return dict(
|
||||||
home=f"/home/vmail/{user}",
|
home=f"/home/vmail/mail/{config.mail_domain}/{user}",
|
||||||
uid="vmail",
|
uid="vmail",
|
||||||
gid="vmail",
|
gid="vmail",
|
||||||
password=encrypted_password,
|
password=encrypted_password,
|
||||||
|
|||||||
@@ -61,7 +61,10 @@ def test_handle_dovecot_request(db, example_config):
|
|||||||
assert res
|
assert res
|
||||||
assert res[0] == "O" and res.endswith("\n")
|
assert res[0] == "O" and res.endswith("\n")
|
||||||
userdata = json.loads(res[1:].strip())
|
userdata = json.loads(res[1:].strip())
|
||||||
assert userdata["home"] == "/home/vmail/some42123@chat.example.org"
|
assert (
|
||||||
|
userdata["home"]
|
||||||
|
== "/home/vmail/mail/chat.example.org/some42123@chat.example.org"
|
||||||
|
)
|
||||||
assert userdata["uid"] == userdata["gid"] == "vmail"
|
assert userdata["uid"] == userdata["gid"] == "vmail"
|
||||||
assert userdata["password"].startswith("{SHA512-CRYPT}")
|
assert userdata["password"].startswith("{SHA512-CRYPT}")
|
||||||
|
|
||||||
|
|||||||
@@ -254,6 +254,17 @@ def _configure_postfix(config: Config, debug: bool = False) -> bool:
|
|||||||
)
|
)
|
||||||
need_restart |= master_config.changed
|
need_restart |= master_config.changed
|
||||||
|
|
||||||
|
header_cleanup = files.put(
|
||||||
|
src=importlib.resources.files(__package__).joinpath(
|
||||||
|
"postfix/submission_header_cleanup"
|
||||||
|
),
|
||||||
|
dest="/etc/postfix/submission_header_cleanup",
|
||||||
|
user="root",
|
||||||
|
group="root",
|
||||||
|
mode="644",
|
||||||
|
)
|
||||||
|
need_restart |= header_cleanup.changed
|
||||||
|
|
||||||
return need_restart
|
return need_restart
|
||||||
|
|
||||||
|
|
||||||
@@ -413,7 +424,10 @@ def deploy_chatmail(config_path: Path) -> None:
|
|||||||
)
|
)
|
||||||
|
|
||||||
# Deploy acmetool to have TLS certificates.
|
# Deploy acmetool to have TLS certificates.
|
||||||
deploy_acmetool(nginx_hook=True, domains=[mail_domain, f"mta-sts.{mail_domain}"])
|
deploy_acmetool(
|
||||||
|
nginx_hook=True,
|
||||||
|
domains=[mail_domain, f"mta-sts.{mail_domain}", f"www.{mail_domain}"],
|
||||||
|
)
|
||||||
|
|
||||||
apt.packages(
|
apt.packages(
|
||||||
name="Install Postfix",
|
name="Install Postfix",
|
||||||
|
|||||||
@@ -10,5 +10,6 @@ _imaps._tcp.{chatmail_domain}. SRV 0 1 993 {chatmail_domain}.
|
|||||||
_dmarc.{chatmail_domain}. TXT "v=DMARC1;p=reject;rua=mailto:{email};ruf=mailto:{email};fo=1;adkim=r;aspf=r"
|
_dmarc.{chatmail_domain}. TXT "v=DMARC1;p=reject;rua=mailto:{email};ruf=mailto:{email};fo=1;adkim=r;aspf=r"
|
||||||
_mta-sts.{chatmail_domain}. TXT "v=STSv1; id={sts_id}"
|
_mta-sts.{chatmail_domain}. TXT "v=STSv1; id={sts_id}"
|
||||||
mta-sts.{chatmail_domain}. CNAME {chatmail_domain}.
|
mta-sts.{chatmail_domain}. CNAME {chatmail_domain}.
|
||||||
|
www.{chatmail_domain}. CNAME {chatmail_domain}.
|
||||||
_smtp._tls.{chatmail_domain}. TXT "v=TLSRPTv1;rua=mailto:{email}"
|
_smtp._tls.{chatmail_domain}. TXT "v=TLSRPTv1;rua=mailto:{email}"
|
||||||
{dkim_entry}
|
{dkim_entry}
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ import requests
|
|||||||
import importlib
|
import importlib
|
||||||
import subprocess
|
import subprocess
|
||||||
import datetime
|
import datetime
|
||||||
from ipaddress import ip_address
|
|
||||||
|
|
||||||
|
|
||||||
class DNS:
|
class DNS:
|
||||||
@@ -184,14 +183,14 @@ def check_necessary_dns(out, mail_domain):
|
|||||||
ipv4 = dns.get("A", mail_domain)
|
ipv4 = dns.get("A", mail_domain)
|
||||||
ipv6 = dns.get("AAAA", mail_domain)
|
ipv6 = dns.get("AAAA", mail_domain)
|
||||||
mta_entry = dns.get("CNAME", "mta-sts." + mail_domain)
|
mta_entry = dns.get("CNAME", "mta-sts." + mail_domain)
|
||||||
mta_ip = dns.get("A", mta_entry)
|
www_entry = dns.get("CNAME", "www." + mail_domain)
|
||||||
if not mta_ip:
|
|
||||||
mta_ip = dns.get("AAAA", mta_entry)
|
|
||||||
to_print = []
|
to_print = []
|
||||||
if not (ipv4 or ipv6):
|
if not (ipv4 or ipv6):
|
||||||
to_print.append(f"\t{mail_domain}.\t\t\tA<your server's IPv4 address>")
|
to_print.append(f"\t{mail_domain}.\t\t\tA<your server's IPv4 address>")
|
||||||
if not mta_ip or not (mta_ip == ipv4 or mta_ip == ipv6):
|
if mta_entry != mail_domain + ".":
|
||||||
to_print.append(f"\tmta-sts.{mail_domain}.\tCNAME\t{mail_domain}.")
|
to_print.append(f"\tmta-sts.{mail_domain}.\tCNAME\t{mail_domain}.")
|
||||||
|
if www_entry != mail_domain + ".":
|
||||||
|
to_print.append(f"\twww.{mail_domain}.\tCNAME\t{mail_domain}.")
|
||||||
if to_print:
|
if to_print:
|
||||||
to_print.insert(
|
to_print.insert(
|
||||||
0,
|
0,
|
||||||
|
|||||||
@@ -41,11 +41,19 @@ http {
|
|||||||
try_files $uri $uri/ =404;
|
try_files $uri $uri/ =404;
|
||||||
}
|
}
|
||||||
|
|
||||||
location /metrics {
|
location /metrics {
|
||||||
default_type text/plain;
|
default_type text/plain;
|
||||||
}
|
}
|
||||||
|
|
||||||
# add cgi-bin support
|
# add cgi-bin support
|
||||||
include /usr/share/doc/fcgiwrap/examples/nginx.conf;
|
include /usr/share/doc/fcgiwrap/examples/nginx.conf;
|
||||||
|
}
|
||||||
|
|
||||||
|
# Redirect www. to non-www
|
||||||
|
server {
|
||||||
|
listen 443 ssl;
|
||||||
|
listen [::]:443 ssl;
|
||||||
|
server_name www.{{ config.domain_name }};
|
||||||
|
return 301 $scheme://{{ config.domain_name }}$request_uri;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -48,3 +48,5 @@ virtual_mailbox_domains = {{ config.mail_domain }}
|
|||||||
|
|
||||||
smtpd_milters = unix:opendkim/opendkim.sock
|
smtpd_milters = unix:opendkim/opendkim.sock
|
||||||
non_smtpd_milters = $smtpd_milters
|
non_smtpd_milters = $smtpd_milters
|
||||||
|
|
||||||
|
header_checks = regexp:/etc/postfix/submission_header_cleanup
|
||||||
|
|||||||
4
cmdeploy/src/cmdeploy/postfix/submission_header_cleanup
Normal file
4
cmdeploy/src/cmdeploy/postfix/submission_header_cleanup
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
/^Received:/ IGNORE
|
||||||
|
/^X-Originating-IP:/ IGNORE
|
||||||
|
/^X-Mailer:/ IGNORE
|
||||||
|
/^User-Agent:/ IGNORE
|
||||||
@@ -1,7 +1,10 @@
|
|||||||
import time
|
import time
|
||||||
import re
|
import re
|
||||||
import random
|
import random
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
import requests
|
||||||
|
import ipaddress
|
||||||
|
|
||||||
|
|
||||||
class TestEndToEndDeltaChat:
|
class TestEndToEndDeltaChat:
|
||||||
@@ -119,3 +122,17 @@ class TestEndToEndDeltaChat:
|
|||||||
for msg in msgs:
|
for msg in msgs:
|
||||||
assert "error" not in m.get_message_info()
|
assert "error" not in m.get_message_info()
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
|
|
||||||
|
|
||||||
|
def test_hide_senders_ip_address(cmfactory):
|
||||||
|
public_ip = requests.get("http://icanhazip.com").content.decode().strip()
|
||||||
|
assert ipaddress.ip_address(public_ip)
|
||||||
|
|
||||||
|
user1, user2 = cmfactory.get_online_accounts(2)
|
||||||
|
chat = cmfactory.get_accepted_chat(user1, user2)
|
||||||
|
|
||||||
|
chat.send_text("testing submission header cleanup")
|
||||||
|
user2.wait_next_incoming_message()
|
||||||
|
user2.direct_imap.select_folder("Inbox")
|
||||||
|
msg = user2.direct_imap.get_all_messages()[0]
|
||||||
|
assert public_ip not in msg.obj.as_string()
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
## More information
|
## More information
|
||||||
|
|
||||||
`nine.testrun.org` provides a low-maintenance, resource efficient and
|
{{ config.mail_domain }} provides a low-maintenance, resource efficient and
|
||||||
interoperable e-mail service for everyone. What's behind a `chatmail` is
|
interoperable e-mail service for everyone. What's behind a `chatmail` is
|
||||||
effectively a normal e-mail address just like any other but optimized
|
effectively a normal e-mail address just like any other but optimized
|
||||||
for the usage in chats, especially DeltaChat.
|
for the usage in chats, especially DeltaChat.
|
||||||
|
|||||||
Reference in New Issue
Block a user