mirror of
https://github.com/chatmail/relay.git
synced 2026-05-18 04:08:59 +00:00
Compare commits
1 Commits
link2xt/ww
...
link2xt/no
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5e3cb73585 |
@@ -255,9 +255,7 @@ def _configure_postfix(config: Config, debug: bool = False) -> bool:
|
|||||||
need_restart |= master_config.changed
|
need_restart |= master_config.changed
|
||||||
|
|
||||||
header_cleanup = files.put(
|
header_cleanup = files.put(
|
||||||
src=importlib.resources.files(__package__).joinpath(
|
src=importlib.resources.files(__package__).joinpath("postfix/submission_header_cleanup"),
|
||||||
"postfix/submission_header_cleanup"
|
|
||||||
),
|
|
||||||
dest="/etc/postfix/submission_header_cleanup",
|
dest="/etc/postfix/submission_header_cleanup",
|
||||||
user="root",
|
user="root",
|
||||||
group="root",
|
group="root",
|
||||||
@@ -424,10 +422,7 @@ def deploy_chatmail(config_path: Path) -> None:
|
|||||||
)
|
)
|
||||||
|
|
||||||
# Deploy acmetool to have TLS certificates.
|
# Deploy acmetool to have TLS certificates.
|
||||||
deploy_acmetool(
|
deploy_acmetool(nginx_hook=True, domains=[mail_domain, f"mta-sts.{mail_domain}"])
|
||||||
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,6 +10,5 @@ _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,6 +4,7 @@ import requests
|
|||||||
import importlib
|
import importlib
|
||||||
import subprocess
|
import subprocess
|
||||||
import datetime
|
import datetime
|
||||||
|
from ipaddress import ip_address
|
||||||
|
|
||||||
|
|
||||||
class DNS:
|
class DNS:
|
||||||
@@ -183,14 +184,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)
|
||||||
www_entry = dns.get("CNAME", "www." + mail_domain)
|
mta_ip = dns.get("A", mta_entry)
|
||||||
|
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 mta_entry != mail_domain + ".":
|
if not mta_ip or not (mta_ip == ipv4 or mta_ip == ipv6):
|
||||||
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,19 +41,11 @@ 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;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,10 +14,6 @@ smtp inet n - y - - smtpd -v
|
|||||||
{% else %}
|
{% else %}
|
||||||
smtp inet n - y - - smtpd
|
smtp inet n - y - - smtpd
|
||||||
{% endif %}
|
{% endif %}
|
||||||
#smtp inet n - y - 1 postscreen
|
|
||||||
#smtpd pass - - y - - smtpd
|
|
||||||
#dnsblog unix - - y - 0 dnsblog
|
|
||||||
#tlsproxy unix - - y - 0 tlsproxy
|
|
||||||
submission inet n - y - - smtpd
|
submission inet n - y - - smtpd
|
||||||
-o syslog_name=postfix/submission
|
-o syslog_name=postfix/submission
|
||||||
-o smtpd_tls_security_level=encrypt
|
-o smtpd_tls_security_level=encrypt
|
||||||
|
|||||||
Reference in New Issue
Block a user