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

Blacklisting tld in postfix

· 52CE 我爱测

In my postfix setup I want to "disable" all incoming mail from a specific TLD domain (in my case, all domains ending with ".info"). My usual way to block domains is using a hashed file in /etc/postfix/rejected_domains , that look…

问题原文

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

In my postfix setup I want to "disable" all incoming mail from a specific TLD domain (in my case, all domains ending with ".info"). My usual way to block domains is using a hashed file in /etc/postfix/rejected_domains, that looks like this

[...]
bla.info     REJECT Spam
blubb.info   REJECT More Spam!
[...]

and having this piece of configuration in my main.cf file:

# domains to be restricted
smtpd_sender_restrictions = hash:/etc/postfix/rejected_domains
reject_unauth_destinations = hash:/etc/postfix/rejected_domains

My idea to block all of info was adding these rules into the above file:

*.info  REJECT Toooo much spam
.info   REJECT Toooo much spam

Unluckily this does not seem to work.

Using postfix 2.8.5-2~build0.10.04 on Ubuntu LTS 10 here.

已采纳解答

原帖链接 · Jacob Evans · CC BY-SA 3.0

Hash is for literals (exact matches), you want to use regex or pcre:

as Overmind pointed out, you want to append these if you already have values, you can check you existing values with

postconf smtpd_sender_restrictions
postconf reject_unauth_destinations

Then you can override them with:

postconf -e smtpd_sender_restrictions=pcre:/etc/postfix/rejected_domains
postconf -e reject_unauth_destinations=pcre:/etc/postfix/rejected_domains

contents of /etc/postfix/rejected_domains:

/\.info$/           REJECT All Info Domains

and then postfix reload

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

资料来源与适用范围

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

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

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