mirror of
https://github.com/chatmail/relay.git
synced 2026-05-22 05:48:03 +00:00
DNS: fix reverse DNS checking
This commit is contained in:
@@ -5,10 +5,10 @@ _submission._tcp.{chatmail_domain}. SRV 0 1 587 {chatmail_domain}.
|
|||||||
_submissions._tcp.{chatmail_domain}. SRV 0 1 465 {chatmail_domain}.
|
_submissions._tcp.{chatmail_domain}. SRV 0 1 465 {chatmail_domain}.
|
||||||
_imap._tcp.{chatmail_domain}. SRV 0 1 143 {chatmail_domain}.
|
_imap._tcp.{chatmail_domain}. SRV 0 1 143 {chatmail_domain}.
|
||||||
_imaps._tcp.{chatmail_domain}. SRV 0 1 993 {chatmail_domain}.
|
_imaps._tcp.{chatmail_domain}. SRV 0 1 993 {chatmail_domain}.
|
||||||
{chatmail_domain}. IN CAA 128 issue "letsencrypt.org;accounturi={acme_account_url}"
|
{chatmail_domain}. CAA 128 issue "letsencrypt.org;accounturi={acme_account_url}"
|
||||||
{chatmail_domain}. TXT "v=spf1 a:{chatmail_domain} -all"
|
{chatmail_domain}. TXT "v=spf1 a:{chatmail_domain} -all"
|
||||||
_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}. IN CNAME {chatmail_domain}.
|
mta-sts.{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}
|
||||||
|
|||||||
@@ -50,8 +50,11 @@ class DNS:
|
|||||||
|
|
||||||
def check_ptr_record(self, ip: str, mail_domain) -> str:
|
def check_ptr_record(self, ip: str, mail_domain) -> str:
|
||||||
"""Check the PTR record for an IPv4 or IPv6 address."""
|
"""Check the PTR record for an IPv4 or IPv6 address."""
|
||||||
result = self.get("PTR", ip_address(ip).reverse_pointer)
|
result = self.get("-x", ip)
|
||||||
return result[:-1] == mail_domain
|
if ip_address(ip).version == 6:
|
||||||
|
result = result.split()[-1]
|
||||||
|
if result[:-1] == mail_domain:
|
||||||
|
return result
|
||||||
|
|
||||||
|
|
||||||
def show_dns(args, out):
|
def show_dns(args, out):
|
||||||
@@ -74,9 +77,9 @@ def show_dns(args, out):
|
|||||||
dkim_entry = read_dkim_entries(out.shell_output(f"{ssh} -- opendkim-genzone -F"))
|
dkim_entry = read_dkim_entries(out.shell_output(f"{ssh} -- opendkim-genzone -F"))
|
||||||
|
|
||||||
ipv6 = dns.get_ipv6()
|
ipv6 = dns.get_ipv6()
|
||||||
reverse_ipv6 = dns.check_ptr_record(ipv6, args.config.mail_domain)
|
reverse_ipv6 = dns.check_ptr_record(ipv6, mail_domain)
|
||||||
ipv4 = dns.get_ipv4()
|
ipv4 = dns.get_ipv4()
|
||||||
reverse_ipv4 = dns.check_ptr_record(ipv4, args.config.mail_domain)
|
reverse_ipv4 = dns.check_ptr_record(ipv4, mail_domain)
|
||||||
to_print = []
|
to_print = []
|
||||||
|
|
||||||
with open(template, "r") as f:
|
with open(template, "r") as f:
|
||||||
|
|||||||
Reference in New Issue
Block a user