继续摘抄:postfix最新源码病毒过滤和反垃圾实战篇

四. 整体调试

0. 开启dns服务:service named start
   开启apache:/etc/init.d/apachectl start
   开启mysql:/etc/init.d/mysql start

1. 开启dovecot
# dovecot -c /etc/dovecot.conf
查看是否启动成功
# netstat -tl
tcp 0 0 *:pop3   *:*   LISTEN

或者
# ps -ef | grep dov
root      4280     1 0 11:20 00:00:00 dovecot -c /etc/dovecot.conf
root      4281 4280 0 11:20 00:00:00 dovecot-auth
dovecot   4284 4280 0 11:20 00:00:00 pop3-login
dovecot   4285 4280 0 11:20 00:00:00 pop3-login
dovecot   4298 4280 0 11:41 00:00:00 pop3-login

有pop3代表成功

查看etc/dovecot.conf,可以通过命令
# dovecot -n

2. clamv
a.启动clamav,开启clamd之前务必先配置clamd.conf文件。否则报错。
# clamd
查看是否启动成功
# ps -e | grep clamd
有clamd进程说明启动成功

b.更新clamav病毒库(--quiet参数:不输入更新日志)
以root身份使用计划任务让clamav病毒库自动更新
# crontab -e
N * * * * /usr/local/bin/freshclam --quiet
其中N是你要输入的数字!或者手动输入命令来更新:
# freshclam

c. 测试病毒扫描,进入clamav源码文件夹所在的test目录,其中scan.txt记录扫描结果
# clamscan -r -l scan.txt clamav-x.yz

d. 测试邮件病毒扫描是否启用请看amavis-new测试部分

e.查看日志
# cat /var/log/clamav/clamd.log
# cat /var/log/clamav/freshclam.log
# cat /var/log/maillog

3.postfix
a. 开启
# postfix start
查看是否启动
# ps aux | grep postfix
root     26976 1.0 0.4 5504 1260 ?        Ss   23:20   0:00 /usr/libexec/postfix/master
postfix 26977 0.5 0.5 5476 1284 ?        S    23:20   0:00 qmgr -l -t fifo -u
postfix 26978 0.5 0.4 4644 1236 ?        S    23:20   0:00 pickup -l -t fifo -u
或者
# netstat -tl
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address               Foreign Address             Stat
tcp        0      0 localhost.localdomain:smtp *:*                         LIST
这是没有启动amasiv时的情况如果启动了amasiv时:
# netstat -tl
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address               Foreign Address             Stat
tcp        0      0 localhost.localdomain:10024 *:*                         LIST
tcp        0      0 localhost.localdomain:10025 *:*                         LIST

b. 停止
# postfix stop

修改配置后,重新加载
# postfix reload

查看配置
# postconf -d

查看邮件队列:其中的任何一个命令
# mailq
# sendmail -bp
# postqueue -p

c.测试25,分别用localhost和域名(全域名称)去测试,
只要其中一个telnet不上就可以说明postfix不正常工作

# telnet localhost 25
Trying 127.0.0.1...
Connected to localhost.localdomain (127.0.0.1).
Escape character is '^]'.
220 xt.xiutuo.com ESMTP Postfix
ehlo localhost
250-xt.xiutuo.com
250-PIPELINING
250-SIZE 10240000
250-ETRN
250-AUTH DIGEST-MD5 CRAM-MD5 LOGIN PLAIN //说明已经加载了cyrus-sasl
250-ENHANCEDSTATUSCODES
250-8BITMIME
250 DSN
quit
221 2.0.0 Bye
Connection closed by foreign host.

说明没有问题

# telnet xiutuo.com 25
Trying 192.168.1.230...
Connected to xiutuo.com (192.168.1.230).
Escape character is '^]'.
220 xt.xiutuo.com ESMTP Postfix
ehlo localhost
250-xt.xiutuo.com
250-PIPELINING
250-SIZE 10240000
250-ETRN
250-AUTH DIGEST-MD5 CRAM-MD5 LOGIN PLAIN
250-ENHANCEDSTATUSCODES
250-8BITMIME
250 DSN
quit
221 2.0.0 Bye
Connection closed by foreign host.

