免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 7835 | 回复: 6
打印 上一主题 下一主题

Solaris8安装配置Postfix+Mysql+SASL+IMAP+Extmail+防垃圾及邮件过滤 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2007-07-10 13:56 |只看该作者 |倒序浏览
本帖最后由 phpasp 于 2012-02-15 10:29 编辑

Postfix+Mysql+SASL+Courier-IMAP+Extmail安装配置(Solaris

作者:石头      http://phpasp.cublog.cn/ 转载请保留此行

一. Postfix 安装手册

什么是 Postfix

Postfix 是由 Wietse Venema's (http://www.porcupine.org/wietse/) 开发用来替代使用最广的 Sendmail 程序;此外,Postfix 试图在使用上更快速、简单管理及安全,同时与 sendmail 保持足够的兼容性而不打扰系统中已存在的使用者。尤其近来 Sendmail 经常被发现 local root 的攻击漏洞加上 Sendmail 发展已久,在安装及设定上并不是那么简单,所以有许多单位或网管人员逐渐改采 Postfix 来做为邮件转递的代理者(MTA,Mail Transfer Agent)。



二. 建置一个完善的邮件服务器

Postfix+Mysql+SASL+Courier-IMAP+Extmail

由于安装邮件服务器必须支持POP3+SMTP 这两个协议所以必须要安装Imap(POP3)。这里使用Courier-imap来启用POP3;SMTP认证采用SASL;内容过滤和反垃圾邮件及防病毒采用ClamAV、Amavisd-new、SpamAssassin。Webmail则采用ExtMail,有关ExtMail的详细文档资料,请参考www.extmail.org,本安装过程也是参考了http://www.extmail.org/docs/extmail_solution_linux/ ( ExtMail Solution HOWTO for Linux)这篇文档而成,在此对extmail团队及相关人员表示感谢,特别感谢hzqbbc老大!由于水平有限,错误或不妥之处难免,欢迎批评指正!

整个邮件解决方案由如下软件组成:


功能模块
       

内容
       

备注

操作系统(OS)
       

SunOS 5.8
       

Generic_117350-45 sun4u sparc SUNW,UltraAX-i2

邮件传输代理(MTA)
       

Postfix-2.4-20070215
       

使用当前最新版2.4

数据库/目录服务
       

MySQL 5.0.27
       



邮件投递代理(MDA)
       

maildrop 2.0.3
       

支持过滤和强大功能

Web帐户管理后台
       

ExtMan 0.2.0
       

支持无限域名、无限用户

POP3 服务器
       

Courier-IMAP
       

只使用pop3部分,对于大部分企业而言完全足够

WebMail 系统
       

ExtMail 1.0.1
       

支持多语言、全部模板化,功能基本齐全

防病毒软件(Anti-Virus)
       

ClamAV 0.90
       

最热门的开源杀毒软件

内容过滤器
       

Amavisd-new 2.4.5
       

Content-Filter软件,支持与clamav/sa的挂接

内容级别的反垃圾邮件工具
       

SpamAssassin
       

著名的SA,可以支持大量规则,但速度慢

SMTP认证库
       

Cyrus SASL 2.1.22
       

标准的SASL实现库,可以支持Courier authlib

其他数据认证库
       

Courier Authlib 0.59.1
       

authlib是maildrop, courier-imap等服务的关键部件

日志分析及显示
       


       



Web 服务器
       

Apache 2.0.59
       



三、安装操作系统Solaris 8

在本例中,采用机器为sun Netra T1,具体配置如下:

CPU:UltraSPARC-IIe 500MHz

内存:256M

硬盘:SCSI 18G

网卡:集成(eri0 eri1)

无驱:无

显卡和显示器:无

键盘鼠标:无

因本机无光驱设备,采用网络安装完成基本安装。(另外还可以采用光驱和控制台方式完成安装)具体安装文档,请参考www.sun.com网站文档。

1、             装基本Solaris 8系统(略)

将下载安装或源码文件放在/var/tmp下,在默认情况下,当前路径为/var/tmp

2、             安装补丁

PATH=/usr/local/sbin:/usr/local/bin:/usr/ccs/bin:/usr/bin:/usr/sbin:/sbinPATHHOMEbin:/usr/local/mysql/bin:/usr/local/courier/bin: /usr/local/maildrop/bin

3、安装SSH及相关编译工具

ncurses-5.6-sol8-sparc-local.gz

#pkgadd -d ncurses-5.6-sol8-sparc-local

  Installation of SMCncurs was successful.



   db-4.2.52.NC-sol8-sparc-local.gz

#pkgadd -d db-4.2.52.NC-sol8-sparc-local

  Installation of SMCdb was successful.



四、安装配置dns

内容(略)

五、安装配置MYSQL

1、下载MYSQL

http://www.sunfreeware.com/

文件名:mysql-5.0.27-sol8-sparc-local.gz

2、解压安装:

#gunzip mysql-5.0.27-sol8-sparc-local.gz

#pkgadd –d  mysql-5.0.27-sol8-sparc-local

//出现Installation of SMCbind was successful. 表安装成功

安装位置:/usr/local/mysql

3、配置MYSQL

# groupadd mysql                             //新建mysql组

# useradd -g mysql -d /usr/local/mysql -m mysql    //新建mysql用户

#cd /usr/local/mysql/        

#/usr/local/mysql/bin/mysql_install_db           //初始化数据库

#ln -s /usr/bin/hostname /usr/local/bin/hostname  

# chown -R root /usr/local/mysql

# chown -R mysql /usr/local/mysql/var

# chgrp -R mysql /usr/local/mysql

#cp /usr/local/mysql/share/mysql/my-medium.cnf /etc/my.cnf

#/usr/local/mysql/bin/mysqld_safe --user=mysql &    //启动数据库

    也可以使用以下方法启动:

                #/usr/local/mysql/bin/mysqld_safe &     

                 #/usr/local/mysql/share/mysql/mysql.server start

#/usr/local/mysql/bin/mysqladmin -u root password 'new-password'   //设置数据库root用户密码

4、建立启动自脚本

在 /usr/local/mysql/share/mysql/目录下有一个 启动mysql的文件 mysqld.server

我们可以把他复制到/etc/rc.d/init.d/目录并且改名为mysql

# cp /usr/local/mysql/share/mysql/mysql.server /etc/init.d/mysql.server

# ln /etc/init.d/mysql.server /etc/rc3.d/S79mysql

# ln /etc/init.d/mysql.server /etc/rc0.d/K00mysql

# ln /etc/init.d/mysql.server /etc/rc1.d/K00mysql

# ln /etc/init.d/mysql.server /etc/rc2.d/K00mysql

# ln /etc/init.d/mysql.server /etc/rcS.d/K00mysql

# chown root:sys /etc/init.d/mysql.server /etc/rc3.d/S79mysql

# chmod 0744 /etc/init.d/mysql.server /etc/rc3.d/S79mysql

5、检查数据库是否安装成功:

#mysql -u root -p



mysql> show databases;

+--------------------------+

| Database                |

+---------------------------+

| information_schema|

| mysql                       |

| test                           |

+----------------------------+

3 rows in set (0.01 sec)

六、安装SASL

1、下载文件

下载文件:http://asg.web.cmu.edu/sasl/sasl-library.html

ftp://ftp.andrew.cmu.edu/pub/cyrus-mail

文件名:cyrus-sasl-2.1.22.tar.gz

2、解压及安装

#cd cyrus-sasl-2.1.22



#./configure --enable-anon --enable-plain --enable-login --disable-krb4 --disable-otp --disable-cram --disable-digest --with-mysql=/usr/local/mysql/lib/mysql --without-pam --without-saslauthd --without-pwcheck --with-plugindir=/usr/local/lib/sasl2

#make && make install

最后出现以下,即安装完成:

make[3]: Leaving directory `/var/tmp/cyrus-sasl-2.1.22/saslauthd'

make[2]: Leaving directory `/var/tmp/cyrus-sasl-2.1.22/saslauthd'

make[2]: Entering directory `/var/tmp/cyrus-sasl-2.1.22'

make[2]: Leaving directory `/var/tmp/cyrus-sasl-2.1.22'

make[1]: Leaving directory `/var/tmp/cyrus-sasl-2.1.22'



********************************************************

* WARNING:

* Plugins are being installed into /usr/local/lib/sasl2,

* but the library will look for them in /usr/lib/sasl2.

* You need to make sure that the plugins will eventually

* be in /usr/lib/sasl2 -- the easiest way is to make a

* symbolic link from /usr/lib/sasl2 to /usr/local/lib/sasl2,

* but this may not be appropriate for your site, so this

* installation procedure won't do it for you.

*

* If you don't want to do this for some reason, you can

* set the location where the library will look for plugins

* by setting the environment variable SASL_PATH to the path

* the library should use.

********************************************************

make[2]: Nothing to be done for `install-data-am'.

make[2]: Leaving directory `/var/tmp/cyrus-sasl-2.1.22'

make[1]: Leaving directory `/var/tmp/cyrus-sasl-2.1.22'


七、安装配置postfix-2.4

1、下载postfix源码文件:

http://www.postfix.org/download.html

文件名:postfix-2.4-20070215.tar.gz

2、建立相关用户及组:

#groupadd -g 400 postfix

#groupadd -g 401 postdrop

#useradd -u 400 -g 400 -c postfix postfix

3、停止系统自带的sendmail

先将系统自带的sendmail停止,并将其文件改名:

# /etc/init.d/sendmail stop

# mv /usr/lib/sendmail /usr/lib/sendmail.bak

# mv /usr/bin/mailq /usr/bin/mailq.bak

# mv /usr/bin/newaliases /usr/bin/newaliases.bak

4、解压及安装postfix

# gunzip postfix-2.4-20070215.tar.gz

# tar xvf postfix-2.4-20070215.tar    //得到目录postfix-2.4-20070215

#cd postfix-2.4-20070215

(注:如不是第一编译请先执行以下:

#make tidy

# make clean

# make -f Makefile.init makefiles 'CCARGS=-DUSE_SASL_AUTH –DUSE_CYRUS_SASL -DHAS_MYSQL -I/usr/local/mysql/include/mysql -DUSE_SASL_AUTH -I/usr/local/include/sasl' 'AUXLIBS=-L/usr/local/mysql/lib/mysql -lmysqlclient -lm -lz -L/usr/local/lib/sasl2 -lsasl2'



一些常见错误解决:



出错1:ld.so.1: postconf: fatal: libmysqlclient.so.15: open failed: No such file or directory

ld.so.1: postconf: fatal: libsasl2.so.2: open failed: No such file or directory

解决方法:

#export LD_LIBRARY_PATH=/usr/local/mysql/lib/mysql:/usr/local/lib



出错2:

ld.so.1: postconf: fatal: libmysqlclient.so.15: open failed: No such file or directory

解决方法:

#ln -s /usr/local/mysql/lib/mysql/libmysqlclient.so.15 /usr/lib/libmysqlclient.so.15



出错3:

ld.so.1: postconf: fatal: libsasl2.so.2: open failed: No such file or directory

make: *** [install] Error 1

解决方法:

#ln -s /usr/local/lib/libsasl2.so.2 /usr/lib/libsasl2.so.2

安装:

#export LD_LIBRARY_PATH=/usr/local/mysql/lib/mysql:/usr/local/lib

#make install

在执行脚本配置postfix时,可以按照默认方式完成,出现以下相关内容:

Skipping /usr/local/man/man8/qmgr.8...

Skipping /usr/local/man/man8/qmqpd.8...

Skipping /usr/local/man/man8/scache.8...

Skipping /usr/local/man/man8/showq.8...

Skipping /usr/local/man/man8/smtp.8...

Skipping /usr/local/man/man8/smtpd.8...

Skipping /usr/local/man/man8/spawn.8...

Skipping /usr/local/man/man8/tlsmgr.8...

Skipping /usr/local/man/man8/trace.8...

Skipping /usr/local/man/man8/trivial-rewrite.8...

Skipping /usr/local/man/man8/verify.8...

Skipping /usr/local/man/man8/virtual.8...

Editing /etc/postfix/master.cf, adding missing entry for retry service

出现以上表示安装完成。



查看一下/usr/lib/sendmail文件,再做个链接文件:

# ln -s /usr/lib/sendmail /usr/sbin/sendmail



5、测试:

# postfix start               //启动postfix

postfix/postfix-script: starting the Postfix mail system

# lsof -i:25             //测试端口25,有以下内容表示正常启动postfix

COMMAND  PID USER   FD   TYPE        DEVICE SIZE/OFF NODE NAME

master  6114 root   12u  IPv4 0x300011c6348      0t0  TCP *:smtp (LISTEN)

# postfix stop         //停止postifx

postfix/postfix-script: stopping the Postfix mail system



6、建立postfix的启动脚本



#vi /etc/init.d/postfix

该文件内容如下:

#!/bin/sh

#

#/etc/init.d/sshd "(#)postfix 2.4 02/20/2007 ZH"

#

# File : /etc/init.d/postfix

# Version : 2.4

# Description : Startup script for the postfix MTA.

# Author : stonny <hnwgzwl@gmail.com>

# Copyright : DXZNET (c) 2006-2007

#

#

POSTFIX=/usr/sbin/postfix



case "$1" in



'start')

        if [ -x ${POSTFIX} ]; then

                echo "Starting the PostFix MTA"

                ${POSTFIX} start

        fi

        ;;



'stop')

        echo "Stopping the PostFix MTA "

        ${POSTFIX} stop

        ;;



