mirror of
https://github.com/chatmail/relay.git
synced 2026-05-19 04:18:09 +00:00
postfix: make delivery for IP-only relays work
This commit is contained in:
@@ -21,6 +21,11 @@ class Config:
|
|||||||
def __init__(self, inipath, params):
|
def __init__(self, inipath, params):
|
||||||
self._inipath = inipath
|
self._inipath = inipath
|
||||||
self.mail_domain = params["mail_domain"]
|
self.mail_domain = params["mail_domain"]
|
||||||
|
self.mail_domain_hostname = format_arpa_address(params["mail_domain"])
|
||||||
|
if is_valid_ipv4(params["mail_domain"]):
|
||||||
|
self.mail_domain_deliverable = f"[{params['mail_domain']}]"
|
||||||
|
else:
|
||||||
|
self.mail_domain_deliverable = params["mail_domain"]
|
||||||
self.max_user_send_per_minute = int(params.get("max_user_send_per_minute", 60))
|
self.max_user_send_per_minute = int(params.get("max_user_send_per_minute", 60))
|
||||||
self.max_user_send_burst_size = int(params.get("max_user_send_burst_size", 10))
|
self.max_user_send_burst_size = int(params.get("max_user_send_burst_size", 10))
|
||||||
self.max_mailbox_size = params["max_mailbox_size"]
|
self.max_mailbox_size = params["max_mailbox_size"]
|
||||||
@@ -185,3 +190,9 @@ def is_valid_ipv4(address: str) -> bool:
|
|||||||
return True
|
return True
|
||||||
except ValueError:
|
except ValueError:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
|
def format_arpa_address(address: str) -> str:
|
||||||
|
if is_valid_ipv4(address):
|
||||||
|
return ipaddress.IPv4Address(address).reverse_pointer
|
||||||
|
return address
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
myorigin = {{ config.mail_domain }}
|
myorigin = {{ config.mail_domain_deliverable }}
|
||||||
|
|
||||||
smtpd_banner = $myhostname ESMTP $mail_name (Debian/GNU)
|
smtpd_banner = $myhostname ESMTP $mail_name (Debian/GNU)
|
||||||
biff = no
|
biff = no
|
||||||
@@ -54,14 +54,16 @@ smtpd_tls_exclude_ciphers = aNULL, RC4, MD5, DES
|
|||||||
tls_preempt_cipherlist = yes
|
tls_preempt_cipherlist = yes
|
||||||
|
|
||||||
smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination
|
smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination
|
||||||
myhostname = {{ config.mail_domain }}
|
myhostname = {{ config.mail_domain_hostname }}
|
||||||
alias_maps = hash:/etc/aliases
|
alias_maps = hash:/etc/aliases
|
||||||
alias_database = hash:/etc/aliases
|
alias_database = hash:/etc/aliases
|
||||||
|
|
||||||
# Postfix does not deliver mail for any domain by itself.
|
# When postfix receives mail for $mydestination,
|
||||||
# Primary domain is listed in `virtual_mailbox_domains` instead
|
# it hands it over to dovecot via $local_transport.
|
||||||
# and handed over to Dovecot.
|
mydestination = {{ config.mail_domain_deliverable }}
|
||||||
mydestination =
|
local_transport = lmtp:unix:private/dovecot-lmtp
|
||||||
|
# postfix doesn't check whether local users exist or not:
|
||||||
|
local_recipient_maps =
|
||||||
|
|
||||||
relayhost =
|
relayhost =
|
||||||
{% if disable_ipv6 %}
|
{% if disable_ipv6 %}
|
||||||
@@ -79,8 +81,6 @@ inet_protocols = ipv4
|
|||||||
inet_protocols = all
|
inet_protocols = all
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
virtual_transport = lmtp:unix:private/dovecot-lmtp
|
|
||||||
virtual_mailbox_domains = {{ config.mail_domain }}
|
|
||||||
lmtp_header_checks = regexp:/etc/postfix/lmtp_header_cleanup
|
lmtp_header_checks = regexp:/etc/postfix/lmtp_header_cleanup
|
||||||
|
|
||||||
mua_client_restrictions = permit_sasl_authenticated, reject
|
mua_client_restrictions = permit_sasl_authenticated, reject
|
||||||
|
|||||||
Reference in New Issue
Block a user