说明没有问题

# telnet xt.xiutuo.com 25
Trying 192.168.1.230...
Connected to xt.xiutuo.com (192.168.1.230).
Escape character is '^]'.
220 xt.xiutuo.com ESMTP Postfix
ehlo localhost
250-xt.xiutuo.com
250-PIPELINING
250-SIZE 10240000
250-ETRN
250-AUTH DIGEST-MD5 CRAM-MD5 LOGIN PLAIN
250-ENHANCEDSTATUSCODES
250-8BITMIME
250 DSN
quit
221 2.0.0 Bye
Connection closed by foreign host.

说明没有问题

d.日志查看
# cat /var/log/maillog

4. 开启amavis-new,此步骤同时开启了spamssassin(perl模块安装的)。
a.先以debug模式开启:
# amavisd -u clamav debug

b. debug 模式下,如果没有错误提示再正常启动:
# amavisd -u clamav start

c. 停止
# amavisd -u clamav stop

d.测试amavis端口和主机

# telnet localhost 10024
Trying 127.0.0.1...
Connected to localhost.localdomain (127.0.0.1).
Escape character is '^]'.
220 [127.0.0.1] ESMTP amavisd-new service ready
ehlo localhost //打招呼
250-[127.0.0.1]
250-VRFY
250-PIPELINING
250-SIZE
250-ENHANCEDSTATUSCODES
250-8BITMIME
250-DSN
250 XFORWARD NAME ADDR PROTO HELO
quit
221 2.0.0 [127.0.0.1] amavisd-new closing transmission channel
Connection closed by foreign host.

e.测试dedicated Postfix smtpd-daemon

# telnet localhost 10025
Trying 127.0.0.1...
Connected to localhost.localdomain (127.0.0.1).
Escape character is '^]'.
220 xt.xiutuo.com ESMTP Postfix
ehlo localhost //打招呼
250-xt.xiutuo.com
250-PIPELINING
250-SIZE 10240000
250-ETRN
250-AUTH PLAIN
250-ENHANCEDSTATUSCODES
250-8BITMIME
250 DSN
quit
221 2.0.0 Bye
Connection closed by foreign host.

f.测试new transport chain
# telnet localhost 10024
Trying 127.0.0.1...
Connected to localhost.localdomain (127.0.0.1).
Escape character is '^]'.
220 [127.0.0.1] ESMTP amavisd-new service ready
helo localhost //打招呼
250 [127.0.0.1]
mail from:<> //发件人:请一定要这样输入
250 2.1.0 Sender <> OK
rcpt to: //收件人 格式:<用户名>,该用户必须存在
250 2.1.5 Recipient OK
data //邮件内容
354 End data with . //以下几行是测试内容
From: virus-tester
To: undisclosed-recipients:;
Subject: amavisd test - simple - no spam test pattern

This is a simple test message from the amavisd-new test-messages.
.   //结束内容
250 2.0.0 Ok: queued as DF3466BBFF
quit
221 2.0.0 [127.0.0.1] amavisd-new closing transmission channel
Connection closed by foreign host.

