2014-07-13 20:21:38
来 源
中存储网
Postfix
邮件服务器的配置 系统环境:rhel6-X86_64主机:server12.example.com (192.168.0.112)防火墙:iptables 禁用,selinux禁用状态系统依赖包:postfix、mysql、mysql-server、mysql

件服务器的配置

系统环境:rhel6-X86_64

主机:server12.example.com (192.168.0.112)

防火墙:iptables 禁用,selinux禁用状态

系统依赖包:postfixmysqlmysql-server、mysql-devel、php、php-mysql、dovecot-mysql、dovecot等,系你系统情况而定。

一、postfix+mysql

1、在这里先说说mysql的语法和用法吧!

1.1、安装mysql

[root@server12 ~]yum install mysql、mysql-server、mysql-devel -y

(依次为主包、服务包、开发包)

1.2、安装完mysql后,运行mysql_secure_installation进行初始密码的设置,按照提示,一步步走下去就可以了。

修改密码,使用mysqladmin

[root@server12 ~]# mysqladmin -uroot(-u制定用户) -pwestos(-p制定当前密码) password 123

[root@server12 ~]# mysql -uroot -p123  -h localhost(-u制定用户名、-p制定密码登录、-h制定登录到的mysql数据库服务器)

Welcome to the MySQL monitor.  Commands end with ; or g.

……

mysql>

mysql> show databases;

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

| Database           |

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

| information_schema |

| mysql              |

| postfix            |

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

3 rows in set (0.00 sec)

mysql> use mysql

(mysql的账户信息都保存在mysql数据库的user表中)

mysql>update user set password='westos' where user='root';(更改信息)

前一个user指user表,后一个指的是user表中的user列、password也是user表中的一个列,westos为设置root用户的新密码,以明文方式写入user表,如果要以加密方式写入的话,需要改为password=password('westos')。

mysql>create database postfix;(创建数据库)

mysql>use postfix;( 选择postfix库使用)

mysql> create table westos (

-> username varchar(25) not null,

-> password varchar(50) not null);

(westos表有两列,一列为username是可变化大小的25维字符数组,password是可变化大小的50维字符数组,not null指该列不能为空值)

Query OK, 0 rows affected (0.08 sec)

mysql> desc westos;

(查看刚刚建立的表格westos)

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

| Field    | Type        | Null | Key | Default | Extra |

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

| username | varchar(25) | NO   |     | NULL    |       |

| password | varchar(50) | NO   |     | NULL    |       |

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

2 rows in set (0.00 sec)

给表格插入数值

mysql> insert into westos values('bob','westos');

查找信息

mysql> select username,password(列) from westos(表) (where username='bob'(查找的条件));

删除信息

mysql> delete username,password(列) from westos(表) (where username='bob'(删除的条件));

删除表

mysql>drop westos;

删除数据库

mysql>drop postfix;

增加用户,可以更改mysql的user表信息,命令行

mysql> grant select,insert,update,delete on *.* to

user_1@"%" identified  by "123";

增加用户user_1、密码123、可以对所有数据库的所有表格(第一个*指所有库、第二个*指库的所有表格)都具有select,insert,update,delete权限,@“%”指可以在所有主机上登录该数据库。

重载mysql授权

mysql>flush privileges;

1.3、数据表的备份与恢复

cd /var/lib64/mysql默认存放数据库的目录(lib64是64位系统,32位系统为lib)

mysqldump -uroot -pwestos mysql>mysql.bak

将mysql这个数据库备份到了mysql.bak中

mysql -uroot -pwestos mysql < mysql.bak

将备份的数据导入到mysql中

1.4、忘记管理员root的密码解决方法

/etc/init.d/mysqld stop  关闭数据库

mysqld_safe –skip-grant-tables &

在后台以跳过安全授权的方式运行mysqld,可跳过 MySQL 的访问控制,任何人都可以在控制台以管理员的身份进入 MySQL 数据库。