'reload')

        echo "Reloading the PostFix MTA "

        ${POSTFIX} reload

        ;;



'check')

        echo "Reloading the PostFix MTA "

        ${POSTFIX} check

        ;;



'flush')

        echo "Reloading the PostFix MTA "

        ${POSTFIX} flush

        ;;



*)

        echo "Usage: /etc/init.d/postfix { start | stop | reload | check | flush }"

        ;;



esac

exit 0

设置启动脚本文件的相关权限

# chgrp sys /etc/init.d/postfix                                                

# chmod 744 /etc/init.d/postfix

# ln –s /etc/init.d/postfix /etc/rc3.d/S79postfix

# ln –s /etc/init.d/postfix /etc/rc0.d/K00postfix

# ln –s /etc/init.d/postfix /etc/rc1.d/K00postfix

# ln –s /etc/init.d/postfix /etc/rc2.d/K00postfix

# ln –s /etc/init.d/postfix /etc/rcS.d/K00postfix





7、配置postfix

# postconf -n > /etc/postfix/main2.cf

# mv /etc/postfix/main.cf /etc/postfix/main.cf.old

# mv /etc/postfix/main2.cf /etc/postfix/main.cf

再编辑main.cf:

#vi /etc/postfix/main.cf

增加如下内容:

# hostname