成功时候结果显示类似:
Apr 3 15:25:54 xt postfix/smtpd[4361]:
connect from localhost.localdomain[127.0.0.1]
Apr 3 15:25:54 xt postfix/smtpd[4361]:
DF3466BBFF: client=localhost.localdomain[127.0.0.1]
Apr 3 15:25:54 xt postfix/cleanup[4368]:
DF3466BBFF: message-id=<[email protected] >
Apr 3 15:25:54 xt postfix/qmgr[4310]:
DF3466BBFF: from=<>, size=749, nrcpt=1 (queue active)
Apr 3 15:25:54 xt postfix/smtpd[4361]:
disconnect from localhost.localdomain[127.0.0.1]
Apr 3 15:25:55 xt amavis[4332]:
(04332-04) Passed BAD-HEADER, <> -> , mail_id: L-MJhtoG7s8J,
Hits: 2.196, size: 174, queued_as: DF3466BBFF, 20715 ms
Apr 3 15:25:55 xt postfix/pipe[4370]:
DF3466BBFF: to=, orig_to=, relay=dovecot, delay=0.36,
delays=0.14/0.04/0/0.19, dsn=2.0.0, status=sent(delivered via dovecot service)
Apr 3 15:25:55 xt postfix/qmgr[4310]: DF3466BBFF: removed

