阻止不存在的用户从 Postfix 发送邮件

阻止不存在的用户从 Postfix 发送邮件

我的服务器不断发送垃圾邮件。发件人姓名始终是随机的,但格式始终为[email protected]

我尝试添加reject_unlisted_senders指令smtpd_sender_restrictions,但没有作用——电子邮件以某种方式排队而没有被 smtpd 捕获。

还有其他方法可以将这些消息从队列中过滤掉吗?有人建议使用 postqueue 来删除不需要的消息,但我可能必须每分钟运行一次,而且即使这样也可能无法捕获这些消息,除非我误解了它的工作原理?

或者,是否有一些常见的方式使电子邮件不经过 smtpd 而进入队列,我可以尝试阻止这些方式,或者是否有任何方法可以跟踪这些消息如何在不经过 smtpd 发件人检查的情况下进入队列?

电子邮件示例:

Return-Path: <[email protected]>
Received: from myotherdomain.co.nz (www.mydomain.co.nz [49.50.242.200])
    (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))
    (No client certificate requested)
    by mtaig-aaf04.mx.aol.com (Internet Inbound) with ESMTPS id 81DBE7000008D;
    Thu, 13 Aug 2015 07:51:31 -0400 (EDT)
X-No-Relay: not in my network
X-No-Relay: not in my network
X-No-Relay: not in my network
X-No-Relay: not in my network
X-No-Relay: not in my network
X-No-Relay: not in my network
X-No-Relay: not in my network
X-No-Relay: not in my network
X-No-Relay: not in my network
X-No-Relay: not in my network
X-No-Relay: not in my network
X-No-Relay: not in my network
X-No-Relay: not in my network
X-No-Relay: not in my network
X-No-Relay: not in my network
X-No-Relay: not in my network
X-No-Relay: not in my network
X-No-Relay: not in my network
X-No-Relay: not in my network
X-No-Relay: not in my network
Received: from mydomain.co.nz (unknown [180.251.148.71])
    by myotherdomain.co.nz (Postfix) with ESMTPA id 6BCD5277BF;
    Thu, 13 Aug 2015 23:51:07 +1200 (NZST)
Subject: From:  Adwoa Danso
From: adwoa danso <[email protected]>
Content-Type: multipart/alternative;
    boundary=Apple-Mail-A9BD329F-7B73-20AE-D05D-EE4BF9644759
X-Mailer: iPhone Mail (12D508)
Message-Id: <[email protected]>
Date: Wed, 13 Aug 2015 12:51:07 +0000
To: [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected]
Content-Transfer-Encoding: 7bit
Mime-Version: 1.0 (1.0)
x-aol-global-disposition: G
Authentication-Results: mx.aol.com;
    spf=pass (aol.com: the domain mydomain.co.nz reports 49.50.242.200 as a permitted sender.) smtp.mailfrom=mydomain.co.nz;
x-aol-sid: 3039ac1a7f5a55cc84c22b21
X-AOL-IP: 49.50.242.200
X-AOL-SPF: domain : mydomain.co.nz SPF : pass

postconf-n:

