wader / postfix-relay

Postfix SMTP relay docker image
https://hub.docker.com/r/mwader/postfix-relay/
MIT License
139 stars 42 forks source link

Relay access denied for 4lvl domain name #107

Closed heggi closed 7 months ago

heggi commented 7 months ago

I run postfix-relay as a side container into kubernetes (dev environment). So I have 4lvl domain name, like the test.site.example.com I try send message to my email address and I got error Relay access denied

220 test.site.example.com ESMTP Postfix (Debian/GNU)
HELO test.site.example.com
250 test.site.example.com
mail from: no-replay@test.site.example.com
250 2.1.0 Ok
rcpt to: my@email.com
454 4.7.1 <my@email.com>: Relay access denied

in logs:

NOQUEUE: reject: RCPT from localhost[::1]: 454 4.7.1 <my@email.com>: Relay access denied; from=<no-replay@test.site.example.com> to=<my@email.com> proto=SMTP helo=<test.site.example.com>

main.cf

smtpd_banner = $myhostname ESMTP $mail_name (Debian/GNU)
biff = no
append_dot_mydomain = no
readme_directory = no
compatibility_level = 2
smtpd_tls_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem
smtpd_tls_key_file=/etc/ssl/private/ssl-cert-snakeoil.key
smtpd_use_tls=yes
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache

smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination
myhostname = test.site.example.com
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
mydestination = localhost
relayhost =
mynetworks = 0.0.0.0/0
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all
inet_protocols = all
smtp_tls_security_level = may
smtpd_tls_security_level = none
milter_default_action = accept
smtpd_milters = inet:localhost:12301
heggi commented 7 months ago

Problem at mynetworks = 0.0.0.0/0 Connect from sidecar use ipv6, but mynetworks allows only ipv4. I'm add env POSTFIX_mynetworks with value 0.0.0.0/0, [::]/0 and it fix my problem

wader commented 7 months ago

👍