mysql (登录mysql数据库)

更改root密码(命令见上面)

重启mysql数据库

/etc/init.d/mysql restart

2、postfix的升级

[root@server12 ~]# yum install db*-devel -y (升级需要)

[root@server12 ~]# yum install gcc -y(编译时需要gcc)

[root@server12 ~]# tar -zxf postfix-2.8.5.tar.gz

[root@server12 ~]# cd  postfix-2.8.5

[root@server12 postfix-2.8.5]# make -f Makefile.init makefiles 'CCARGS=-DHAS_MYSQL -I/usr/include/mysql' 'AUXLIBS=-L/usr/lib64/mysql -lmysqlclient -lz -lm'

加入mysql模块支持(具体命令查看README_FILES目录下的帮助文档)

[root@server12 postfix-2.8.5]# make upgrade (升级)

[root@server12 postfix-2.8.5]# /etc/init.d/postfix restart (重启postfix服务)

[root@server12 postfix-2.8.5]# postconf mail_version

(查看postfix的版本)

mail_version = 2.8.5

(新的版本,升级成功)

[root@server12 postfix-2.8.5]# postconf -m | grep mysql

mysql(支持mysql模块)

3、建立数据库postfix,表格email,后面检测用

mysql> grant all on postfix.* to email@"%" identified by "email"

(给email用户授权)

flush privileges;  (刷新授权表)

mysql> use postfix;

mysql> create table email ( username varchar(30) not null, password varchar(30) not null, domain varchar(30) not null, maildir varchar(30) not null);

mysql> insert into email values('test@westos.org','westos','westos.org','westos.org/test');

4、postfix与mysql建立连接

[root@server12 ~]# useradd -u 600 -s /sbin/nologin email (添加用户email、uid为600、不能登录系统)

[root@server12 ~]# postconf -e virtual_mailbox_base=/home/email(整个系统收件主目录)

[root@server12 ~]# postconf -e virtual_uid_maps=static:600

(静态方式uid为600的用户,即email用户、email组)

[root@server12 ~]# postconf -e virtual_gid_maps=static:600 (静态方式gid为600的用户)

[root@server12 ~]# postconf -e virtual_alias_maps=mysql:/etc/postfix/mysql-alias.cf

注意一会配置文件的命名要一致、别名的配置文件

[root@server12 ~]# postconf -e virtual_mailbox_domains=mysql:/etc/postfix/mysql-domains.cf

域的配置文件

[root@server12 ~]# postconf -e virtual_mailbox_maps=mysql:/etc/postfix/mysql-mailbox.cf

4.1、postfix收件的配置

[root@server12 ~]# postconf -e myhostname=mail.extmail.org

[root@server12 ~]# postconf -e mydomain=extmail.org

[root@server12 ~]# postconf -e myorigin=$mydomain

[root@server12 ~]# postconf -e inet_interfaces=all

[root@server12 ~]# postconf -e  mydestination=$myhostname, $mydomain, localhost, localhost

收件的主目录

写配置文件,参考 /var/www/extsuite/extman/docs

的三个文档模板

[root@server12 ~]# vim /etc/postfix/mysql-alias.cf

hosts = localhost

使用本地数据库(本机)

user = email

用户为postfix(使用数据库的用户)

password = email

密码为postfix

dbname = postfix

使用postfix数据库

table = email

查找email表

select_field = username

(查找username这个列)

where_field = username

(条件是等于用户名)

[root@server12 ~]# vim /etc/postfix/mysql-domains.cf

hosts = localhost

user = email

password = email

dbname = postfix

table = email

select_field = domain

where_field = domain

[root@server12 ~]# vim /etc/postfix/mysql-mailbox.cf

hosts = localhost

user = email

password = email

dbname = postfix

table = email

select_field = maildir

where_field = username

5、检验postfix与mysql的连接

[root@server12 ~]# postmap -q "test@westos.org" mysql:/etc/postfix/mysql-alias.cf