g. 测试跟postfix结合是否成功
# telnet localhost 25
Trying 127.0.0.1...
Connected to localhost.localdomain (127.0.0.1).
Escape character is '^]'.
220 xt.xiutuo.com ESMTP Postfix
ehlo localhost //打招呼
250-xt.xiutuo.com
250-PIPELINING
250-SIZE 10240000
250-ETRN
250-AUTH DIGEST-MD5 CRAM-MD5 LOGIN PLAIN
250-ENHANCEDSTATUSCODES
250-8BITMIME
250 DSN
mail from: // 发件人
250 2.1.0 Ok
rcpt to:   //收件人
250 2.1.5 Ok
data    //邮件内容
354 End data with . //下面那行为测试内容
X5O!P%@AP[4/PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H *
.    //以.结束邮件内容
250 2.0.0 Ok: queued as BC24E85260
quit //退出
221 2.0.0 Bye
Connection closed by foreign host.

查看日志# cat /var/log/maillog

amavis[4299]: (04299-02) Blocked INFECTED (Eicar-Test-Signature),
MYNETS LOCAL [127.0.0.1] [127.0.0.1] -> ,
quarantine: virus-YywJJlObpLBn, Message-ID: <[email protected] >,
mail_id: YywJJlObpLBn, Hits: -, size: 400, 926 ms

看到blocked表示amavis-new已经工作


h.查看日志
# cat /var/log/maillog

5.测试spamassassin
# telnet localhost 25
Trying 127.0.0.1...
Connected to localhost.localdomain (127.0.0.1).
Escape character is '^]'.
220 xt.xiutuo.com ESMTP Postfix
ehlo localhost //打招呼
250-xt.xiutuo.com
250-PIPELINING
250-SIZE 10240000
250-ETRN
250-AUTH DIGEST-MD5 CRAM-MD5 LOGIN PLAIN
250-ENHANCEDSTATUSCODES
250-8BITMIME
250 DSN
mail from: // 发件人
250 2.1.0 Ok
rcpt to:   //收件人
250 2.1.5 Ok
data    //邮件内容
354 End data with .   //下面那行为测试内容
Subject: XJS*C4JDBQADN1.NSBN3*2IDNEN*GTUBE-STANDARD-ANTI-UBE-TEST-EMAIL*C.34X
.   //以.结束邮件内容
250 2.0.0 Ok: queued as BC24E85260
quit //退出
221 2.0.0 Bye
Connection closed by foreign host.

查看日志 # cat /var/log/maillog
amavis[4300]: (04300-02) Blocked SPAM, MYNETS LOCAL [127.0.0.1] [127.0.0.1]
-> , quarantine: spam-YdwH0RxdXoSa.gz,
Message-ID: <[email protected] >,
mail_id: YdwH0RxdXoSa, Hits: 1003.959, size: 407, 2955 ms
Apr 2 19:07:29 xt postfix/lmtp[4453]: 308E46BBA0: to=,
relay=127.0.0.1[127.0.0.1]:10024, delay=15, delays=12/0.03/0.05/2.9,
dsn=2.5.0, status=sent (250 2.5.0 Ok ,
DSN suppressed (554 5.7.0 Reject, id=04300-02- SPAM))

看到spam表明spamassassin已经工作

6.通过邮件客户端测试cyrus-sasl认证
本地测试:
vi /etc/postfix/mynetworks 内容如下
127.0.0.0/8
即去除192.168.1.0/24,切记。否则本地网络测试cyrus-sasl就无效

 

五:安装webmail:squirrelmail-1.4.13
# cd /home/xiutuo/software
# tar -zxvf squirrelmail-1.4.13.tar.gz
# mv squirrelmail-1.4.13 /usr/local/apache2/htdocs/webmail
# cd /usr/local/apache2/htdocs/webmail
# mkdir data attach
data目录已经有了就不用建了
# chown -R nobody:nobody data attach
# chmod 755 data attach
# cd config
# cp config_default.php config.php
# vi config.php 修改以下重要参数
$domain = 'example.com'; 改为 $domain = 'xiutuo.com';
$imapServerAddress = 'localhost';如果本机就是localhost,否则请填入imap服务器ip
$pop_before_smtp = false;改为true,使用pop3 before SMTP
********************************
也可以通过执行perl的配置文件来配置squirrelmail
# ./conf.pl 就出现了配置菜单,配置好后按s保存并退出。
********************************
修改默认语言:
$squirrelmail_default_language = 'zh_CN';
$default_charset = 'gb2312';
修改后,需要下载squirrelmail.mo文件放到locale/zh_CN/LC_MESSAGES/目录,以支持中文翻译
其他默认就ok,基本上就可以工作了
然后测试该配置文件
http://xiutuo.com/webmail/src/configtest.php 提示一些错误
请按照错误提示修改php.ini,记得修改后重启apache。
如:magic_quotes_gpc 错误,把magic_quotes_gpc = On改为magic_quotes_gpc = off就ok
webmail附件最大上传问题,
修改php.ini中upload_max_filesize = 10M
post_max_size = 10M 默认2m 这俩个参数值记得一定要远远小于postfix定义的最大邮件存储容量。
(注意squirrelmail对超过附件最大值的邮件无超过最大值提示,不足的地方)

squirrelmail要求使用imap服务,这里需要配置dovecot为pop3和imap服务
# vi /etc/dove.conf
修改 protocols = pop3 为 protocols = pop3 imap 即可,然后重启dovecot

打开webmail:
http://xiutuo.com/webmail/
输入postfix的虚拟用户帐号和密码,ok!

六:用户邮件容量和web附件大小限制

1.用户邮件容量限制主要在:
a. 修改/etc/dovecot.conf中的
----------------------
增加或者修改以下参数
由于本人使用的是dovecot做为lda,所以:
# In case you're using deliver:
protocol lda {
mail_plugins = quota
}
plugin {
# 100MB and 10000 messages quota limit
# 其中storage单位为m,这里就是100m,最大邮件数1万
quota = dict:storage=102400:messages=1000
b.修改/etc/dovecot-sql.conf 内容如下

#*********************************************************
driver = mysql
connect = host=localhost dbname=postfix user=postfix password=123456
# default_pass_scheme = PLAIN
user_query = SELECT maildir,12345 AS uid, 12345 AS gid,concat('maildir:storage=', quota) AS quota FROM mailbox WHERE username = '%u' AND active = '1'
password_query = SELECT password FROM mailbox WHERE username = '%u' AND active = '1'

#*********************************************************
切记quota格式一定要跟quota = maildir:storage=10240对应,
所以这里才需要用到concat连接函数
concat('maildir:storage=', quota) AS quota意思就是将
maildir:storage=这个字符串连接mailbox表字段quota的值作为quota字段
记得插入用户数据时(通过postfixadmin管理时)记得填写quota字段值。
********************

2.修改postfxiadmin配置文件
# vi config.inc.php
$CONF['quota'] = 'YES'; //如果需要对用户邮箱进行限制,请用yes,这样增加用户邮箱时才有quota字段哦
$CONF['aliases'] = '10'; //根据需要修改单位M
$CONF['mailboxes'] = '10';//根据需要修改单位M
$CONF['maxquota'] = '10';//根据需要修改单位M

3.webmail附件最大上传问题:
修改php.ini中upload_max_filesize = 10M
post_max_size = 10M 默认2m 这俩个参数值记得一定要远远小于postfix定义的最大邮件存储容量。

 

————————————————————————————————

七. 安装调试中错误和解决方法

1.dns和lamp错误见blog相关文章
特别提醒:
编译php的时候记得加上--enable-mbstring,
否则使用setup.php安装postadmin的时候,(当然可以忽略这个错误)
提示错误如下:Error: Depends on: multibyte string - NOT FOUND

2.dovecot相关错误

a.需要增加dovecot用户,否则启动dovecot提示无dovecot用户
   增加用户:useradd dovecot -d /dev/null -s /sbin/nologin

b. mkdir格式需要指定,否则出错
   修改:default_mail_env = mbox:~/mail/:INBOX=/var/mail/%u
c. 默认编译采用并使用加密认证,这里我使用的明文认证,
   所以这里参数值为yes,否则启动dovecot时报错
   修改:ssl_disable = yes

d. Error: Can't connect to auth server at
   /usr/local/var/run/dovecot/auth-master: No such file or directory
   解决:修改dovecot.conf中 protocal lda auth-master的路径为:
   /var/run/dovecot/auth-master  

---------------------------------

2.clamav和amasiv-new相关错误

a.注意安装clamav-0.92.1需要zlib-1.2.3,否则报zlib有bug错误,
可以通过--disable-zlib-vcheck 参数忽略zlib报错(不推荐)
# ./configure --prefix=/usr/local/clamav/ /
--with-zlib=/usr/local/zlib /
--with-user=clamav --with-group=clamav

b. DatabaseDirectory目录指定错误提示找不到daily.inc目录
修改/etc/clamd.conf中
DatabaseDirectory /usr/local/share/clamav/

c. amavis配置文件指定clamd.socket路径一定要和clamav配置文件中指定的一样
   /etc/clamd.conf中:LocalSocket /var/run/clamd.socket
   /etc/amavisd.conf中:
['ClamAV-clamd',
/&ask_daemon, ["CONTSCAN {}/n", "/var/run/clamd.socket"],
qr//bOK$/, qr//bFOUND$/,
qr/^.*?: (?!Infected Archive)(.*) FOUND$/ ],

---------------------------------

3.postfix错误

a. Mar 25 17:36:58 xt postfix/pipe[4433]: 831B26BB4E: to=,
relay=dovecot, delay=0.25, delays=0.1/0.1/0/0.06,dsn=4.3.0, status=deferred
(temporary failure. Command output: pipe: fatal: pipe_command:
execvp /usr/libexec/dovecot/deliver: No such file or directory)
修改/etc/postfix/master.cf 中的
dovecot   unix -       n       n       -       -       pipe
flags=DRhu user=vmail:mail argv=/usr/local/libexec/dovecot/deliver -d ${recipient}
的argv中dovecot的deliver路径为/usr/local/libexec/dovecot/deliver

b. deliver([email protected] ): Mar 25 17:48:22 Error:
Can't connect to auth server at /var/run/dovecot/auth-master: Permission denied
这个时候跟/var/spool/postfix/private/auth文件的权限问题一样,
我这里启动postfix服务是postfix用户和postfix组,而启动虚拟用户的是vmail和mail组
所以我们最好使用同一帐号启动postfix和做虚拟用户的真是用户的影射,
或者把这个这俩个帐号使用相同的用户组

c.错误:postfix NIS name do not set,warning: dict_nis_init: NIS domain name not set
       - NIS lookups disabled
解决:修改/etc/postfix/main.cf中:
        alias_maps = hash:/etc/postfix/aliases 就可以禁止掉默认的nis

         原因如下:postconf -d | grep nis
         默认是:alias_maps = hash:/etc/aliases, nis:mail.aliases

e.warning: do not list domain xiutuo.com in BOTH mydestination and virtual_mailbox_domains
解决:修改/etc/postfix/main.cf中,注释下面一行
#mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain

f.在本地服务当发往外网用户时:
Recipient address rejected: User unknown in virtual mailbox table
说明已经被列为黑名单了!!

g. RCPT from unknown{局域网内部ip}
   解决:请在/etc/postfix/mynetworks加上本地网络段 如192.168.1.0/24

h.如何把postfix安装在一个新的地方

make -f Makefile.init makefiles /
            AUXLIBS='-L/usr/lib/mysql -lmysqlclient -lz -lm -L/home/postfix/sasl
/lib -lsasl2' /
                CCARGS='-DRECEIVED_ENVELOPE_FROM -DUSE_SASL_AUTH -I/home/postfix
/sasl/include/sasl -DHAS_MYSQL -I/usr/include/mysql /
                        -DDEF_COMMAND_DIR=/"/home/postfix/sbin/" /
                        -DDEF_DAEMON_DIR=/"/home/postfix/libexec/" /
                        -DDEF_PROGRAM_DIR=/"/home/postfix/libexec/" /
                        -DDEF_QUEUE_DIR=/"/home/postfix/spool/" /
                        -DDEF_CONFIG_DIR=/"/home/postfix/etc/" /
                        -DDEF_SENDMAIL_PATH=/"/home/postfix/sbin/sendmail/" /
                        -DDEF_MAILQ_PATH=/"/home/postfix/bin/mailq/" /
                        -DDEF_NEWALIAS_PATH=/"/home/postfix/bin/newaliases/" /
                        -DDEF_SAMPLE_DIR=/"/home/postfix/doc/sample/" ' /
                OPT='-O2'
make || exit 2
sh postfix-install -non-interactive /
       install_root=/ /
       config_directory=/home/postfix/etc /
       daemon_directory=/home/postfix/libexec /
       command_directory=/home/postfix/sbin /
       queue_directory=/home/postfix/spool /
       sendmail_path=/home/postfix/sbin/sendmail /
       newaliases_path=/home/postfix/bin/newaliases /
       mailq_path=/usr/bin/mailq /
       mail_owner=${POSTFIX_USER}/
       setgid_group=${POSTFIX_GRP}/
       manpage_directory=/home/postfix/man /
       sample_directory=/home/postfix/doc/sample /
       readme_directory=/home/postfix/doc/README_FILES

postfix_setup安装包把postfix安装在/home/postfix目录下。


_____________________________________________________________


八.需要perl模块清单[除了一些可选perl模块外]:

Archive-Tar-1.38.tar.gz
Archive-Zip-1.23.tar.gz
BerkeleyDB-0.34.tar.gz
Compress-Raw-Zlib-2.008.tar.gz
Compress-Zlib-2.008.tar.gz
Convert-TNEF-0.17.tar.gz
Convert-UUlib-1.09.tar.gz
Crypt-OpenSSL-Random-0.04.tar.gz
Crypt-OpenSSL-RSA-0.25.tar.gz
dazuko-2.3.4.tar.gz
Digest-MD5-2.36.tar.gz
Digest-SHA-5.45.tar.gz
DocSet-0.19.tar.gz
Encode-Detect-1.00.tar.gz
ExtUtils-CBuilder-0.22.tar.gz
File-Temp-0.20.tar.gz
Handel-1.00010.tar.gz
HTML-Parser-3.56.tar.gz
IO-Compress-Base-2.008.tar.gz
IO-Compress-Zlib-2.008.tar.gz
IO-Socket-INET6-2.54.tar.gz
IO-Socket-SSL-1.13.tar.gz
IO-stringy-2.110.tar.gz
IO-Zlib-1.09.tar.gz
IP-Country-2.24.tar.gz
Mail-DKIM-0.30.1.tar.gz
Mail-DomainKeys-1.0.tar.gz
Mail-SpamAssassin-3.2.4.tar.gz
Mail-SPF-Query-1.999.1.tar.gz
Mail-SPF-v2.005.tar.gz
MailTools-2.02.tar.gz
MIME-tools-5.426.tar.gz
mod_perl-1.30.tar.gz
Net-CIDR-Lite-0.20.tar.gz
Net-DNS-0.63.tar.gz
Net-DNS-Resolver-Programmable-v0.003.tar.gz
Net-Ident-1.20.tar.gz
Net-IP-1.25.tar.gz
Net-Server-0.97.tar.gz
Net-SSLeay-1.32.tar.gz
NetAddr-IP-4.007.tar.gz
Pod-Escapes-1.04.tar.gz
Pod-POM-0.17.tar.gz
Pod-Simple-3.05.tar.gz
Socket6-0.20.tar.gz
Sys-Hostname-Long-1.4.tar.gz
Test-Pod-1.26.tar.gz
Test-Simple-0.78.tar.gz
Time-HiRes-1.9712.tar.gz
TimeDate-1.16.tar.gz
Unix-Syslog-1.0.tar.gz
IO-1.2301.tar.gz

 

九:附录

调试pam_mysql时候用到的logtable表结构
CREATE TABLE `logtable` (
`id` tinyint(3) unsigned NOT NULL auto_increment,
`logmsgcolumn` varchar(500) NOT NULL,
`logusercolumn` varchar(500) NOT NULL,
`logpidcolumn` varchar(500) NOT NULL,
`loghostcolumn` varchar(500) NOT NULL,
`logrhostcolumn` varchar(500) NOT NULL,
`logtimecolumn` varchar(500) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=gbk AUTO_INCREMENT=1 ;


如何让Postfix直接支持SpamAssassin
在/etc/postfix/master.cf中添加下面倒数3行
smtp      inet n       -       n       -       -       smtpd
-o content_filter=spamassassin
spamassassin unix -       n       n       -       -       pipe
user=nobody argv=/usr/bin/spamc -f -e /usr/sbin/sendmail -oi -f ${sender} ${recipient}

 

Cyrus SASL configuration for the Postfix SMTP server
You need to configure how the Cyrus SASL library should authenticate
a remote SMTP client's username and password.
These settings must be stored in a separate configuration file.

The name of the configuration file (default: smtpd.conf) will be
constructed from a value that the Postfix SMTP server sends to the Cyrus SASL library,
which adds the suffix .conf. The value is configured using one of the following variables:

/etc/postfix/main.cf:
    # Postfix 2.3 and later
    smtpd_sasl_path = smtpd
//默认sasl的smtp认证文件名是/usr/lib/sasl2/smtp.conf,/etc/pam.d/smtp
而不是smtpd.conf所以这里,修改为smtpd_sasl_path = smtp,
//当然你也可以制定成smtpd,对应就是/usr/lib/sasl2/smtpd.conf,/etc/pam.d/smtpd

    # Postfix < 2.3
    smtpd_sasl_application_name = smtpd
Cyrus SASL searches for the configuration file in /usr/local/lib/sasl/ (Cyrus SASL version 1.5.5)
or /usr/local/lib/sasl2/ (Cyrus SASL version 2.1.x).

Note: some Postfix distributions are modified and look for the smtpd.conf file in /etc/postfix/sasl.

Note: some Cyrus SASL distributions look for the smtpd.conf file in /etc/sasl2.

测试cyrus-sasl-auth

testsaslauthd -f /var/run/saslauthd -r -s smtp -u -p

 

 原文地址 http://hi.baidu.com/xiutuo/blog/item/7d5d945cc3a0ad47faf2c071.html

你可能感兴趣的:(摘抄)