-3

我们有一个面向 Internet 的 MX 服务器,所有用户通过该服务器验证他们的传出连接以通过端口 587 提交电子邮件。该 MX 服务器将我们域的传入邮件路由到内部 postfix smtp 服务器,然后将邮件传递到本地 imap 服务器。

内部后缀 smtp 服务器用户 LDAP alias_maps = ldap:/etc/postfix/ldap-aliases.cf,用于查找用户邮箱所在的 imap 服务器。

有一个后缀选项...reject_sender_login_mismatch 可以映射... smtpd_sender_login_maps = ldap:/etc/postfix/smtpd_sender_login.cf

但是 - 我收到以下错误

7 月 4 日 11:23:26 smtp-1.domain1.com postfix/smtpd[31530]:警告:限制“reject_authenticated_sender_login_mismatch”被忽略:不支持 SASL

没有用户向内部后缀 smtp 服务器进行身份验证 - 它所做的只是从 MX 服务器路由电子邮件。我相信我看到警告“不支持 SASL”的原因是因为 postfix 不处理身份验证,因为它由 MX 服务器处理。

postconf -n

alias_database = hash:/etc/aliases
alias_maps = ldap:/etc/postfix/ldap-aliases.cf, 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 = ipv4
mail_owner = postfix
mailq_path = /usr/bin/mailq.postfix
manpage_directory = /usr/share/man
message_size_limit = 51200000
mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain,  mx3.$mydomain, mx1.$mydomain, mx2.$mydomain
mydomain = domain1.com
myhostname = smtp-1.domain1.com
mynetworks = xxx.xxx.192.0/21, xxx.62.52.0/22, 10.0.0.0/8, xxx.16.0.0/12, xxx.168.0.0/16
myorigin = $mydomain
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_sender_login_maps = ldap:/etc/postfix/ldap-senders.cf
smtpd_sender_restrictions = reject_authenticated_sender_login_mismatch
unknown_local_recipient_reject_code = 550

但是,使用不同的配置“smtpd_sender_restrictions = reject_unverified_sender”

如果“信封发件人”字段包含无效的伪造地址,则会记录以下内容——这对于阻止伪造未知电子邮件地址非常有用——但如果它是使用已知电子邮件地址伪造的,则无济于事。

NOQUEUE:拒绝:来自 mx.domain1.com[xxx.xxx.192.130] 的 RCPT:450 4.1.7:发件人地址被拒绝:未经验证的地址:未知用户:“hejem”;from= to= proto=ESMTP helo=

-bash-4.1$ postconf -n
alias_database = hash:/etc/aliases
alias_maps = ldap:/etc/postfix/ldap-aliases.cf, 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 = ipv4
mail_owner = postfix
mailq_path = /usr/bin/mailq.postfix
manpage_directory = /usr/share/man
message_size_limit = 51200000
mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain,        mx3.$mydomain, mx1.$mydomain, mx2.$mydomain
mydomain = domain1.com
myhostname = smtp-1.domain1.com
mynetworks = xxx.xxx.xxx.0/21, xxx.xxx.xxx.0/22, xxx.0.0.0/xxx, xxx.xxx.0.0/12, xxx.xxx.0.0/16
myorigin = $mydomain
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_sender_restrictions = reject_unverified_sender"

我想要实现的是我的本地内部后缀来检查“信封发件人字段”,以确保它不会被欺骗,因为它知道发送用户的用户名并在 LDAP 中查找它分配的“发件人”别名,如果它不匹配即他们'重新欺骗然后拒绝邮件。

任何建议如何在后缀中实施此检查?

谢谢

4

1 回答 1

2

首先,在 postfix 服务中激活 reject_unverified_sender 不是一个好的做法。如果您想阻止从您域中不存在的地址发送邮件,您应该更喜欢reject_unlisted_sender

如果不激活 postfix 服务上的身份验证 (SASL) 机制,您将无法确定欺骗现有邮件地址。因此,为了防止欺骗现有地址:

  • 确保正确配置了 smtpd_sender_login_maps。
  • 在 postfix 上激活 SASL 身份验证
  • 根据您的偏好配置reject_authenticated_sender_login_mismatch 或reject_sender_login_mismatch。

进一步阅读(来自 postfix SASL 文档)

信封发件人地址授权

默认情况下,SMTP 客户端可以在 MAIL FROM 命令中指定任何信封发件人地址。那是因为 Postfix SMTP 服务器只知道远程 SMTP 客户端的主机名和 IP 地址,而不知道控制远程 SMTP 客户端的用户。

这改变了 SMTP 客户端使用 SASL 身份验证的时刻。现在,Postfix SMTP 服务器知道发件人是谁。给定一个信封发件人地址和 SASL 登录名表,Postfix SMTP 服务器可以决定是否允许经过 SASL 身份验证的客户端使用特定的信封发件人地址:

/etc/postfix/main.cf: smtpd_sender_login_maps = hash:/etc/postfix/controlled_envelope_senders

smtpd_recipient_restrictions =
    ...
    reject_sender_login_mismatch
    permit_sasl_authenticated
于 2016-07-27T09:37:26.013 回答