test@westos.org

[root@server12 ~]# postmap -q "westos.org" mysql:/etc/postfix/mysql-domains.cf

westos.org

[root@server12 ~]# postmap -q "test@westos.org" mysql:/etc/postfix/mysql-mailbox.cf

westos.org/test

配置成功

二、postfix+mysql+extmai

1、安装extmail

[root@server12 www]# tar -zxf extmail-1.2.tar.gz -C /var/www/(-C制定解压到的路径)

[root@server12 www]# tar -zxf extman-1.1.tar.gz

-C /var/www/

[root@server12 www]# mv extmail-1.2/ extmail

(改名)

[root@server12 www]# mv extman-1.1/ extman

(改名)

[root@server12 www]# mkdir extsuite

(创建目录)

[root@server12 www]# mv extma* extsuite/

(创建目录)

2、导入数据库

[root@server12 docs]# pwd

(注意目录)

/var/www/extsuite/extman/docs

[root@server12 docs]# vim init.sql

(导入数据前将密码改成明文的方式,方便后面的验证)

找到INSERT INTO `mailbox` VALUES将那串md5加密的字符串改成一个普通的字符串,

此处,我该为了westos

找到INSERT INTO `manager` VALUES 同样地方改为westos

[root@server12 docs]# mysql -uroot -p < extmail.sql

Enter password:

[root@server12 docs]# mysql -uroot -p < init.sql

Enter password:

(顺序不能变,先导入数据库,再插入数据)

3、安装phpMyAdmin(在浏览器中以图形方式管理mysql)

[root@server12 ~]# cd /var/www/html

[root@server12 html]# tar -jxf phpMyAdmin-2.11.3-all-languages.tar.bz2

[root@server12 html]# mv phpMyAdmin-2.11.3-all-languages phpMyAdmin

[root@server12 html]# cd phpMyAdmin

[root@server12 phpMyAdmin]# cp config.sample.inc.php config.inc.php

[root@server12 phpMyAdmin]# vim config.inc.php

$cfg['blowfish_secret'] = 'westos';    (‘westos’可以用任意字符串替代)

在本机浏览器输入localhost/phpMyAdmin就可以登录访问mysql数据库了

4、extmail的配置

[root@server12 docs]# pwd

/var/www/extsuite/extman/docs

[root@server12 docs]# cp mysql_virtual_alias_maps.cf /etc/postfix/mysql-alias.cf

[root@server12 docs]# cp mysql_virtual_domains_maps.cf /etc/postfix/mysql-domains.cf

[root@server12 docs]# cp mysql_virtual_mailbox_maps.cf /etc/postfix/mysql-mailbox.cf

注:覆盖先前配置postfix下的文件,这样就可以不改postfix的配置了

[root@server12 ~]# vim /etc/postfix/mysql-alias.cf

user = extmail

(使用mysql的用户)

password = extmail

(该用户的密码)

hosts = localhost

(使用的mysql数据库服务器地址)

dbname = extmail

(数据库名)

table = alias

(表格)

select_field = goto

(查询的列)

where_field = address

(条件)

additional_conditions = AND active = '1'

(激活状态)

[root@server12 ~]# vim /etc/postfix/mysql-domains.cf

user = extmail

password = extmail

hosts = localhost

dbname = extmail

table = domain

select_field = domain

where_field = domain

additional_conditions = AND active = '1'

[root@server12 ~]# vim /etc/postfix/mysql-mailbox.cf

ser = extmail

password = extmail

hosts = localhost

dbname = extmail

table = mailbox

select_field = maildir

where_field = username

additional_conditions = AND active = '1'

5、重启数据库,检验下

[root@server12 ~]# /etc/init.d/mysqld restart

[root@server12 ~]# /etc/init.d/postfix restart

[root@server12 postfix]# postmap -q "support@extmail.org" mysql:/etc/postfix/mysql-alias.cf

