![Postfix + dovecot,禁用端口 25 上的身份验证](https://linux22.com/image/100513/Postfix%20%2B%20dovecot%EF%BC%8C%E7%A6%81%E7%94%A8%E7%AB%AF%E5%8F%A3%2025%20%E4%B8%8A%E7%9A%84%E8%BA%AB%E4%BB%BD%E9%AA%8C%E8%AF%81.png)
我在 ubuntu 12.04 上使用 postfix 2.9.6(如果有的话,可以使用 dovecot)。
我正在尝试禁用端口 25 上的身份验证,只允许在端口 587 上进行身份验证,以便我可以正常从其他服务器接收邮件,但客户端只能在端口 587 上连接来发送邮件。
我尝试遵循此处和谷歌上找到的答案,但无论我更改什么设置,我总是能够在端口 25 上连接。
我的 master.cf 的相关部分:
smtp inet n - - - - smtpd
-o smtpd_tls_security_level=none
-o smtpd_sasl_auth_enable=no
submission inet n - - - - smtpd
-o smtpd_tls_security_level=encrypt
-o smtpd_sasl_auth_enable=yes
-o smtpd_client_restrictions=permit_sasl_authenticated,permit_mynetworks,reject
我的整个 main.cf:
smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
biff = no
append_dot_mydomain = no
readme_directory = no
smtpd_tls_cert_file=/etc/ssl/certs/dovecot.pem
smtpd_tls_key_file=/etc/ssl/private/dovecot.pem
smtpd_use_tls=yes
smtpd_sasl_type = dovecot
smtpd_sasl_path = private/auth
smtpd_sasl_auth_enable = yes
smtpd_tls_auth_only = yes
smtpd_sasl_security_options = noanonymous
smtpd_recipient_restrictions = permit_sasl_authenticated,permit_mynetworks,reject_unauth_destination
virtual_transport = lmtp:unix:private/dovecot-lmtp
virtual_uid_maps = static:5000
virtual_gid_maps = static:5000
virtual_alias_maps = mysql:/etc/postfix/mysql/virtual_alias_maps.cf
virtual_mailbox_domains = mysql:/etc/postfix/mysql/virtual_domains_maps.cf
virtual_mailbox_maps = mysql:/etc/postfix/mysql/virtual_mailbox_maps.cf
myhostname = xxxxxxxxxxxxxxxxxxx
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = /etc/mailname
mydestination = localhost
relayhost =
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all
milter_default_action = accept
milter_protocol = 2 #( Postfix ≥ 2.6 milter_protocol = 6, Postfix ≤ 2.5 milter_protocol = 2 )
smtpd_milters = inet:localhost:12345
non_smtpd_milters = inet:localhost:12345
smtpd_client_message_rate_limit = 2
anvil_rate_time_unit = 60s
答案1
您应该从 main.cf 中删除 smtpd_recipient_restrictions 并更改 master.cf,如下所示:
smtp inet n - - - - smtpd
-o smtpd_tls_security_level=none
-o smtpd_sasl_auth_enable=no
-o smtpd_client_restrictions=permit_mynetworks
submission inet n - - - - smtpd
-o smtpd_tls_security_level=encrypt
-o smtpd_sasl_auth_enable=yes
-o smtpd_client_restrictions=permit_sasl_authenticated,permit_mynetworks,reject
请小心参数配置错误 smtpd_client_restrictions
可能会造成危险