mynetworks = 127.0.0.1

myhostname = mail.zh.test.com

mydestination = $mynetworks $myhostname



# banner

mail_name = Postfix - by zh.test.com

smtpd_banner = $myhostname ESMTP $mail_name



# response immediately

smtpd_error_sleep_time = 0s

unknown_local_recipient_reject_code = 450



# extmail config here

virtual_alias_maps = mysql:/etc/postfix/mysql_virtual_alias_maps.cf

virtual_mailbox_domains = mysql:/etc/postfix/mysql_virtual_domains_maps.cf

virtual_mailbox_maps = mysql:/etc/postfix/mysql_virtual_mailbox_maps.cf

virtual_transport = maildrop:



编辑mysql_virtual_alias_maps.cf

# vi /etc/postfix/mysql_virtual_alias_maps.cf

内容如下:

user = extmail

password = extmail

hosts = localhost

dbname = extmail

table = alias

select_field = goto

where_field = address



编辑mysql_virtual_domains_maps.cf

# vi /etc/postfix/mysql_virtual_domains_maps.cf

内容如下:

user = extmail

password = extmail

hosts = localhost

dbname = extmail

table = domain

select_field = description

where_field = domain

#additional_conditions = and backupmx ='0' and active ='1'



编辑mysql_virtual_mailbox_maps.cf

# vi /etc/postfix/mysql_virtual_mailbox_maps.cf

内容如下:

user = extmail

password = extmail

hosts = localhost

dbname = extmail

table = mailbox

select_field = maildir

where_field = username

#additional_conditions = and active = '1'



再测试Postfix

# /usr/sbin/postfix start               //启动postfix,如果出错,可以查看/var/log/syslog

常见错误1: postfix/smtpd[491]: [ID 947731 mail.crit] fatal: open database /etc/mail/aliases.dir: No such file or directory

解决方法:

# newaliases                               //更新 aliases 数据库

# lsof -i:25                                  //出现以下相关信息,表示正常

COMMAND   PID USER   FD   TYPE        DEVICE SIZE/OFF NODE NAME

master  26039 root   12u  IPv4 0x300016dd550      0t0  TCP *:smtp (LISTEN)

设定别名:请利用文字编辑器开启/etc/aliases 别名档,如果您没有这个档案的话,可复制 /etc/postfix 目录下的 aliases 文件到 /etc 目录下。在其中新增一别名如下:

    postfix: root

请记得在每次更改完此别名档后,要执行"newaliases"指令以更新 aliases 数据库:

八、配置SASL

1、建立smtpd.conf文件

# vi /usr/local/lib/sasl2/smtpd.conf

内容如下:

pwcheck_method:authdaemond

log_level: 3

mech_list: PLAIN LOGIN

authdaemond_path:/usr/local/var/spool/authdaemon/socket



2、建立相关用户和组:

# groupadd -g 1000 vgroup

# useradd -u 1000 -g vgroup -s /bin/false vuser

# mkdir /var/spool/authdaemon/

# chown -R vuser:vgroup /var/spool/authdaemon

# chmod -R 755 /var/spool/authdaemon



3、修改main.cf文件

在/etc/postfix/main.cf中添加以下内容:

# smtpd related config

smtpd_recipient_restrictions =

    permit_mynetworks,

    permit_sasl_authenticated,

    reject_non_fqdn_hostname,

    reject_non_fqdn_sender,

    reject_non_fqdn_recipient,

    reject_unauth_destination,

    reject_unauth_pipelining,

    reject_invalid_hostname,



# SMTP AUTH config here

broken_sasl_auth_clients = yes

smtpd_sasl_auth_enable = yes

smtpd_sasl_local_domain = $myhostname

smtpd_sasl_security_options = noanonymous



# postfix stop/start(postfix reload)    //重启postfix



4、常见错误解决:

日志报错1:fatal: unsupported dictionary type: mysql

表示不支持mysql,在编译postfix时要加参数-DHAS_MYSQL



日志报错2:

mail postfix/smtpd[7291]: [ID 947731 mail.warning] warning: xsasl_cyrus_server_get_mechanism_list: no applicable SASL mechanisms

Feb 21 23:14:29 mail postfix/smtpd[7291]: [ID 947731 mail.crit] fatal: no SASL authentication mechanisms

Feb 21 23:14:30 mail postfix/postfix-script: [ID 197553 mail.info] stopping the Postfix mail system

Feb 21 23:14:30 mail postfix/master[7280]: [ID 197553 mail.info] terminating on signal 15

解决方法:

# ln -s /usr/local/lib/sasl2 /usr/lib/sasl2



测试SASL验证:

# telnet localhost 25

Trying 127.0.0.1...

Connected to localhost.

Escape character is '^]'.

220 mail.extmail.org ESMTP Postfix - by extmail.org

ehlo localhost

250-mail.extmail.org

250-PIPELINING

250-SIZE 10240000

250-VRFY

250-ETRN

250-AUTH LOGIN PLAIN

250-AUTH=LOGIN PLAIN

250-ENHANCEDSTATUSCODES

250-8BITMIME

250 DSN

quit

221 2.0.0 Bye

Connection closed by foreign host.

出现上面的AUTH LOGIN PLAIN表示验证成功。

论坛徽章:
0
2 [报告]
发表于 2007-07-10 13:57 |只看该作者
九、安装配置courier-authlib和Courier-IMAP

1、下载courier-authlib和courier-imap

http://www.courier-mta.org/?download.php

