将后缀中的 tld 列入黑名单

Rob*_*Rob 5 postfix

在我的 postfix 设置中,我想“禁用”来自特定 TLD 域的所有传入邮件(在我的情况下,所有域都以“.info”结尾)。我阻止域的常用方法是在 中使用散列文件/etc/postfix/rejected_domains,看起来像这样

[...]
bla.info     REJECT Spam
blubb.info   REJECT More Spam!
[...]
Run Code Online (Sandbox Code Playgroud)

并在我的main.cf文件中有这段配置:

# domains to be restricted
smtpd_sender_restrictions = hash:/etc/postfix/rejected_domains
reject_unauth_destinations = hash:/etc/postfix/rejected_domains
Run Code Online (Sandbox Code Playgroud)

我阻止所有信息的想法是将这些规则添加到上述文件中:

*.info  REJECT Toooo much spam
.info   REJECT Toooo much spam
Run Code Online (Sandbox Code Playgroud)

不幸的是,这似乎不起作用。

2.8.5-2~build0.10.04在此处在 Ubuntu LTS 10 上使用 postfix 。

Jac*_*ans 9

哈希用于文字(完全匹配),您想使用正则表达式或 pcre:

正如Overmind指出的,如果你已经有值,你想附加这些,你可以检查你现有的值

postconf smtpd_sender_restrictions
postconf reject_unauth_destinations
Run Code Online (Sandbox Code Playgroud)

然后你可以用以下方法覆盖它们:

postconf -e smtpd_sender_restrictions=pcre:/etc/postfix/rejected_domains
postconf -e reject_unauth_destinations=pcre:/etc/postfix/rejected_domains
Run Code Online (Sandbox Code Playgroud)

/etc/postfix/rejected_domains 的内容:

/\.info$/           REJECT All Info Domains
Run Code Online (Sandbox Code Playgroud)

进而 postfix reload

  • 正确,postmap 用于哈希或 lmdb 文件 (3认同)
  • 请注意,这将替换其他限制设置。最好直接编辑文件。 (2认同)