postmaster@extmail.org

[root@server12 postfix]# postmap -q "postmaster@extmail.org" mysql:/etc/postfix/mysql-mailbox.cf

extmail.org/postmaster/Maildir/

[root@server12 postfix]# postmap -q "extmail.org" mysql:/etc/postfix/mysql-domains.cf

extmail.org

[root@server12 docs]# mail support@extmail.org (给support*用户发送邮件)

Subject: hello

你好!

EOT

[root@server12 docs]# cd /home/email/extmail.org/postmaster/Maildir/new/

[root@server12 new]# cat 1316242962.Vfd02I8015M695702.server12.example.com(查看邮件)

Return-Path: <root@server12.example.com>

X-Original-To: support@extmail.org

Delivered-To: postmaster@extmail.org

Received: by server12.example.com (Postfix, from userid 0)

id 8D676109F6; Sat, 17 Sep 2011 15:02:42 +0800 (CST)

Date: Sat, 17 Sep 2011 15:02:42 +0800

To: support@extmail.org

Subject: hello

User-Agent: Heirloom mailx 12.4 7/29/08

MIME-Version: 1.0

Content-Type: text/plain; charset=utf-8

Content-Transfer-Encoding: 8bit

Message-Id: <20110917070242.8D676109F6@server12.example.com>

From: root@server12.example.com (root)

你好!

配置成功。

6、通过httpd(或者nginx)发布extmail邮件系统

6.1、配置虚拟主机

[root@server12 html]# vim /etc/httpd/conf/httpd.conf(可以参考extmail中INSTALL)

NameVirtualHost *:80     (虚拟主机选项打开)

<VirtualHost *:80>

DocumentRoot /var/www/html

ServerName server12.example.com

(主server)

</VirtualHost>

<VirtualHost *:80>

ServerName mail.extmail.org     (邮件服务器server)

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

SuexecUserGroup email email

(执行的用户和组)

</VirtualHost>

6.2、更改cgi脚本所属用户和组

[root@server12 html]# chown email.email /var/www/extsuite/extmail/cgi -R(-R递归)

[root@server12 html]# chown email.email /var/www/extsuite/extman/cgi -R

(-R递归,email用户就是刚在httpd.conf中的用户和组)

6.3、更改两个配置文件

[root@server12 extsuite]# pwd

/var/www/extsuite

[root@server12 extsuite]# mv extmail/webmail.cf.default extmail/webmail.cf

[root@server12 extsuite]# vim extmail/webmail.cf

SYSLOG_ON = 0

SYS_MAILDIR_BASE  =  /home/email

SYS_CRYPT_TYPE =  plain

SYS_MYSQL_USER  =  extmail

SYS_MYSQL_PASS  =  extmail

[root@server12 extsuite]# mv extmail/webman.cf.default extman/webman.cf

[root@server12 extsuite]# vim extman/webman.cf

SYS_MAILDIR_BASE = /home/email

SYS_SESS_DIR = /tmp/

SYS_CRYPT_TYPE = plain

SYS_CAPTCHA_ON  = 0

SYS_MYSQL_USER = extmail

SYS_MYSQL_PASS =  extmail

6.4、重启服务

[root@server12 extsuite]# /etc/init.d/postfix restart

[root@server12 extsuite]# /etc/init.d/mysqld restart

[root@server12 extsuite]# /etc/init.d/httpd restart

6.5、在浏览器中访问

[root@server12 ~]# yum install perl-CGI -y

(让浏览器支持)

[root@server12 ~]# vim /etc/hosts      (添加一条解析)

192.168.0.112   mail.extmail.org

三、postfix+mysql+dovecot+extmai

1、重新安装升级postfix,因为前面的postfix没有添加sasl以及tls加密支持,所以要重新升级。