下载文件:courier-authlib-0.59.1.tar.bz2和courier-imap-4.1.2.tar.bz2

2、解压文件

# bunzip2 courier-authlib-0.59.1.tar.bz2

# tar xvf courier-authlib-0.59.1.tar

安装相关包:gdbm

#gunzip gdbm-1.8.3-sol8-sparc-local.gz

#pkgadd -d gdbm-1.8.3-sol8-sparc-local

//出现Installation of <SMCgdbm> was successful.表安装完成。



3、安装及配置:

# cd courier-authlib-0.59.1

# ./configure --with-mysql-libs=/usr/local/mysql/lib/mysql --with-mysql-includes=/usr/local/mysql/include/mysql --with-mailuser=vuser --with-mailgroup=vgroup --with-authmysql --with-authmysql=yes --with-authchangepwdir

# make && make install

# make install-configure

查看是否有以下配置文件(文件名相同,一个扩展名为dist,一个为无扩展名)

# ls /usr/local/etc/authlib/

authProg           authdaemonrc.dist  authmysqlrc        authdaemonrc       authldaprc           authldaprc.dist    authmysqlrc.dist

修改文件/usr/local/etc/authlib/authdaemonrc

    找到其中两行,改成以下:

authmodulelist="authmysql"

authmodulelistorig="authmysql"

编辑/usr/local/etc/authlib/authmysqlrc文件,内容为:

MYSQL_SERVER            localhost

MYSQL_USERNAME         extmail

MYSQL_PASSWORD         extmail

MYSQL_SOCKET            /tmp/mysql.sock

MYSQL_PORT               3306

MYSQL_OPT                 0

MYSQL_DATABASE          extmail

MYSQL_USER_TABLE        mailbox

MYSQL_CRYPT_PWFIELD     password

MYSQL_UID_FIELD         uidnumber

MYSQL_GID_FIELD         gidnumber

MYSQL_LOGIN_FIELD       username

MYSQL_HOME_FIELD        homedir

MYSQL_NAME_FIELD        name

MYSQL_MAILDIR_FIELD     maildir

MYSQL_QUOTA_FIELD       quota

MYSQL_SELECT_CLAUSE     SELECT username,password,"",uidnumber,gidnumber,\

                        CONCAT('/home/domains/',homedir),               \

                        CONCAT('/home/domains/',maildir),               \

                        quota,                                          \

                        name                                            \

                        FROM mailbox                                    \

                        WHERE username = '$(local_part)@$(domain)'

设置该文档的相关权限:

# chmod 660 /usr/local/etc/authlib/authmysqlrc

# chown vuser:vgroup /usr/local/etc/authlib/authmysqlrc

# chown vuser:vgroup /usr/local/etc/authlib/authldaprc

4、设置启动

拷贝启动文件

# cp /var/tmp/courier-authlib-0.59.1/courier-authlib.sysvinit /etc/init.d/courier-authlib

# chmod 755 /etc/init.d/courier-authlib

启动courier-authlib:

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

Starting Courier authentication services: authdaemond   //启动完毕;



5、常见错误解决:

错误1:touch: /var/lock/subsys/courier-authlib cannot create.

解决:建立目录

# mkdir /var/lock

# mkdir /var/lock/subsys

错误2:

#authtest -s login test@test.com  //建议这一步测试要等imap/maildrop配置完后再做,否则出错

Authentication FAILED: I/O error  

解决:检查文件/usr/local/etc/authlib/authdaemonrc



出错3:mail authdaemond: [ID 702911 mail.debug] authpipe: disabled: failed to stat pipe program /usr/local/etc/authlib/authProg: No such file or directory

解决:

# touch /usr/local/etc/authlib/authProg



6、安装courier-imap

解压:

# bunzip2 courier-imap-4.1.2.tar.bz2

# tar xvf courier-imap-4.1.2.tar

安装:

# cd courier-imap-4.1.2

# ./configure --prefix=/usr/local/courier --enable-unicode=utf-8,iso-8859-1,gb2312 --with-mysql-libs=/usr/local/mysql/lib/mysql -with-mysql-includes=/usr/local/mysql/include/mysql --with-authmysql=yes --with-authchangepwdir --disable-root-check --with-trashquota --with-dirsync --with-db=gdbm --with-waitfunc=wait3

# make && make install

# make install-configure

安装路径:/usr/local/courier



7、配置Courier-IMAP

主要通过Courier-IMAP,为用户提供pop3服务:

# vi /usr/local/courier/etc/pop3d

将其中一行改为如下:

POP3DSTART=yes



8、设置启动

# cp /export/home/ftp/courier-imap-4.1.2/courier-imap.sysvinit /etc/init.d/courier-imap

# chmod 744 /etc/init.d/courier-imap

# /etc/init.d/courier-imap start

Starting Courier-IMAP server: pop3

测试是否启动:

# lsof -i:110                //出现以下相关信息,表示启动成功

COMMAND     PID USER   FD   TYPE        DEVICE SIZE/OFF NODE NAME

couriertc 23048 root    3u  IPv6 0x300023ed9d8      0t0  TCP *:pop3 (LISTEN)

couriertc 23048 root    5u  IPv4 0x300015056d0      0t0  TCP *:pop3 (LISTEN)

常见出错1:

Feb 23 07:37:49 mail pop3d: [ID 702911 mail.info] ld.so.1: couriertcpd: fatal: libgdbm.so.3: open failed: No such file or directory

ld.so.1: couriertcpd: fatal: libgdbm.so.3: open failed: No such file or directory

解决:

# ln -s /usr/local/lib/libgdbm.so.3 /usr/lib/libgdbm.so.3



9、设置Courier-authlib和Courier-imap的开机自动启动



# ln -s /etc/init.d/courier-authlib /etc/rc3.d/S51authlib

# ln -s /etc/init.d/courier-authlib /etc/rc0.d/K15authlib

# ln -s /etc/init.d/courier-authlib /etc/rc1.d/K15authlib

# ln -s /etc/init.d/courier-authlib /etc/rc2.d/K15authlib

# ln -s /etc/init.d/courier-imap /etc/rc3.d/S51imap

# ln -s /etc/init.d/courier-imap /etc/rc0.d/K51imap

# ln -s /etc/init.d/courier-imap /etc/rc1.d/K51imap

# ln -s /etc/init.d/courier-imap /etc/rc2.d/K51imap

十、安装Maildrop

1、下载Maildrop:

http://www.courier-mta.org/download.php#maildrop

http://sourceforge.net/projects/courier/

文件名:maildrop-2.0.3.tar.bz2

2、解压和安装:

# bunzip maildrop-2.0.3.tar.bz2

# tar xvf maildrop-2.0.3.tar

安装

先安装支持包:pcre-6.7-sol8-sparc-local.gz

# gunzip pcre-6.7-sol8-sparc-local.gz

