我的 postfix 允许我无需用户名密码通过它发送电子邮件 - 如何禁用?

我的 postfix 允许我无需用户名密码通过它发送电子邮件 - 如何禁用?

我的 postfix 允许我通过它发送电子邮件而无需身份验证。它已设置为允许身份验证,但它也允许未经身份验证的发送,我想停止这种发送。

在这种情况下,哪些配置设置是相关的?

以下是 postconf -n 的输出以帮助调试:

alias_database = hash:/etc/aliases
alias_maps = hash:/etc/aliases
command_directory = /usr/sbin
config_directory = /etc/postfix
daemon_directory = /usr/libexec/postfix
data_directory = /var/lib/postfix
debug_peer_level = 2
html_directory = no
inet_interfaces = all
inet_protocols = all
mail_owner = postfix
mailq_path = /usr/bin/mailq.postfix
manpage_directory = /usr/share/man
mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain,
mydomain = hiddenforprivacy.org
myhostname = mail.hiddenforprivacy.org
myorigin = $myhostname
newaliases_path = /usr/bin/newaliases.postfix
queue_directory = /var/spool/postfix
readme_directory = /usr/share/doc/postfix-2.6.6/README_FILES
sample_directory = /usr/share/doc/postfix-2.6.6/samples
sendmail_path = /usr/sbin/sendmail.postfix
setgid_group = postdrop
smtpd_client_restrictions = permit_mynetworks, permit_sasl_authenticated
smtpd_recipient_restrictions = permit_sasl_authenticated, reject_unauth_destination
smtpd_sasl_auth_enable = yes
smtpd_sasl_path = private/auth
smtpd_sasl_type = dovecot
soft_bounce = no
unknown_local_recipient_reject_code = 550
virtual_alias_domains = 
virtual_alias_maps = hash:/etc/postfix/virtual

答案1

您应该permit_mynetworks从 smtpd_client_restrictions 中删除该指令。然后,如果您使用的是 2.10 或更高版本,请添加:

 smtpd_relay_restrictions = permit_sasl_authenticated, reject_unauth_destination

如果您还没有到达那里,请记住这一点,并在更新时添加此指令。

这样做的目的是禁用对您的邮件服务器的任何未经身份验证的访问,包括来自 $mynetworks 中您自己的网络的访问。唯一的例外是远程主机仍然能够提交发往您的某个地址的邮件(因此您仍然可以接收邮件,因为向您发送邮件的远程 MTA 未经过身份验证);这是 和 之间的区别reject_unauth_destinationreject它还会将您的中继访问控制更新为 2.10 规范。

如果您甚至不想在未经身份验证的情况下接受发往您域中主机的邮件(例如来自其他邮件服务器的邮件),请将其替换reject_unauth_destinationreject。如果您这样做,您将不会通过此服务器收到任何传入电子邮件。

相关内容