另外系统依赖crypt-sasl 、crypt-devel、openssl、openssl-devel、dovecot-mysql,一般*-devel一般都是开发包,里面的库函数一般都在/usr/include/*,这个库函数在源码编译时需要用到

[root@server12 postfix-2.8.5]# make -f Makefile.init makefiles 'CCARGS=-DHAS_MYSQL -I/usr/include/mysql -DUSE_SASL_AUTH -DUSE_CYRUS_SASL -I/usr/include/sasl -DUSE_TLS -I/usr/include -DUSE_TLS' 'AUXLIBS=-L/usr/lib64/mysql -lmysqlclient -lz -lm -L/usr/lib64 -lsasl2 -lssl -lcrypto'

[root@server12 postfix-2.8.5]# make upgrade

[root@server12 postfix-2.8.5]# postconf -a

cyrus

dovecot

成功

1.1、配置一下dovecot确认一下收信吧
[root@server12 conf.d]# vim /etc/dovecot/conf.d/10-mail.conf

mail_location  =  maildir:/home/email/%d/%n/Maildir

first-valid_uid  =  600

[root@server12 dovecot]# cp /usr/share/doc/dovecot-2.0/example-config/dovecot-sql.conf.ext /etc/dovecot/                 (拷贝模板)

[root@server12 dovecot]# vim /etc/dovecot/dovecot-sql.conf.ext

driver = mysql

connect  =  host=localhost  dbname=extmail  user=extmail  password=extmail

default_pass_scheme = plain

password_query = SELECT  username,domain,password FROM  mailbox  WHERE  username  = '%u'

user_query = SELECT  maildir,600 AS uid,600 AS gid FROM mailbox  WHERE username  =   '%u'

1.2、检测一下收件

[root@server12 conf.d]# mv auth-sql.conf.ext auth-sql.conf

[root@server12 dovecot]# yum install telnet -y

[root@server12 conf.d]# telnet localhost 110

Trying 127.0.0.1...

Connected to localhost.

Escape character is '^]'.

+OK Dovecot ready. <1c5b.1.4e7487ee.x3jsUdfcun5Izk4z+   +aD7A==@server12.example.com>

user postmaster@extmail.org

+OK

user westos

+OK

Logged in.

1.3、雷鸟收发邮件

[root@server12 conf.d]# mv auth-sql.conf.ext auth-sql.conf

2、dovecot sasl认证方式的配置(注postfix的配置有些和默认设置一致,就不显示了)

2.1、先配置postfix对dovecot sasl验证方式的支持

smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated , permit_tls_clientcerts , reject_unauth_destination

smtpd_sasl_auth_enable = yes

smtpd_sasl_authenticated_header = yes

smtpd_sasl_path = private/auth

smtpd_sasl_type = dovecot

broken_sasl_auth_clients = yes

附:除了dovecot sasl验证方式外,还可以用cyrus sasl验证方式

方法如下:

1. postconf  -e smtpd_sasl_auth_enable=yes

2. postconf -e smtpd_sasl_authenticated_header=yes

3. postconf -e broken_sasl_auth_clients=yes

4. postconf -e smtpd_sasl_type=cyrus

(和上面相比,有改变)

5. postconf -e smtpd_sasl_path=smtpd

(有改变)

6. postconf -e “smtpd_recipient_restrictions=permit_sasl_authenticated,

permit_tls_clientcerts,permit_mynetworks, reject_unauth_destination”

还需要改配置文件

[root@server12 sasl2]# vim /etc/sasl2/smtpd.conf

(参考/root/postfix-2.8.5/README_FILES)

pwcheck_method: auxprop

auxprop_plugin: sql

mech_list: plain login

sql_hostnames: localhost

sql_user: extmail

sql_passwd: extmail

sql_database: extmail

sql_statement: select password from mailbox where username = '%u@%r'

sql_verbose: yes

注意:  dovecot sasl and cyrus sasl 二选一!

2.2配置postfix对tls加密方式传输的支持

[root@server12 postfix-2.8.5]# cd /etc/pki/tls/certs/

[root@server12 certs]# make mail.pem         (生成key文件)

smtpd_tls_cert_file = /etc/pki/tls/certs/mail.pem

(指定证书文件)

smtpd_tls_received_header = yes

smtpd_tls_security_level = may

(may表示是否加密有客户端选择)

smtpd_tls_session_cache_database = btree:/var/lib/postfix/smtpd_tls_session_cache.db

[root@server12 conf.d]# vim 10-master.conf

unix_listener  /var/spool/postfix/private/auth {

mode  =  0666

user = postfix

group  =  postfix

}

[root@server11 ~]# /etc/init.d/dovecot  restart

[root@server12 conf.d]# ll /var/spool/postfix/private/auth

(确认生成认证目录)

srw-rw-rw- 1 postfix postfix 0 Sep 17 20:15 /var/spool/postfix/private/auth

[root@server12 ~]# perl -MMIME::Base64 -e 'print encode_base64("postmaster@extmail.orgwestos");'

AHBvc3RtYXN0ZXJAZXh0bWFpbC5vcmcAd2VzdG9z

(给postmaster*密码为westos用户生成key)

验证:

[root@server12 conf.d]# telnet localhost 25

Trying 127.0.0.1...

Connected to localhost.

Escape character is '^]'.

220 server12.example.com ESMTP Postfix

ehlo server12.example.com

250-server12.example.com

250-PIPELINING

250-SIZE 10240000

250-VRFY

250-ETRN

250-STARTTLS

250-AUTH PLAIN

250-AUTH=PLAIN

250-ENHANCEDSTATUSCODES

250-8BITMIME

250 DSN

auth plain AHBvc3RtYXN0ZXJAZXh0bWFpbC5vcmcAd2VzdG9z

235 2.7.0 Authentication successful

整个邮件系统就算是搭好了,用雷鸟测试一下

三、扩展模块

1、开启日志功能

[root@server12 ~]# vim /var/www/extsuite/extmail/webmail.cf

SYS_LOG_ON = 1  (开启)

SYS_LOG_TYPE = syslog

(如果类型为file,就得添加模块,syslog类型很方便,直接日志都保存到/var/log/message)

[root@server12 ~]# tar -zxf Unix-Syslog-1.1.tar.gz

[root@server12 ~]# cd Unix-Syslog-1.1

[root@server12 Unix-Syslog-1.1]# perl Makefile.PL

Can't locate ExtUtils/MakeMaker.pm in @INC (@INC contains: /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .) at Makefile.PL line 1.

BEGIN failed--compilation aborted at Makefile.PL line 1.

[root@server12 File-Tail-0.99.3]# yum install perl-ExtUtils-MakeMaker

[root@server12 File-Tail-0.99.3]# perl Makefile.PL

[root@server12 Unix-Syslog-1.1]# make test && make install

2、加入后台验证码、避免恶意注册、和暴力破解密码

首先,确保perl-GD安装了这款画图软件,然后修改配置文件就可以了

[root@server12 ~]# yum install perl-GD -y

[root@server12 ~]# cd  /var/www/exsuite/extman

[root@server12 extman]# vim webman.cf

SYS_CAPTCHA_ ON  =  1   (1表示开启验证码功能)

SYS_CAPTCHA_LEN  =  6     (6就是默认的6位验证码)

[root@server12 extman]# /etc/init.d/httpd restart

3、后台添加虚拟域,及可以让用户注册以非extmail.org结尾的用户名。

[root@server12 ~]# vim /var/www/exsuite/extman/webman.cf

SYS_MYSQL_USER = root  (数据库管理员身份)

SYS_MYSQL_PASS =  westos

这样extmail后台即管理员就可以添加新的域,从而控制是否开放虚拟域给用户注册了。

4、图形化监控邮件服务器的状态、性能。

需要安装三款软件

[root@server12 extman]# yum install rrdtool-perl perl-Time-HiRes -y

(yum仓库自带)

[root@server12 ~]# tar -zxf File-Tail-0.99.3.tar.gz(下载源码编译安装)

[root@server12 ~]# cd File-Tail-0.99.3

[root@server12 File-Tail-0.99.3]# perl Makefile.PL

[root@server12 File-Tail-0.99.3]# make && make test && make install

[root@server12 ~]# cp -r /var/www/extsuite/extman/addon/mailgraph_ext/ /usr/local/

(该路径在PATH里面,可以直接执行)

[root@server12 ~]# /usr/local/mailgraph_ext/mailgraph-init start  (启动画图程序)

OK

四、反垃圾邮件、反病毒系统

4.1、安装反垃圾邮件系统

[root@server12 ~]# yum install spamassassin -y

添加中文过滤规则(参考http://www.ccert.edu.cn/spam/sa/Chinese_rules.htm)

[root@server12 ~]# wget -N -P /usr/share/spamassassin     (-P制定下载路径) www.ccert.edu.cn/spam/sa/Chinese_rules.cf (网址)

[root@server12 ~]# /etc/init.d/spamassassin start   (开启服务)

4.2、反病毒系统

安装f-prot(官网www.f-prot.org)

[root@server12 ~]# tar -zxf fp-Linux-i686-ws.tar.gz -C /usr/local

[root@server12 ~]# cd /usr/local/f-prot/

[root@server12 f-prot]# ./install-f-prot.pl

[root@server12 f-prot]# ./fpupdate

(更新病毒库)

-bash: ./fpupdate: /lib/ld-linux.so.2: bad ELF interpreter: No such file or directory

[root@server12 f-prot]# yum install /lib/ld-linux.so.2 -y

[root@server12 f-prot]# ./fpupdate

4.3、安装自动扫描

[root@server12 ~]# tar -zxf MailScanner-4.84.3-1.rpm.tar.gz

[root@server12 ~]# cd MailScanner-4.84.3-1

[root@server12 MailScanner-4.84.3-1]# yum install rpm-build

-y

[root@server12 MailScanner-4.84.3-1]# rpmbuild

[root@server12 MailScanner-4.84.3-1]# ./install.sh

修改配置文件

[root@server12 ~]# mkdir /var/spool/MailScanner/spamssassin

[root@server12 ~]# chown postfix.postfix /var/spool/MailScanner/*

(所属用户所属组)

[root@server12 ~]# vim /etc/MailScanner/MailScanner.conf

Run As User = postfix

Run As Group = postfix

Incoming Queue Dir = /var/spool/postfix/hold

Outgoing Queue Dir = /var/spool/postfix/incoming

MTA = postfix

Virus Scanners = f-prot

Always Include Spamassassin Report = yes

Use Spamassassin = yes

SpamAssassin User State Dir = /var/spool/MailScanner/spamassassin

[root@server12 ~]# echo  /^Received:/  HOLD  >>/etc/postfix/header_checks

[root@server12 ~]# postmap /etc/postfix/header_checks

(创建数据库)

[root@server12 MailScanner]# vim /etc/postfix/main.cf

header_checks = regexp:/etc/postfix/header_checks

(保证选项打开)

(make sure uncomment header_checks in /etc/postfix/main.cf)

[root@server12 ~]# /etc/init.d/postfix stop

Shutting down postfix:                                     [  OK  ]

[root@server12 ~]# chkconfig postfix off

[root@server12 ~]# /etc/init.d/MailScanner start

Starting MailScanner daemons:

incoming postfix:                                 [  OK  ]

outgoing postfix:                                  [  OK  ]

MailScanner:                                        [  OK  ]

[root@server12 ~]# chkconfig MailScanner on

4.3.1测试一下,附件中包含病毒(http://www.eicar.org上下载测试病毒)

声明: 此文观点不代表本站立场;转载须要保留原文链接;版权疑问请联系我们。