# pkgadd -d pcre-6.7-sol8-sparc-local

Installation of <SMCpcre> was successful.



# cd maildrip-2.0.3

# ./configure --prefix=/usr/local/maildrop --enable-sendmail=/usr/sbin/sendmail --enable-maildropmysql --with-mysqlconfig=/etc/postfix/mysql_maildrop.conf --enable-maildirquota --with-trashquota --with-dirsync --enable-trusted-users='root maildrop' --enable-maildrop-uid=1000 --enable-maildrop-gid=1000

# make

# make install-strip

# make install-man



修改/etc/master.cf文件

# vi /etc/master.cf

查找以下内容,改成如下,将第一行加注释,第二行为新加内容

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

flags=DRhu user=vuser argv=maildrop -w 90 -d ${user}@${nexthop} ${recipient} ${user} ${extension} {nexthop}



3、测试:

执行maildrop –v

# /usr/local/maildrop/bin/maildrop -v

maildrop 2.0.3 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.

Courier Authentication Library extension enabled.出现这行,表示支持courier auth.

观察下面的操作,出现类似内容,说明maildrop 已投递正常

# echo "test"|maildrop -V 10 -d test@extmail.org

maildrop: authlib: groupid=1000

maildrop: authlib: userid=1000

maildrop: authlib: logname=test@extmail.org, home=/home/data/domains/extmail.org/test, mail=/home/data/domains/extmail.org/test/Maildir/

maildrop: Changing to /home/data/domains/extmail.org/test

Message start at 0 bytes, envelope sender=test@extmail.org

maildrop: Attempting .mailfilter

WARN: quota string '5242880' not parseable

maildrop: Delivery complete.



4、常见错误解决:

出错1:

configure: error: pcre.h not found - install PCRE from www.pcre.org

pcre-6.7-sol8-sparc-local.gz

# gunzip pcre-6.7-sol8-sparc-local.gz

# pkgadd -d pcre-6.7-sol8-sparc-local

Installation of <SMCpcre> was successful.



出错2:checking location of system mailboxes... ./configure: whoami: command not found

configure: error: Unable to run whoami

新建文件/usr/bin/whoami

# vi /usr/bin/whoami

文件内容如下:

#!/bin/sh

who am i

设置可以执行权限:

# chmod a+x /usr/bin/whoami



出错3:Feb 24 12:05:14 mail pipe[6651]: [ID 947731 mail.crit] fatal: pipe_command: execvp maildrop: No such file or directory

解决:

# ln -s /usr/local/maildrop/bin/maildrop /usr/local/bin/maildrop

测试110的一些错误解决:

# echo "test"|maildrop -V 10 -d test@zh.test.com

ERR: authdaemon: s_connect() failed: No such file or directory

maildrop: Temporary authentication failure.

解决:

# ln -f /usr/local/maildrop/bin/maildrop /usr/local/bin/maildrop



出错: mail pop3d:  ld.so.1: pop3login: fatal: libgcc_s.so.1: open failed: No such file or directory

# ln -s /usr/local/lib/libgcc_s.so.1 /usr/lib/libgcc_s.so.1

十一、安装配置Apache和PHP

1、下载安装apache

http://www.sunfreeware.com/

文件名:apache-2.0.59-sol8-sparc-local.gz

# gunzip apache-2.0.59-sol8-sparc-local.gz

# pkgadd -d apache-2.0.59-sol8-sparc-local

Installation of <SMCap2059> was successful.  //出现这些为安装完成,安装目录为/usr/local/apache2



2、配置及启动

复制httpd.conf配置文件

# cp /usr/local/apache2/conf/httpd-std.conf  /usr/local/apache2/conf/httpd.conf

修改httpd.conf文件:

其中一行改成:

User vuser

Group vgroup



启动apahce2

# /usr/local/apache2/bin/apachectl start

如果不能正常启动,请查看日志目录下的文档:/usr/local/apache2/logs



3测试:

可以使用命令lsof -i:80或在浏览器里输入http://ip,如果正常,则能得到相关信息。



4、设置APACHE开机启动

# cp /usr/local/apache2/bin/apachectl /etc/init.d/httpd

# chmod 755 /etc/init.d/httpd

# ln -s /etc/init.d/httpd /etc/rc3.d/S51httpd

# ln -s /etc/init.d/httpd /etc/rc0.d/K15httpd

# ln -s /etc/init.d/httpd /etc/rc1.d/K15httpd

# ln -s /etc/init.d/httpd /etc/rc2.d/K15httpd



5、下载安装PHP

下载:http://www.sunfreeware.com/

文件名:php-5.2.0-sol8-sparc-local.gz

安装

# gunzip php-5.2.0-sol8-sparc-local.gz

# pkgadd -d php-5.2.0-sol8-sparc-local

Installation of <SMCphp> was successful.   //表示安装完成。

安装目录为:/usr/local/php



6、配置php5

修改httpd.conf,增加以下两行:

# vi /usr/local/apache2/conf/httpd.conf

在相应位置添加以下两行:

LoadModule php5_module        modules/libphp5.so

AddType application/x-httpd-php .php .php3

复制PHP配置文件

# cp /usr/local/php/doc/php/php.ini-recommended /usr/local/php/lib/php/php.ini

安装GD库:(这个为可选安装)

expat-1.95.5-sol8-sparc-local.gz

freetype-2.1.9-sol8-sparc-local.gz

fontconfig-2.2.98-sol8-sparc-local.gz

jpeg-6b-sol8-sparc-local.gz

libpng-1.2.16-sol8-sparc-local.gz

xpm-3.4k-sol8-sparc-local.gz

gd-2.0.33-sol8-sparc-local.gz



7、常见错误解决:

错误1:

# /usr/local/apache2/bin/apachectl stop

Syntax error on line 255 of /usr/local/apache2/conf/httpd.conf:

Cannot load /usr/local/apache2/modules/libphp5.so into server: ld.so.1: httpd: fatal: libxml2.so.2: open failed: No such file or directory

解决:

# gunzip libxml2-2.6.26-sol8-sparc-local.gz

# pkgadd -d libxml2-2.6.26-sol8-sparc-local



8、测试apache和php

测试php是否成功:

新建aa.php文件放入/usr/local/apache2/htdocs/里,内容为:

<?php

phpinfo();

?>

然后启动apache,在地址栏里输入http://ip/aa.php,如能显示php配置内容,表示安装成功。

9、配置Apache与Extmail的关联

编辑/usr/local/apache2/conf/httpd.conf文件,在最后一行加上:

NameVirtualHost *:80

Include conf/vhost_*.conf



编辑/usr/local/apache2/conf/vhost_extmail.conf,里面定义虚拟主机的相关内容,包括主目录,以及ExtMail和ExtMan的相关配置等。内容如下:

# VirtualHost for ExtMail Solution

