大网数据广告活动
服务器运维问答

Postfix : How to reject sender addresses that don't exist only for local domains

· 52CE 我爱测

On my Postfix I'm trying to reject senders that use fake addresses from domains managed locally. But I only want to perform the check for the local domains, not for every senders. So if example.com is managed locally, I want to b…

问题原文

原帖链接 · Matthieu · CC BY-SA 3.0

On my Postfix I'm trying to reject senders that use fake addresses from domains managed locally. But I only want to perform the check for the local domains, not for every senders.

So if example.com is managed locally, I want to block [email omitted] and let [email omitted] and [email omitted] pass.

I looked into smtpd_sender_restrictions with reject_unverified_sender but I don't see how to do the check only for the local domains.

已采纳解答

原帖链接 · masegaloeh · CC BY-SA 3.0

The parameter that you are looking for is smtpd_reject_unlisted_sender

smtpd_reject_unlisted_sender (default: no)

Request that the Postfix SMTP server rejects mail from unknown sender addresses, even when no explicit reject_unlisted_sender access restriction is specified. This can slow down an explosion of forged mail from worms or viruses.

An address is always considered "known" when it matches a virtual(5) alias or a canonical(5) mapping.

  • The sender domain matches $mydestination, $inet_interfaces or $proxy_interfaces, but the sender is not listed in $local_recipient_maps, and $local_recipient_maps is not null.
  • The sender domain matches $virtual_alias_domains but the sender is not listed in $virtual_alias_maps.
  • The sender domain matches $virtual_mailbox_domains but the sender is not listed in $virtual_mailbox_maps, and $virtual_mailbox_maps is not null.
  • The sender domain matches $relay_domains but the sender is not listed in $relay_recipient_maps, and $relay_recipient_maps is not null.

This feature is available in Postfix 2.1 and later.

You can enable it by specify smtpd_reject_unlisted_sender = yes in main.cf. Another way is put reject_unlisted_sender in smtpd_*_restriction stack.


Additional note: what's difference between reject_unverified_sender and reject_unlisted_sender?

The difference of both method lies on how it perform verification.

  • Postfix with parameter reject_unverified_sender will verifies the sender by telnet to remote MX server and perform unfinished SMTP transaction with recipient = unverified_sender. If the remote server doesn't reject the recipient, then postfix assume that the sender was verified. See How address verification works in postfix documentation.
  • Postfix with parameter reject_unlisted_sender will verifies the sender by looking into valid recipient in ALL domain classes (local, virtual alias, virtual mailbox and relay.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2015-05-26)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。