alias_database = hash:/etc/aliases
alias_maps = hash:/etc/aliases, hash:/var/spool/postfix/plesk/aliases
broken_sasl_auth_clients = yes
command_directory = /usr/sbin
config_directory = /etc/postfix
daemon_directory = /usr/libexec/postfix
data_directory = /var/lib/postfix
debug_peer_level = 2
disable_vrfy_command = yes
html_directory = no
inet_interfaces = all
inet_protocols = all
mail_owner = postfix
mailbox_size_limit = 0
mailq_path = /usr/bin/mailq.postfix
manpage_directory = /usr/share/man
message_size_limit = 20480000
mydestination = localhost.$mydomain, localhost, localhost.localdomain
myhostname = mydomain.co.nz
mynetworks = 127.0.0.0/8 [::1]/128 49.50.242.200/32 49.50.242.201/32 49.50.242.202/32
mynetworks_style = host
newaliases_path = /usr/bin/newaliases.postfix
non_smtpd_milters = , inet:127.0.0.1:12768
queue_directory = /var/spool/postfix
readme_directory = /usr/share/doc/postfix-2.8.14/README_FILES
sample_directory = /usr/share/doc/postfix-2.8.14/samples
sender_dependent_default_transport_maps = hash:/var/spool/postfix/plesk/sdd_transport_maps
sendmail_path = /usr/sbin/sendmail.postfix
setgid_group = postdrop
smtp_send_xforward_command = yes
smtp_tls_security_level = may
smtp_use_tls = no
smtpd_authorized_xforward_hosts = 127.0.0.0/8 [::1]/128
smtpd_client_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_rbl_client zen.spamhaus.org, reject_rbl_client bl.spamcop.net
smtpd_milters = , inet:127.0.0.1:12768
smtpd_proxy_timeout = 3600s
smtpd_recipient_restrictions = permit_mynetworks, check_client_access pcre:/var/spool/postfix/plesk/no_relay.re, permit_sasl_authenticated, reject_unauth_destination
smtpd_sasl_auth_enable = yes
smtpd_sender_restrictions = reject_unlisted_sender, check_sender_access hash:/var/spool/postfix/plesk/blacklists, permit_sasl_authenticated, check_client_access pcre:/var/spool/postfix/plesk/non_auth.re
smtpd_timeout = 3600s
smtpd_tls_cert_file = /etc/postfix/postfix_default.pem
smtpd_tls_key_file = $smtpd_tls_cert_file
smtpd_tls_security_level = may
smtpd_use_tls = yes
transport_maps = , hash:/var/spool/postfix/plesk/transport
unknown_local_recipient_reject_code = 550
virtual_alias_maps = $virtual_maps, hash:/var/spool/postfix/plesk/virtual
virtual_gid_maps = static:31
virtual_mailbox_base = /var/qmail/mailnames
virtual_mailbox_domains = $virtual_mailbox_maps, hash:/var/spool/postfix/plesk/virtual_domains
virtual_mailbox_limit = 0
virtual_mailbox_maps = , hash:/var/spool/postfix/plesk/vmailbox
virtual_transport = plesk_virtual
virtual_uid_maps = static:30

来自不存在用户的电子邮件示例:

Aug 20 04:03:23 myuser postfix/qmgr[6151]: 955692790A: from=<[email protected]>, size=2571, nrcpt=20 (queue active)
Aug 20 04:04:24 myuser postfix/smtp[5810]: 955692790A: to=<>, relay=none, delay=267202, delays=267141/0.01/61/0, dsn=4.4.1, status=deferred (connect to alpha17.com[54.174.31.254]:25: Connection timed out)
Aug 20 05:13:23 myuser postfix/qmgr[6151]: 955692790A: from=<[email protected]>, size=2571, nrcpt=20 (queue active)
Aug 20 05:14:25 myuser postfix/smtp[7148]: 955692790A: to=<[[email protected]]>, relay=none, delay=271402, delays=271341/0.01/61/0, dsn=4.4.1, status=deferred (connect to alpha17.com[54.174.31.254]:25: Connection timed out)
Aug 20 06:23:23 myuser postfix/qmgr[6151]: 955692790A: from=<[email protected]>, size=2571, nrcpt=20 (queue active)
Aug 20 06:24:23 myuser postfix/smtp[9472]: 955692790A: to=<[[email protected]]>, relay=none, delay=275600, delays=275540/0.01/60/0, dsn=4.4.1, status=deferred (connect to alpha17.com[54.174.31.254]:25: Connection timed out)
Aug 20 07:33:23 myuser postfix/qmgr[6151]: 955692790A: from=<[email protected]>, size=2571, nrcpt=20 (queue active)
Aug 20 07:34:24 myuser postfix/smtp[11376]: 955692790A: to=<[[email protected]]>, relay=none, delay=279802, delays=279741/0.01/61/0, dsn=4.4.1, status=deferred (connect to alpha17.com[54.174.31.254]:25: Connection timed out)
Aug 20 08:43:23 myuser postfix/qmgr[6151]: 955692790A: from=<[email protected]>, size=2571, nrcpt=20 (queue active)
Aug 20 08:44:24 myuser postfix/smtp[13132]: 955692790A: to=<[[email protected]]>, relay=none, delay=284002, delays=283941/0.01/61/0, dsn=4.4.1, status=deferred (connect to alpha17.com[54.208.74.215]:25: Connection timed out)

答案1

这里是正常邮件流在后缀内部,当你中继电子邮件。

Client --- smtpd (receive) --- Queue Manager --- smtp (delivery)

参数reject_unlisted_sender仅帮助您在smtpdPostfix 收到来自客户端垃圾邮件发送者的电子邮件时阻止消息。从您上面附加的日志来看,该消息已经在队列中,因此不会发生拒绝。当客户端垃圾邮件发送者使用虚假电子邮件地址转发电子邮件时,此参数将生效。

解决方案是从 Postfix 队列中删除电子邮件. 例如,参见此主题:如何从邮件队列中删除来自某个地址的所有消息?。 也可以看看man 1 帖子超级man 1 后队列

相关内容