我的 Postfix 安装正在发送垃圾邮件;如何阻止它?

Bor*_*iet 7 configuration filter postfix

几天以来,我的网络/邮件服务器(centos 6.4)正在大量发送垃圾邮件,只有停止 postfix 服务才能结束它。

SMPT 设置为仅接受通过 ssl 和使用用户名/密码的连接。而且我已经更改了(疑似)受感染电子邮件帐户的密码。

电子邮件是通过 iRedMail 设置的。

任何有关识别和阻止这种情况的帮助都是受欢迎的!

添加:一些日志摘录:

Mar 23 05:01:52 MyServer postfix/smtp[9494]: 4E81026038: to=<bet@magiccablepc.com>, relay=mail.suddenlinkmail.com[208.180.40.132]:25, delay=3, delays=0.07/0/2.4/0.5, dsn=2.0.0, status=sent (250 Message received: 20140323040153.YPML21660.txedge-vm03.suddenlink.net@MyServer.org)
Mar 23 05:02:01 MyServer postfix/smtp[9577]: 209BA26067: to=<gino.c@bigpond.com>, relay=127.0.0.1[127.0.0.1]:10024, delay=14, delays=12/0/0/2, dsn=2.0.0, status=sent (250 2.0.0 from MTA(smtp:[127.0.0.1]:10025): 250 2.0.0 Ok: queued as B654226078)
Mar 23 05:02:01 MyServer postfix/smtp[9495]: 8278726077: to=<harry@gunship.org>, relay=mx-biz.mail.am0.yahoodns.net[98.139.171.245]:25, delay=0.88, delays=0.25/0/0.47/0.14, dsn=4.7.1, status=deferred (host mx-biz.mail.am0.yahoodns.net[98.139.171.245] said: 421 4.7.1 [TS03] All messages from [IPADDRESS] will be permanently deferred; Retrying will NOT succeed. See http://postmaster.yahoo.com/421-ts03.html (in reply to MAIL FROM command))
Run Code Online (Sandbox Code Playgroud)

无法投递报告的邮件头:

Return-Path: <MAILER-DAEMON>
Delivered-To: info@fotografieluna.be
Received: from localhost (icantinternet.org [127.0.0.1]) 
        by icantinternet.org (Postfix) with ESMTP id 4669E25D9D 
        for <info@fotografieluna.be>; Mon, 24 Mar 2014 14:20:15 +0100 (CET)
X-Virus-Scanned: amavisd-new at icantinternet.org
X-Spam-Flag: YES
X-Spam-Score: 9.501
X-Spam-Level: *********
X-Spam-Status: Yes, score=9.501 tagged_above=2 required=6.2 
        tests=[BAYES_99=3.5, BAYES_999=0.2, RAZOR2_CF_RANGE_51_100=0.5, 
        RAZOR2_CF_RANGE_E8_51_100=1.886, RAZOR2_CHECK=0.922, RDNS_NONE=0.793,  
        URIBL_BLACK=1.7] autolearn=no
Received: from icantinternet.org ([127.0.0.1]) 
        by localhost (icantinternet.org [127.0.0.1]) (amavisd-new, port 10024) 
        with ESMTP id FOrkYnmugXGk for <info@fotografieluna.be>; 
        Mon, 24 Mar 2014 14:20:13 +0100 (CET)
Received: from spamfilter2.webreus.nl (unknown [46.235.46.231]) 
        by icantinternet.org (Postfix) with ESMTP id D15BA25D14 
        for <info@fotografieluna.be>; Mon, 24 Mar 2014 14:20:12 +0100 (CET)
Received: from spamfilter2.webreus.nl (localhost [127.0.0.1])  
        by spamfilter2.webreus.nl (Postfix) with ESMTP id 7FB2EE78EFF 
        for <info@fotografieluna.be>; Mon, 24 Mar 2014 14:20:13 +0100 (CET)
X-Virus-Scanned: by SpamTitan at webreus.nl
Received: from mx-in-2.webreus.nl (mx-in-2.webreus.nl [46.235.44.240]) 
        by spamfilter2.webreus.nl (Postfix) with ESMTP id 3D793E78E5A 
        for <info@fotografieluna.be>; Mon, 24 Mar 2014 14:20:09 +0100 (CET)
Received-SPF: None (mx-in-2.webreus.nl: no sender authenticity 
  information available from domain of 
  MAILER-DAEMON@athosian.udag.de) identity=pra; 
  client-ip=62.146.106.25; receiver=mx-in-2.webreus.nl; 
  envelope-from=""; x-sender="MAILER-DAEMON@athosian.udag.de"; 
  x-conformance=sidf_compatible
Received-SPF: None (mx-in-2.webreus.nl: no sender authenticity 
  information available from domain of 
  postmaster@athosian.udag.de) identity=mailfrom; 
  client-ip=62.146.106.25; receiver=mx-in-2.webreus.nl; 
  envelope-from=""; x-sender="postmaster@athosian.udag.de"; 
  x-conformance=sidf_compatible
Received-SPF: None (mx-in-2.webreus.nl: no sender authenticity 
  information available from domain of 
  postmaster@athosian.udag.de) identity=helo; 
  client-ip=62.146.106.25; receiver=mx-in-2.webreus.nl; 
  envelope-from=""; x-sender="postmaster@athosian.udag.de"; 
  x-conformance=sidf_compatible
Received: from athosian.udag.de ([62.146.106.25]) 
  by mx-in-2.webreus.nl with ESMTP; 24 Mar 2014 14:20:03 +0100
Received: by athosian.udag.de (Postfix) 
        id 3B16E54807C; Mon, 24 Mar 2014 14:19:59 +0100 (CET)
Date: Mon, 24 Mar 2014 14:19:59 +0100 (CET)
From: MAILER-DAEMON@athosian.udag.de (Mail Delivery System)
Subject: ***Spam*** Undelivered Mail Returned to Sender
To: info@fotografieluna.be
Auto-Submitted: auto-replied
MIME-Version: 1.0
Content-Type: multipart/report; report-type=delivery-status;  
        boundary="36D9C5488E5.1395667199/athosian.udag.de"
Content-Transfer-Encoding: 7bit
Message-Id: <20140324131959.3B16E54807C@athosian.udag.de>
Run Code Online (Sandbox Code Playgroud)

Sha*_*dur 12

Pravin 提供了一些很好的一般观点,但没有真正详细说明其中任何一个,也没有解决您可能存在的实际问题。

首先,您需要了解 postfix 是如何接收这些消息的,以及为什么选择转发这些消息(这两个问题很可能是相关的)。

最好的方法是查看任何一条消息的消息 ID,然后在mail.log文件中查找与它相关的所有日志条目。这至少会告诉你消息来自哪里,以及 postfix 对它做了什么,直到它离开它的关注并进入世界。这是(已编辑的)示例摘录:

Mar 26 00:51:13 vigil postfix/smtpd[9120]: 3B7085E038D: client=foo.bar.com[1.2.3.4]
Mar 26 00:51:13 vigil postfix/cleanup[9159]: 3B7085E038D: message-id=<------------@someserver>
Mar 26 00:51:13 vigil postfix/qmgr[5366]: 3B7085E038D: from=<foo@bar.com>, size=456346, nrcpt=2 (queue active)
Mar 26 00:51:13 vigil postfix/lmtp[9160]: 3B7085E038D: to=<fred@someplace.else>, relay=127.0.0.1[127.0.0.1]:10024, delay=0.3, delays=0.11/0/0/0.19, dsn=2.0.0, status=sent (250 2.0.0 Ok, id=04611-19, from MTA([127.0.0.1]:10025): 250 2.0.0 Ok: queued as 6EA115E038F)
Mar 26 00:51:13 vigil postfix/qmgr[5366]: 3B7085E038D: removed
Run Code Online (Sandbox Code Playgroud)

这告诉我以下几点:

  1. 该消息来自 foo.bar.com,一个 IP 地址为 1.2.3.4 的服务器自称为 foo.bar.com
  2. (暗示没有警告)根据正向和反向 DNS,该地址确实与该名称匹配。
  3. 该消息是给名为的用户 fred@someplace.else,服务器认为是可接受的目标地址。
  4. 根据其配置,邮件服务器通过127.0.0.1:10024(我们的垃圾邮件/病毒过滤器)中继邮件以进行进一步处理。
  5. 过滤器说“好的,我将把它作为 ID 为 6EA115E038F 的消息进行排队,并从这里处理它。”
  6. 收到此确认后,主服务器宣布它已完成并从队列中删除原始消息。

现在,一旦您知道消息是如何进入系统的,您就可以开始找出问题所在。

  • 如果它来自其他地方并被完全转发到其他地方,则 postfix 目前正在充当开放中继。这是非常,非常糟糕的,你应该收紧你的smtpd_recipient_restrictions,并 smtpd_client_restrictions在设置/etc/postfix/main.cf

  • 如果它来自localhost,很可能是某个虚拟主机用户或其他用户受到了根据需要发送垃圾邮件的 php 脚本的危害。使用该find命令查找最近添加或更改的 .php 文件,然后仔细查看任何可疑名称。

任何更具体的事情都将在很大程度上取决于上述调查的结果,因此尝试详细说明毫无意义。我会给你一个更一般的警告,至少要尽早安装和配置postgrey