<VirtualHost *:80>

ServerName mail.zh.test.com

DocumentRoot /var/www/extsuite/extmail/html/

ScriptAlias /extmail/cgi/ /var/www/extsuite/extmail/cgi/

Alias /extmail/ /var/www/extsuite/extmail/html/

ScriptAlias /extman/cgi/ /var/www/extsuite/extman/cgi/

Alias /extman/ /var/www/extsuite/extman/html/

</VirtualHost>

重启apache

# /etc/init.d/httpd restart



十二、安装Perl

1、下载perl

下载地址:http://www.cpan.org/src/README.html

http://www.cpan.org/src/stable.tar.gz(当前稳定版本为5.8.

以下为源码安装perl-5.8.8

# ./configure.gnu

# make

# make test

# make install

2、其它模块安装:

下载点:http://search.cpan.org/

一般为安装方法:

# perl Makefile.PL

# make && make install



File-Tail-0.99.3.tar .gz

Time-HiRes-1.9707.tar.gz

Net-Daemon-0.39.tar.gz

PlRPC-0.2018.tar.gz

DBI-1.54.tar.gz

DB_File-1.815.tar.gz

Unix-Syslog-0.100.tar.gz

DBD-mysql-4.004.tar.gz

Math-Complex-1.37.tar.gz

GD-2.35.tar.gz



出错1:

在perl Makefile.PL时出错:version.c:30:16: db.h: No such file or directory

make: *** [version.o] Error 1

#  ln -s /usr/local/BerkeleyDB.4.2 /usr/local/BerkeleyDB



libart_lgpl-2.3.16.tar.gz(rrdtool需要)

论坛徽章:
0
3 [报告]
发表于 2007-07-10 13:58 |只看该作者
十三、下载安装Extmail和Extman

1、下载和解压

http://www.extmail.org/cgi-bin/download.cgi

下载两个文件:extmail-1.0.2.tar.gz和 extman-0.2.2.tar.gz (或许版本不一定相同)

得到目录:extmail-1.0.2和extman-0.2.2

2、安装Extmail

建立/var/www/extsuite并复制源码到该目录,相关命令:

# mkdir /var/www/extsuite

# cp -r extmail-1.0.2 /var/www/extsuite/extmail

# cd /var/www/extsuite/extmail

# cp webmail.cf.default webmail.cf

编辑webmail.cf

用vi打开/var/www/extsuite/extmail/webmail.cf,并按2次ESC键以确保进入命令模式,然后输入: :1, $ s#/var/www/cgi-bin#/var/www/extsuite#g

上述命令的作用是将默认路径从/var/www/cgi-bin下换到/var/www/extsuite下,处理完毕后,修改webmail.cf里的其他参数,主要变动的内容见下:

SYS_USER_LANG = zh_CN

SYS_USER_CHARSET = gb2312

SYS_MFILTER_ON = 1

SYS_NETDISK_ON = 1

SYS_MYSQL_USER = extmail

SYS_MYSQL_PASS = extmail

SYS_MYSQL_DB = extmail

SYS_MYSQL_SOCKET = /tmp/mysql.sock

SYS_G_ABOOK_TYPE = file

SYS_G_ABOOK_FILE_CHARSET = gb2312

其中SYS_MFILTER_ON及SYS_NETDISK_ON 设置为1是为了打开网络磁盘和过滤器。全局地址本默认为ldap格式,现在也改为文本格式,并将地址本的转换编码改为GB2312

# chown -R vuser:vgroup /var/www/extsuite/extmail/cgi/



3、安装Extman

在ExtMail-Solution软件包根目录下执行:

# cp -r extman-0.2.2 /var/www/extsuite/extman

配置webman.cf

用vi编辑/var/www/extsuite/extman/webman.cf,并连按2次ESC,确保进入命令模式,然后输入如下命令:

:1, $ s#/var/www/cgi-bin#/var/www/extsuite#g

处理完毕后修改SYS_CHARSET及SYS_LANG参数为:

SYS_SESS_DIR = /var/tmp/extman/

SYS_LANG = zh_CN

SYS_MYSQL_SOCKET = /tmp/mysql.sock

其他参数基本上可以使用默认值。

# chown -R vuser:vgroup /var/www/extsuite/extman/cgi/



建立一个链接文件

#  ln -s /var/www/extsuite/extman /var/www/extsuite/extmail/html/extman

导入数据库:

# mysql -u root -p </var/tmp/extmail/extman-0.2.2/docs/extmail.sql

Enter password:

# mysql -u root -p </var/tmp/extmail/extman-0.2.2/docs/init.sql   

Enter password:



4、链接基本库到Extmail



由于ExtMan的体系与ExtMail比较类似,因此ExtMan需要使用ExtMail中几个基础perl 模块,在extman的源码包里,包含了一个叫buildpkg.sh 的小脚本,该脚本完成了这些链接的工作,使用方法:

# cd /var/www/extsuite/extman/libs/Ext

# ./buildpkg.sh build /var/www/extsuite/extmail/libs/Ext

# mkdir /var/tmp/extman

# chown -R vuser:vgroup /var/tmp/extman

# mkdir /home/domains

# mkdir /home/domains/extmail.org

# chown -R vuser:vgroup /home/domains/extmail.org

5、测试登录:

打开浏览器,输入:http://ip/   是否能打开extmail

输入:http://ip/extman   是否能打开extman

登录用户名:root@extmail.org          密码:extmail*123*



6、安装图形库支持:

下载安装:libart_lgpl

http://ftp.acc.umu.se/pub/gnome/sources/libart_lgpl/2.3/

下载文件:libart_lgpl-2.3.18.tar.gz

解压再安装:./configure && make && make install



