A-A+

用Ubuntu架設防毒mail gateway

2008年11月05日 未分类 暂无评论 阅读 1 次
摘要:

用舊的PC架一台,防毒防垃圾郵件的郵件閘道器不會太難。
我的環境是一台ubuntu 710當主機,後端是Exchange 2007。架設至今沒出過大問題,該擋的都有擋到。是一個窮人版的mail gateway。

下面是我的安裝筆記
在 Ubuntu 710 安裝 Postfix (as gateway) + MailScanner + ClamAV + Spamassassin

環境
OS: Ubuntu 710
Mail Gateway: Postfix + MailScanner + ClamAV + Spamassassin
Internal Mail Server: Exchange Server, 內部 IP 為: 192.168.1.11
Primary MX: domain.com IN MX mail.domain.com. (MX 記錄指向 Mail Gateway)

安裝 Postfix, 並將 Postfix 設定成 Mail Gateway
sudo apt-get install postfix
sudo /etc/init.d/postfix stop
sudo gedit /etc/postfix/main.cf
----------------------------------------------------------------------------------------------
myhostname = mail.domain.com
mydomain = domain.com
myorigin = $mydomain
inet_interfaces = all
mydestination = $mydomain, localhost.$mydomain, localhost
local_recipient_maps = (空白)
networks_style = host
relay_domains = domain.com
transport_maps = hash:/etc/postfix/transport
append_at_myorigin = no
----------------------------------------------------------------------------------------------
sudo gedit /etc/postfix/transport
----------------------------------------------------------------------------------------------
Icon7inc.com smtp:[192.168.1.1]

sudo postmap /etc/postfix/transport
sudo /etc/init.d/postfix start

修改 NAT 配置, 將 tcp 25 指向 postfix_host:25。
從外部寄郵件到 someone@domain.com, 觀察 postfix 是否能 forward 給真正的 mail server (192.168.1.1)。
telnet 到 mail gateway 進行測試

安裝 ClamAV、Spamassassin、MailScanner
sudo apt-get install clamav spamassassin mailscanner

ClamAV 不太需要設定就會正常工作
修改下面設定值
sudo gedit /etc/ld.so.conf
#加入
/usr/local/lib
ldconfig
freshclam

設定MailScanner
sudo gedit /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 Scanning = yes
Virus Scanners = clamav
Use SpamAssassin = yes
SpamAssassin User State Dir = /var/spool/MailScanner/spamassassin
Sign Clean Message = no (不在信尾加註 “This message has been scanned…”)
----------------------------------------------------------------------------------------------
mkdir /var/spool/MailScanner/spamassassin
chown postfix:postfix /var/spool/MailScanner/*
vi /etc/postfix/main.cf
header_checks = regexp:/etc/postfix/header_checks
vi /etc/postfix/header_checks
/^Received:/ HOLD
sudo /etc/init.d/postfix stop
sudo /etc/init.d/mailscanner start

參考資料:安裝參考出處 http://www.howtoforge.com/postfix_antispam_mailscanner_clamav_ubuntu

标签:

给我留言

Copyright © 浩然东方 保留所有权利.   Theme  Ality 07032740

用户登录