postfix: Only apply SASL-related restrictions in SASL-enabled services

This commit is contained in:
s3lph 2022-01-21 00:44:55 +01:00
parent 365a113201
commit f9f1648720
3 changed files with 6 additions and 1 deletions
roles/postfix
defaults/main
templates/etc/postfix

View file

@ -23,6 +23,7 @@ postfix_default_master_processes:
- '-o syslog_name=postfix/submission'
- '-o smtpd_sasl_auth_enable=yes'
- '-o smtpd_recipient_restrictions=permit_sasl_authenticated,reject'
- '-o _initial_sender_restrictions=reject_authenticated_sender_login_mismatch'
- '-o smtpd_client_restrictions='
- '-o smtpd_helo_restrictions='
- '-o smtpd_tls_security_level=encrypt'

View file

@ -16,7 +16,7 @@ postfix_smtpd_recipient_restrictions:
postfix_smtpd_sender_restrictions:
- permit_mynetworks
- reject_authenticated_sender_login_mismatch
- $_initial_sender_restrictions
- permit_sasl_authenticated
- reject_unknown_sender_domain
- reject_unknown_reverse_client_hostname

View file

@ -118,6 +118,10 @@ smtpd_helo_restrictions =
{% for restriction in postfix_smtpd_helo_restrictions %}
{{ restriction }},
{% endfor %}
# Postfix logs warnings when SASL is disabled, but authentication-related
# restrictions are applied. So these are now empty by default and set in
# master.cf for SASL-enabled services, e.g. "submission".
_initial_sender_restrictions =
smtpd_sender_restrictions =
{% for restriction in postfix_smtpd_sender_restrictions %}
{{ restriction }},