下载安装rrdtool (http://ftp.idilis.ro/mirrors/rrdtool/rrdtool-1.2.18.tar.gz)

解压:

# gunzip rrdtool-1.2.19.tar.gz

# tar xvf rrdtool-1.2.19.tar

# cd rrdtool-1.2.19

安装:

# export LDFLAGS="-L/usr/local/lib"

# export  CPPFLAGS="-D_POSIX_PTHREAD_SEMANTICS -D_REENTRANT -I/usr/local/include/freetype2  -D_REENTRANT -I/usr/local/include/libart-2.0"

# ./configure --prefix=/usr/local/rrdtool --enable-perl-site-install=/usr/local/lib/perl5

# make && make install

测试安装是否成功:

# /usr/local/rrdtool/bin/rrdtool

配置和启动mailgraph

下载 mailgraph

# wget http://mailgraph.schweikert.ch/pub/mailgraph-1.13.tar.gz

# gunzip mailgraph-1.13.tar.gz && tar xvf mailgraph-1.13.tar

#  cd mailgraph-1.13

#  cp mailgraph.pl /usr/local/bin

#  mkdir /var/lib

#  cp mailgraph-init /etc/init.d/mailgraph

#  vi /etc/init.d/mailgraph

修改其中几行为以下:

MAILGRAPH_PL=/usr/local/bin/mailgraph.pl

MAIL_LOG=/var/log/maillog

PID_FILE=/var/run/mailgraph.pid

RRD_DIR=/var/lib/



# chmod +x /etc/init.d/mailgraph

# cp mailgraph.cgi /usr/local/apache2/cgi-bin/

# vi /usr/loca/apach2/cgi-bin/mailgraph.cgi

修改其中几行为以下:

my $rrd = '/var/lib/mailgraph.rrd'; # path to where the RRD database is

my $rrd_virus = '/var/lib/mailgraph_virus.rrd'; # path to where the Virus RRD database is



# chmod +x /usr/loca/apach2/cgi-bin/mailgraph.cgi





# /etc/init.d/mailgraph start

Starting mail statistics grapher: mailgraph_ext



# cp -r mailgraph_ext /usr/local/mailgraph_ext

# /usr/local/mailgraph_ext/qmonitor-init start

Starting queue statistics grapher: qmonitor

建立开机自动启动:(忘加了,后面再写吧)



   添加用户

登录管理后台:http://ip/extman  选择“添加用户”



  到这里为止,可以使用Foxmail/Outlook等邮件客户端软件进行发送邮件了。

论坛徽章:
0
4 [报告]
发表于 2007-07-10 13:59 |只看该作者
十四、反病毒/内容过滤安装配置

  在这里采用的amavisd-new+clamav+SpamAssassin的来实现防病毒和防垃圾邮件,当然还有的方法,我这里暂不做讨论:

1、安装clamav

下载clamav最新版:http://www.clamav.net/download/sources/

我下载的是当时最新版ClamAV 0.90.3 文件名为clamav-0.90.3.tar.gz

新建相关用户和组:

# groupadd clamav

# useradd -g clamav -s /bin/false -d /dev/null clamav

解压及安装配置:

# gunzip clamav-0.90.3.tar.gz

# tar xvf clamav-0.90.3.tar

# cd clamav-0.90.3

# ./configure --prefix=/usr/local/clamav --with-dbdir=/usr/local/share/clamav

# make

# make check

# make install  



修改配置文件clamd.conf:

# vi /usr/local/clamav/etc/clamd.conf



LogSyslog

LogVerbose

LogFacility LOG_MAIL

LogFile /var/log/clamav/clamd.log   

PidFile /usr/run/clamav/clamd.pid    \\不建议放在/var/run目录,其为tmpfs)

DatabaseDirectory /usr/local/share/clamav

LocalSocket /usr/run/clamav/clamd.socket   

StreamMaxLength 10M

User amavis

ScanMail

ScanArchive

ScanRAR



修改配置文件freshclam.conf:

# vi /usr/local/clamav/etc/freshclam.conf



DatabaseDirectory /usr/local/share/clamav

UpdateLogFile /var/log/clamav/freshclam.log

LogSyslog

LogVerbose

DatabaseOwner amavis

Checks 12

DatabaseMirror db.CN.clamav.net

DatabaseMirror database.clamav.net

NotifyClamd  

注意:注释掉两个文件中Example那行



添加amavis用户和组,配合amavisd使用

# groupadd amavis

# useradd -g amavis -s /bin/false -c "Amavis User" -d /dev/null amavis

创建日志文件夹并设置权限

# mkdir /var/log/clamav

# chmod -R 744 /var/log/clamav

# chown -R amavis:amavis /var/log/clamav

# chown -R amavis:amavis /usr/local/share/clamav

# mkdir /usr/run/clamav         

# chmod 700 /usr/run/clamav      

# chown amavis:amavis /usr/run/clamav

手动更新病毒库

# /usr/local/clamav/bin/freshclam



设置自动更新病毒库

# EDITOR=vi;export EDITOR

# crontab -e

0 4 * * * root /usr/local/clamav/bin/freshclam --quiet -l /var/log/clamd.log



启动clamd服务:

# /usr/local/clamav/sbin/clamd



设置开机启动服务,建立启动脚本文件,/etc/init.d/clamd文件内容:

#!/bin/sh

#

# Startup / shutdown script for Clam Antivirus



case "$1" in

start)

/usr/local/clamav/sbin/clamd

echo -n 'clamd'

;;



stop)

pkill clamd

rm /usr/run/clamav/clamd.socket

;;



*)

echo ""

echo "Usage: `basename $0` { start | stop }"

echo ""

exit 64

;;

esac



设置相关权限及链接文件

# chmod +x /etc/init.d/clamd

# ln -s /etc/init.d/clamd /etc/rc3.d/S90clamd

# ln -s /etc/init.d/clamd /etc/rc0.d/K90clamd

2、安装perl及amavisd-new

下载amavisd-new:http://www.ijs.si/software/amavisd/#download

当前最新版为2.5.2,文件名:amavisd-new-2.5.2.tar.gz

安装perl,要求5.8以上,如未达到此版本,请参考以上方法安装新版,也可用以下方法查看当前版本:

# perl -v

This is perl, v5.8.8 built for sun4-solaris

Copyright 1987-2006, Larry Wall

Perl may be copied only under the terms of either the Artistic License or the

GNU General Public License, which may be found in the Perl 5 source kit.



Complete documentation for Perl, including FAQ lists, should be found on

this system using "man perl" or "perldoc perl".  If you have access to the

Internet, point your browser at http://www.perl.org/, the Perl Home Page.

安装Perl的相关模块:

# perl -MCPAN -e shell

cpan>install Archive::Tar  

cpan>install Archive::Zip   

cpan>install Compress::Zlib

cpan>install Convert::UUlib

cpan>install MIME::Base64  

cpan>install Mail::Internet

cpan>install Net::Server   

cpan>install Net::SMTP      

cpan>install Digest::MD5   

cpan>install IO::Stringy   

cpan>install Time::HiRes   

cpan>install Unix::Syslog     

cpan>install BerkeleyDB

cpan>install Convert::TNEF

cpan>install MIME:arser

cpan>install MIME::Tools

注意:如果以上方法不能正常安装,请到http://search.cpan.org下载后安装。

建立相关目录及用户,并复制相关文件和设定权限:

# mkdir -p /var/amavis /var/amavis/tmp /var/amavis/var /var/amavis/db /var/amavis/home



# chown -R amavis:amavis /var/amavis

# chmod -R 750 /var/amavis



# gunzip amavisd-new-2.5.2.tar.gz

# tar xvf amavisd-new-2.5.2.tar

# cd amavisd-new-2.5.2

# cp amavisd /usr/local/sbin/

# chown root /usr/local/sbin/amavisd

# chmod 755  /usr/local/sbin/amavisd

# cp amavisd.conf /etc/

