打印

Linux邮件服务器配置

Linux邮件服务器配置

MailScanner + ClamAV + Spamassassin

TOP

一、       sendmail安装与配置.................................................................................... 1

二、       clamav的安装............................................................................................. 1

三、       SpamAssassin的安装与配置......................................................................... 3

四、       MailScanner的安装...................................................................................... 6

1.    安装perl组件....................................................................................... 6

2.    安装mailscanner................................................................................... 8

3.    安装clamav及spamassassin支持模块................................................... 8

4.    mailscanner.conf注解............................................................................ 8

五、       MailScanner-mrtg......................................................................................... 8

六、       附录.......................................................................................................... 10

1.    我的mailscanner.conf配置.................................................................. 10

2.    mailscanner.conf配置说明................................................................... 17



注:本文以redhat8.0为例

TOP

一、      sendmail安装与配置
sendmail安装较简单,这里不再赘述。

TOP

二、      clamav的安装
useradd -M clamav

# groupadd clamav

# useradd -g clamav -s /bin/false -c "Clam AntiVirus" clamav

tar -zxvf clamav-0.88.2.tar.gz

# cd clamav-0.88.2

# ./configure --sysconfdir=/etc

# make

# su -c "make install"
# vi /etc/clamd.conf  (在 Example 前面加 #)

# vi /etc/freshclam.conf (在 Example 前面加 #)

安裝後, 修改以下檔案:

/usr/local/etc/clamd.conf

/usr/local/freshclam.conf

將 Example 加上井字號註解掉 → #Example

執行 /usr/local/freshclam 測試是否能正常更新病毒定义码

crontab –e编辑更新计划:如每30分钟进行更新

*/30 * * * * /usr/local/bin/freshclam –quiet

TOP

Clamav (/usr/local/etc/clamd.conf )
配置文件解释:
# This option enables scanning of Microsoft Office document macros.
# Default: enabled
ScanOLE2                 打开office文档扫描

# Enable internal e-mail scanner.
# Default: enabled
ScanMail                 打开邮件扫描

# ClamAV can scan within archives and compressed files.
# Default: enabled

TOP

ScanArchive             扫描压缩包

# Due to license issues libclamav does not support RAR 3.0 archives (only the
# old 2.0 format is supported). Because some users report stability problems
# with unrarlib it's disabled by default and you must uncomment the directive
# below to enable RAR 2.0 support.
# Default: disabled
ScanRAR                 扫描RAR压缩包

# Files in archives larger than this limit won't be scanned.
# Value of 0 disables the limit.
# Default: 10M
ArchiveMaxFileSize 10M     最大扫描压缩包文件为10兆

# Nested archives are scanned recursively, e.g. if a Zip archive contains a RAR
# file, all files within it will also be scanned. This options specifies how
# deep the process should be continued.
# Value of 0 disables the limit.
# Default: 8

TOP

ArchiveMaxRecursion 9         扫描压缩包9层

# Number of files to be scanned within an archive.
# Value of 0 disables the limit.
# Default: 1000
ArchiveMaxFiles 1000         最多扫描压缩包内1500个文件

# Set access mask for Clamuko.
# Default: disabled
ClamukoScanOnOpen
ClamukoScanOnClose
ClamukoScanOnExec

# Don't scan files larger than ClamukoMaxFileSize
# Value of 0 disables the limit.
# Default: 5M
ClamukoMaxFileSize 10M

TOP

三、      SpamAssassin的安装与配置
下载最新版本:

http://apache.justdn.org/spamass ... assin-3.1.3.tar.bz2

rpmbuild -tb Mail-SpamAssassin-3.1.3.tar.bz2

安装生成的2个文件:

rpm –ivh perl-Mail-SpamAssassin-3.1.3-1.i386.rpm

rpm –ivh spamassassin-3.1.3-1.i386.rpm



       Spamassassin   (/etc/mail/spamassassin/local.cf ) 文件注释:

# SpamAssassin config file for version 3.x
# NOTE: NOT COMPATIBLE WITH VERSIONS 2.5 or 2.6
# See http://www.yrex.com/spam/spamconfig25.php for earlier versions
# Generated by http://www.yrex.com/spam/spamconfig.php (version 1.50)

# How many hits before a message is considered spam. 得分多少以上就会被判定为垃圾邮件。
required_hits       6.3

TOP

# Whether to change the subject of suspected spam. 在已判定的垃圾邮件之标题加上标记。( 如果是使用amaivsd来呼叫spamassass进行过滤的,请修改 Amavisd-new 的配置文件amavisd.conf 中的相应选项:$sa_spam_subject_tag = '***[ Junk Mail ]*** '; )
rewrite_header Subject ****SPAM(_SCORE_)****

# Encapsulate spam in an attachment.
# 要如何处理垃圾邮件。如果邮件还会经过防毒程序的扫描处理,所以必须设定为 0。
# 0:将信息写入邮件表头。
# 1:将垃圾邮件转为附件。
# 2:将垃圾邮件转为纯文字附件。
report_safe         0

# Use terse version of the spam report. 用精简的方式来回复垃圾邮件信息给管理者
use_terse_report     0

# Enable the Bayes system. 使用贝叶斯学习系统
use_bayes           1

# Enable Bayes auto-learning. 开启贝叶斯自动学习功能
auto_learn         1

# Enable or Disable network checks. 略过 RBLs 检查、使用 Razor version 2、使用 DCC (Distributed Checksum Clearinghouse)、使用 Pyzor
skip_rbl_checks       0
use_razor2         1
use_dcc           1
use_pyzor           1

# Blacklist. 黑名单,判定減 + 100 分
blacklist_from *@sohu.com *@mailfb.com

# Whitelist . 白名单,判定加 — 100 分
whitelist_from *@yahoo.com.tw *@yahoo.com.hk *@yahoogroups.com.hk
whitelist_from rika@rika.idv.tw

# Mail using languages used in these country codes will not be marked
# as being possibly spam in a foreign language.
# - chinese
ok_languages         zh en

# Mail using locales used in these country codes will not be marked
# as being possibly spam in a foreign language.
ok_locales         zh en

TOP

# Disabled scores. 防止中文主旨和中文收件者误判,建议再加上下列几行
score HEADER_8BITS 0
score HTML_COMMENT_8BITS 0
score SUBJ_FULL_OF_8BITS 0
score UPPERCASE_25_50 0
score UPPERCASE_50_75 0
score UPPERCASE_75_100 0

# local domain from but ip not match. 域名和 IP 不符合,疑为垃圾邮件
header __FROM_TEATIME Received =~ /from test.com.cn/i
header __FROM_TEATIME_IP Received =~ /[12.34.56.78]/
meta FROM_TEATIME_BUT_IP_ERROR (__FROM_TEATIME)
describe FROM_TEATIME_BUT_IP_ERROR From test.com.cn but ip not match
score FROM_TEATIME_BUT_IP_ERROR 8

score NO_REAL_NAME 4.000
score SPF_FAIL 10.000
score SPF_HELO_FAIL 10.000
score BAYES_99 4.300
score BAYES_90 3.500
score BAYES_80 3.000

TOP


感谢一直以来您对我们的支持!
当前时区 GMT+8, 现在时间是 2008-11-23 19:22 京ICP证060528 号

Designed By 17DST