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

Postifx header_checks not working

· 52CE 我爱测

I have the main.cf config: header_checks = regexp:/etc/postfix/header_checks And the /etc/postfix/header_checks : /^Subject:.*viagra.*/i DISCARD /^Subject:.*pills.*/i DISCARD /^Subject:.*f\*ckbuddy.*/i DISCARD /^Subject:.*f\*ckfr…

问题原文

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

I have the main.cf config:

header_checks = regexp:/etc/postfix/header_checks

And the /etc/postfix/header_checks:

/^Subject:.*viagra.*/i DISCARD
/^Subject:.*pills.*/i DISCARD
/^Subject:.*f\*ckbuddy.*/i DISCARD
/^Subject:.*f\*ckfriend.*/i DISCARD
/^Subject:.*f\@ck.*/i DISCARD

/^From:.*viagra.*/i DISCARD

Notice I have added the /i to make case insensitive. Not sure if it allows this?

I have tried sending emails from a hotmail to my server with pills in the subject but still no luck! Also is there a return to sender method instead of DISCARD?

社区高分解答

原帖链接 · Ryan H. · CC BY-SA 3.0

If postmap -q "<put test header here>" regexp:/etc/postfix/header_checks is correctly returning DISCARD (or the appropriate action for the match) but postfix is not actually performing said action, then there is probably a receive_override_options=no_header_body_checks somewhere in main.cf or master.cf that is turning off the header checks. In the master.cf file, it would be a -o option in one of the service configuration entries.

There are 4 options for receive_override_options:

  • no_unknown_recipient_checks Do not try to reject unknown recipients (SMTP server only). This is typically specified AFTER an external content filter.
  • no_address_mappings Disable canonical address mapping, virtual alias map expansion, address masquerading, and automatic BCC (blind carbon-copy) recipients. This is typically specified BEFORE an external content filter.
  • no_header_body_checks Disable header/body_checks. This is typically specified AFTER an external content filter.
  • no_milters Disable Milter (mail filter) applications. This is typically specified AFTER an external content filter.

The no_address_mappings options will typically be located in main.cf while the other options, in master.cf

The "-o receive_override_options" overrides main.cf settings to avoid duplicating work that was already done before the content filter. These options are complementary to the options that are specified in main.cf

Source: Postfix After-Queue Content Filter

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

资料来源与适用范围

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

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

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