# chown root /etc/amavisd.conf

# chmod 644  /etc/amavisd.conf

# mkdir /var/virusmails

# chown amavis:amavis /var/virusmails

# chmod 750 /var/virusmails



修改 /etc/amavisd.conf



$mydomain = 'example.com';

$myhostname = 'mail.iaspec.net';  # must be a fully-qualified domain name!

$virus_admin               = "postmaster\@$mydomain";  # notifications recip.

$mailfrom_notify_admin     = "postmaster\@$mydomain";  # notifications sender

$mailfrom_notify_recip     = "postmaster\@$mydomain";  # notifications sender

$mailfrom_notify_spamadmin = "postmaster\@$mydomain"; # notifications sender

$mailfrom_to_quarantine = ''; # null return path; uses original sender if undef

$daemon_user  = 'amavis';     # (no default;  customary: vscan or amavis), -u

$daemon_group = 'amavis';     # (no default;  customary: vscan or amavis), -g



加入对Clamav 的支持

# ### http://www.clamav.net/

['ClamAV-clamd',

   \&ask_daemon, ["CONTSCAN {}\n", "/usr/run/clamav/clamd.socket"],

   qr/\bOK$/, qr/\bFOUND$/,

   qr/^.*?: (?!Infected Archive)(.*) FOUND$/ ],

当然该配置文件其它的地方根据具体情况再进行修改!

3.安装SpamAssassin

# perl -MCPAN -e shell

cpan>install Digest::SHA1

cpan>install HTML:arser

cpan>install Net:NS

cpan>install Mail::SPF:uery

cpan>install IP::Country

cpan>install Net::Ident

cpan>install IO::Socket::INET6

cpan>install IO::Socket::SSL

cpan>install DBI

cpan>install LWP::UserAgent

cpan>install Mail::SpamAssassin

注意:如果以上方法不能正常安装,请到http://search.cpan.org下载后安装。

测试amavis,看看有没有错误,

# /usr/local/sbin/amavisd debug



启动停止服务

# /usr/local/sbin/amavisd start|stop

设置开机启动服务

/etc/init.d/amavisd文件内容:

#!/bin/sh

#

# Startup / shutdown script for Amavisd-NEW



case "$1" in

start)

/usr/local/sbin/amavisd

echo -n 'amavisd'

;;



stop)

pkill amavisd

rm /var/amavis/amavisd.sock

;;



*)

echo ""

echo "Usage: `basename $0` { start | stop }"

echo ""

exit 64

;;

esac



# ln -s /etc/init.d/amavisd /etc/rc3.d/S90amavisd

# ln -s /etc/init.d/amavisd /etc/rc0.d/K90amavisd



4.让postfix使用amavisd

在/usr/local/etc/postfix/main.cf 加入

# Content-Filter

content_filter = smtp:[127.0.0.1]:10024

receive_override_options = no_address_mappings



在/usr/local/etc/postfix/master.cf 加入

127.0.0.1:10025 inet    n       -       n       -       -       smtpd

    -o content_filter=

    -o local_recipient_maps=

    -o relay_recipient_maps=

    -o smtpd_restriction_classes=

    -o smtpd_client_restrictions=

    -o smtpd_helo_restrictions=

    -o smtpd_sender_restrictions=

    -o smtpd_recipient_restrictions=permit_mynetworks,reject

    -o mynetworks=127.0.0.0/8

    -o strict_rfc821_envelopes=yes

    -o smtpd_error_sleep_time=0

    -o smtpd_soft_error_limit=1001

    -o smtpd_hard_error_limit=1000

    -o receive_override_options=



5. 测试



测试Clamav



输入如下命令(蓝色字代表命令行输入): 每输入一行后等待1秒左右:

# telnet localhost 25

Trying 127.0.0.1...

Connected to localhost.localdomain (127.0.0.1).

Escape character is '^]'.

220 mail.extmail.org ESMTP Postfix - by extmail.org

mail from:<test@example.com>

250 2.1.0 Ok

rcpt to:<test@example.com>

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.



tail  /var/log/maillog 查看邮件日志,看到有Blocked字样,并且没有错误信息。表明Clamav+Amavisd-new工作正常。



测试SpamAssassin



输入如下命令(蓝色字代表命令行输入): 每输入一行后等待1秒左右:

# telnet localhost 25

Trying 127.0.0.1...

Connected to localhost.localdomain (127.0.0.1).

Escape character is '^]'.

220 mail.extmail.org ESMTP Postfix - by extmail.org

mail from:<test@example.com>

250 2.1.0 Ok

rcpt to:<test@example.com>

250 2.1.5 Ok

data

354 End data with .

Subject: XJS*C4JDBQADN1.NSBN3*2IDNEN*GTUBE-STANDARD-ANTI-UBE-TEST-EMAIL*C.34X



SpamMail test

.

250 2.0.0 Ok: queued as BC24E85260

quit

221 2.0.0 Bye

Connection closed by foreign host.

tail -f /var/log/maillog 查看邮件日志,看到有amavis[10579]: (10579-06) Passed SPAM字样,并且没有错误信息。表明SpamAssassin+Amavisd-new工作正常。





参考文档:
http://www.extmail.org/docs/extmail_solution_linux/
http://www.xjtusky.com/article.asp?id=109
http://genco.gen.tc/postfix_virtual.php#amavisdclamav
http://www.toping.net/bbs/htm_data/10/0602/1042.html
http://www.freespamfilter.org/FC4.html
http://blog.5ilinux.com/archives/2006/05/

论坛徽章:
0
5 [报告]
发表于 2007-07-10 14:43 |只看该作者
CPU:UltraSPARC-IIe 500MHz
内存:256M
硬盘:SCSI 18G
网卡:集成(eri0 eri1)

嘿嘿,明显是退休了再返聘,
不过 18G 的磁盘空间,估计将来就是鸡肋了,现在的那些鸟人,用 pop 还都习惯什么都存在服
务器上个副本,还给 IMAP ,更当找了个免费的网络磁盘了

论坛徽章:
0
6 [报告]
发表于 2007-07-18 09:22 |只看该作者
原帖由 alvis 于 2007-7-10 14:43 发表
CPU:UltraSPARC-IIe 500MHz
内存:256M
硬盘:SCSI 18G
网卡:集成(eri0 eri1)

嘿嘿,明显是退休了再返聘,
不过 18G 的磁盘空间,估计将来就是鸡肋了,现在的那些鸟人,用 pop 还都习惯什么都存在服
...

单做为邮件服务器,这个配置我想也够了!呵呵

论坛徽章:
0
7 [报告]
发表于 2007-07-18 10:30 |只看该作者
好文章,先做个记号,等一下拿我们那个返聘的sun 220R试一下,虽然现在一直用Exchange,还是很怀念烂pc装sendmail,400个用户的日子的。
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP