Postfix check_sender_access 映射被忽略

Postfix check_sender_access 映射被忽略

我在 main.cf 中有以下内容:

smtpd_recipient_restrictions = permit_mynetworks,
 permit_sasl_authenticated,
 reject_unauth_destination,
 check_sender_access pcre:/etc/postfix/sender_access.pcre,
 check_recipient_access hash:/etc/postfix/recipient_access,

文件中还有以下行/etc/postfix/sender_access.pcre

/^[A-Z][a-z]{2,}[A-Z][a-z]{2,}\d\d+@/i REJECT You look like spam bot 1

使用邮件日志中的地址测试地图似乎表明它应该被拒绝:

$ postmap -q "[email protected]" pcre:/etc/postfix/sender_access.pcre 
REJECT You look like spam bot 1

然而,那封邮件被接受了。

我的配置有什么问题?

以下是我的完整(略作编辑)的 postconf -n 输出,以防万一有相关内容:

alias_database = hash:/etc/postfix/aliases
alias_maps = hash:/etc/postfix/aliases
append_dot_mydomain = no
biff = no
config_directory = /etc/postfix
content_filter = smtp-amavis:[127.0.0.1]:10024
delay_warning_time = 4h
home_mailbox = Maildir/
inet_interfaces = all
local_recipient_maps = unix:passwd.byname, $alias_maps
mailbox_size_limit = 0
message_size_limit = 20480000
milter_connect_macros = j {daemon_name} v {if_name} _
milter_default_action = accept
mydestination = mail.example.com, localhost.example.com, localhost
myhostname = mail.example.com
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128 my.ip.add.ress/26
myorigin = /etc/mailname
non_smtpd_milters = unix:/opendkim/opendkim.sock
queue_directory = /var/spool/postfix
readme_directory = no
recipient_delimiter = +
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
smtpd_banner = $myhostname ESMTP $mail_name (Debian/GNU)
smtpd_error_sleep_time = 5s
smtpd_hard_error_limit = 10
smtpd_helo_required = yes
smtpd_milters = unix:/opendkim/opendkim.sock
smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination, check_sender_access pcre:/etc/postfix/sender_access.pcre, check_recipient_access hash:/etc/postfix/recipient_access,
smtpd_sasl_auth_enable = yes
smtpd_sasl_path = private/auth
smtpd_sasl_type = dovecot
smtpd_tls_CAfile = /etc/ssl/MyCA.pem
smtpd_tls_cert_file = /etc/ssl/MyCert.pem
smtpd_tls_key_file = /etc/ssl/private/MyCert.key
smtpd_tls_mandatory_protocols = !SSLv2,!SSLv3
smtpd_tls_protocols = !SSLv2,!SSLv3
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtpd_use_tls = yes
virtual_alias_maps = regexp:/etc/postfix/virtual.regex

更新:

postmap -q调试测试会话显示,尽管没有这样做,但在实际查找之前地址已转换为小写。这也使得/ipcre: tables 中的标志在这种情况下无用。

... smtpd[28637]: >>> 开始发件人地址限制 <<<
... smtpd[28637]: generic_checks: name=check_sender_access
... smtpd[28637]: check_mail_access:[电子邮件保护] > ... smtpd[28637]: ctable_locate: 移动现有条目钥匙[电子邮件保护]
... smtpd[28637]:检查访问:[电子邮件保护]
... smtpd[28637]: dict_pcre_lookup: /etc/postfix/sender_access.pcre:[电子邮件保护]

相关内容