这两天安装测试了一下dspam-3.8.0版本,安装在emos1.3虚拟机上,通过webmail方式登陆发送给自己一封邮件,结果无法正常投递,查看邮件队列提示我没有找到/tmp/dspam.sock文件,我不知道这个文件是怎生成的,望高手解答。经过对比这台服务器的配置与下面的完全一致。
[root@localhost ~]# mailq
-Queue ID- --Size-- ----Arrival Time---- -Sender/Recipient-------
156AF2FBF4 732 Mon Sep 22 14:09:11
user01@fanzhengyuan.18corp.cn
(connect to mail.fanzhengyuan.18corp.cn[/tmp/dspam.sock]: No such file or directory)
user01@fanzhengyuan.18corp.cn
-- 1 Kbytes in 1 Request.
[root@localhost ~]#
---------------------------------------------
在另外一台备份虚拟机上再次安装测试结果是正常的,邮件头可以正常看到。
Return-Path: <
user01@fanzhengyuan.18corp.cn>
Delivered-To:
user01@fanzhengyuan.18corp.cn
Received: from localhost (mail.fanzhengyuan.18corp.cn [127.0.0.1])
by mail.fanzhengyuan.18corp.cn (Postfix - by extmail.org) with ESMTP id BB93F6C52A
for <
user01@fanzhengyuan.18corp.cn>; Sun, 21 Sep 2008 10:12:25 +0800 (CST)
X-Virus-Scanned: amavisd-new at fanzhengyuan.18corp.cn
X-Spam-Score: 2.47
X-Spam-Level: **
X-Spam-Status: No, score=2.47 tagged_above=2 required=5
tests=[FROM_EXCESS_BASE64=1.052, HTML_MESSAGE=0.001,
HTML_MIME_NO_HTML_TAG=0.512, HTML_SHORT_LENGTH=0.629,
MAILTO_TO_SPAM_ADDR=0.276, MIME_HTML_ONLY=0.001, NO_RELAYS=-0.001,
SUBJECT_EXCESS_BASE64=0]
Received: from mail.fanzhengyuan.18corp.cn ([127.0.0.1])
by localhost (mail.fanzhengyuan.18corp.cn [127.0.0.1]) (amavisd-new, port 10024)
with ESMTP id QKGzN765sGw6 for <
user01@fanzhengyuan.18corp.cn>;
Sun, 21 Sep 2008 10:12:24 +0800 (CST)
Received: by mail.fanzhengyuan.18corp.cn (Postfix - by extmail.org, from userid 1000)
id C50AC6C536; Sun, 21 Sep 2008 10:12:24 +0800 (CST)
From: "=?ISO-8859-1?B?dXNlcjAx?=" <
user01@fanzhengyuan.18corp.cn>
To:
user01@fanzhengyuan.18corp.cn
Subject: =?ISO-8859-1?B?MTA6MzMgd2l0aCBkc3BhbQ==?=
Date: Sun, 21 Sep 2008 10:12:24 +0800
Mime-version: 1.0
X-Originating-Ip: [192.168.0.123]
X-Mailer: ExtMail 1.0.3
Content-Type: text/html; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
Message-Id: <
20080921021224.C50AC6C536@mail.fanzhengyuan.18corp.cn>
<A href="mailto:user01@fanzhengyuan.18corp.cn>user01@fanzhengyuan.18corp.cn">user01@fanzhengyuan.18corp.cn>
user01@fanzhengyuan.18corp.cn</A>
---------------------
按照说明文档doc/postfix.txt
使用同样方法安装:
./configure
make
make install
配置/usr/local/etc/dspam.conf
[Postfix] (LMTP) -> [DSPAM] [Postfix] -> { Delivery }
|___ (SMTP Reinjection) ____|
Step 1: Configure DSPAM as a server daemon
The first step is to configure DSPAM to listen as an LMTP server on a local
UNIX socket. This is what Postfix will connect to when it sends messages to
DSPAM. Be sure you have configured DSPAM with the --enable-daemon option.
You will need to use an MT-safe storage driver, such as MySQL or PostgreSQL.
Once you have DSPAM installed, make the following changes in dspam.conf:
ServerMode auto
ServerParameters "--deliver=innocent"
ServerIdent "localhost.localdomain"
ServerPID /var/run/dspam.pid
ServerDomainSocketPath "/tmp/dspam.sock"
This will tell DSPAM to listen on /tmp/dspam.sock using the options above.
You'll also need to configure DSPAM to pass the good mail back into Postfix.
Comment out any "TrustedDeliveryAgent" option in dspam.conf and replace it
with the options below. We'll use local TCP port 10026 in our example.
DeliveryHost 127.0.0.1
DeliveryPort 10026
DeliveryIdent localhost
DeliveryProto SMTP
This tells DSPAM to deliver using SMTP to port 10026 on the local machine.
We'll configure Postfix to listen on this port for reinjection.
Finally, you'll want to use DSPAM's ParseToHeader option. This option tells
DSPAM to automatically train when it sees a spam- or notspam- address in
the To: header. Depending on how you have configured DSPAM to manage users,
your settings may be slightly different. On a typical setup, where the
entire email address is the user's DSPAM username, you would use something
like this:
ParseToHeaders on
ChangeModeOnParse on
ChangeUserOnParse full
This means if a user forwards their spam to
spam-bob@domain.com, the
username will be set to
bob@domain.com and the training mode will be set to
"learn spam".
You can then start DSPAM: dspam --daemon &
配置/etc/postfix/master.cf
Step 2: Configure Postfix to use a content filter
The next step is to configure Postfix to use DSPAM as a content filter.
This is relatively simple and requires only a minor change to your
master.cf file:
Change:
smtp inet n - n - - smtpd
To:
smtp inet n - n - - smtpd
-o content_filter=lmtp:unix:/tmp/dspam.sock
This tells Postfix to send all mail to DSPAM for content filtering.
Step 3: Configure a Reinjection Port
You'll also need to configure Postfix to listen on a local port for
reinjection. This is where DSPAM sends back the "good" mail (or alternatively,
tagged mail also). Add this to your master.cf:
localhost:10026 inet n - n - - smtpd
-o content_filter=
-o receive_override_options=no_unknown_recipient_checks,no_header_body_checks
-o smtpd_helo_restrictions=
-o smtpd_client_restrictions=
-o smtpd_sender_restrictions=
-o smtpd_recipient_restrictions=permit_mynetworks,reject
-o mynetworks=127.0.0.0/8
-o smtpd_authorized_xforward_hosts=127.0.0.0/8