七、安装和配置maildrop

(用于替代postfixMDA功能,邮件投递代理,将收到的邮件转发到用户的邮箱目录)<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

1、安装

(1)courier-authlib的头文件及库文件链接至/usr目录(编译maildrop时会到此目录下找此些相关的文件):

#ln -sv /usr/local/courier-authlib/bin/courierauthconfig  /usr/bin

#ln -sv /usr/local/courier-authlib/include/*  /usr/include

 

(2)maildrop需要pcre的支持,因此,接下来将首先安装pcre

   #tar jxvf pcre-7.3.tar.bz2

#cd pcre-7.3

#./configure

#make

   #make install

 

3)创建maildrop所需的用户和组

   #groupadd -g 1001 vmail

#useradd -g vmail -u 1001 -M -s /sbin/nologin vmail

 

(4)开始安装maildrop

   #tar jxvf maildrop-2.0.4.tar.bz2

#cd maildrop-2.0.4

# ./configure\

--enable-sendmail=/usr/sbin/sendmail\

--enable-trusted-users='root vmail'\

--enable-syslog=1 --enable-maildirquota\

--enable-maildrop-uid=1001\

--enable-maildrop-gid=1001\

--with-trashquota --with-dirsync

   #make

 #make install

 

(5)检查安装结果,请确保有"Courier Authentication Library extension enabled."一句出现:

  #maildrop -v

maildrop 2.0.4 Copyright 1998-2005 Double Precision, Inc.

GDBM extensions enabled.

Courier Authentication Library extension enabled.

Maildir quota extension enabled.

This program is distributed under the terms of the GNU General Public

License. See COPYING for additional information.

 

2、新建其配置文件/etc/maildroprc文件,首先指定maildrop的日志记录位置:

  #vi /etc/maildroprc

添加:

logfile "/var/log/maildrop.log"

 #touch /var/log/maildrop.log

  #chown vmail.vmail  /var/log/maildrop.log

 

3、配置Postfix

(1)编辑master.cf

# vi /etc/postfix/master.cf

启用如下两行

maildrop unix - n n - - pipe

flags=DRhu user=vmail argv=/usr/local/bin/maildrop -d ${recipient}

注意:定义transport的时候,即如上两行中的第二行,其参数行必须以空格开头,否则会出错.

 

(2)编辑main.cf

   #vi /etc/postfix/main.cf

virtual_transport = virtual

修改为:

virtual_transport = maildrop

将下面两项指定的UIDGID作相应的修改:

virtual_uid_maps = static:501

virtual_gid_maps = static:501

修改为:

virtual_uid_maps = static:1001

virtual_gid_maps = static:1001

4、编辑/usr/local/courier-authlib/etc/authlib/

authmysqlrc

    
     #vi /usr/local/courier-authlib/etc/authlib/authmysqlrc

MYSQL_UID_FIELD '501'

MYSQL_GID_FIELD '501'

更改为:

MYSQL_UID_FIELD '1001'

MYSQL_GID_FIELD '1001'

注意:没有此处的修改,maildrop可能会报告 “signal 0x06”的错误报告.

 

5、编辑/usr/local/apache/conf/httpd.conf,修改运行用户

如果启用了suexec的功能,则将虚拟主机中指定的

SuexecUserGroup postfix postfix

修改为:

SuexecUserGroup vmail vmail

如果没有使用上面的功能,则修改UserGroup指令后的用户为vmail

将前文中的如下项

User postfix

Group postfix

修改为:

User vmail

Group vmail

 

6、将用户邮件所在的目录/var/mailboxextman的临时目录/var/tmp/extman/的属主和属组指定为vmail

#chown -R vmail.vmail /var/mailbox

#chown -R vmail.vmail /var/tmp/extman/

7、重启postfixapacheauthlib

 #/etc/init.d/courier-authlib restart

#/etc/init.d/httpd restart

#/usr/local/postfix/sbin/postfix stop

#/usr/local/postfix/sbin/postfix start

8 进行发信测试后,如果日志中的记录类同以下项,则安装成功

Sep 16 12:04:43 Ixor postfix/pipe[14266]: 46B491A5CB: to=<marion@test.com>, relay=maildrop,

delay=2306, delays=2306/0.04/0/0.07, dsn=2.0.0, status=sent (delivered via maildrop service)

八、安装配置clamav-0.95.2.tar.gz(反病毒工具)

1、安装zlib-1.2.3

#tar zvxf zlib-1.2.3.tar.gz

#cd zlib-1.2.3

#./configure --prefix=/usr  --shared

#make

#make test

#make install

 

2、安装clamav-0.95.2.tar.gz

1)添加ClamAV运行所需的组和用户:

#groupadd clamav

#useradd -g clamav -s /sbin/nologin -M clamav

 

(2)添加配合amavisd-new使用的用户amavis

#groupadd amavis

#useradd -g amavis -s /sbin/nologin -M amavis

 

(3) 开始安装clamav

#tar zxvf clamav-0.95.2.tar.gz

#cd clamav-0.95.2

#./configure --prefix=/usr/local/clamav\

--with-dbdir=/usr/local/clamav/share  --sysconfdir=/etc/clamav

#make

#make install