利用浏覽器通過web方式來收發電子郵件的服務或技術(WebMail),不需借助郵件客戶端,可以說只要能上網就能使用極大地方便了用戶對郵件的收發。對于不能熟練使用郵件客戶端, 或者在網吧不便使用郵件客戶端的用戶來說,WebMail更是必不可少的選擇。另外, 設定 pop3 server, smtp server 等對于某些使用者來說也有點困難。這時候 WebMail 就顯出它的好處了。 ebMail 就是使用者透過浏覽器連到web服務器, 而由 web server 上的程序負責作收信/送信的動作. 使用者直接透過 browser 作讀信/寫信等操作, 信件其實並不存在使用者的計算機上. 因此無論使用者用的是哪一部計算機, 只要可以連上網絡, 都可以使用讀到之前與新收到的信件。 另外一個好處是 WebMail 不容易因爲讀取含有病毒的檔案而導致中毒, 更不會發生個人郵件系統中毒後, 寄送大量病毒信件給其它親朋好友的這種慘劇。
一、 軟件概述與下載:
Email能夠成爲當今Internet上應用最廣泛的網絡服務,WebMail可謂功不可沒。 在linux下系統中MTA服務的軟件有許多,常用Sendmail、Qmail、Postfix等軟件,本文使用RHEL 4.0 + Postfix + dovecot + Apache + OpenWebMail制作一個集POP和WebMail等功能的電子郵件系統。下面講述如何把Linux機器配置成一個基于Web的電子郵件系統。這個電子郵件系統可以用于一個小團體或者組織之中。當然如果你家裏有一個互聯網連接(比如ADSL),那麽它也可以用安全的方式遠程檢測你的電子郵件。
Postfix是一個非常優秀的MTA,她素以高效、安全的特點而著稱。Postfix是作者在UNIX上所見過的MTA中在反垃圾郵件(Anti-Spam或Anti-UCE)方面做得最好的一個,甚至有很多公司在Postfix代碼的基礎上進行二次開發而推出反垃圾郵件網關産品。MTA的反垃圾郵件功能,實際上就是在MTA處理過程中對會話進行過濾。這個過濾不但過濾了發往自身的垃圾郵件,而且還防止了自身被惡意利用發送垃圾郵件。Postfix實現了目前所有主要的MTA過濾技術。postfix是Wietse Venema在IBM的GPL協議之下開發的MTA(郵件傳輸代理)軟件。和Sendmail相比Postfix更快、更容易管理、更靈活、更安全,同時還與sendmail保持足夠的兼容性。Sendmail相比Postfix對比見表1。
表1 Sendmail與Postfix的對比
Open Webmail 優點:良好的使用接口 、 多國語言 (目前共支持超過 30 種語言) 、 多組圖示,多組布景,可以依個人喜好自訂背景、 在線更改密碼 (必需記得原來的密碼)、 與 Outlook 接近的多媒體信件顯示能力 、 多種字集內碼自動轉換、 支援 HTML 信件編寫 、拼字檢查 (英文字典字數可能不足)、 支持草稿暫存 、 可動態切換寫信字集內碼、 POP3 外部郵件 、 郵件規則 (可建立過濾規則 ) 、 信件「搬移/複制/刪除/下載」功能、 信箱「 建立/重整/更名/刪除/下載」功能 、 通訊簿 、 全文檢索 、自動清除垃圾桶 N 天以上郵件。openwebmail缺點:由于openwebmail使用perl腳本語言編寫的,執行速度可能不如php。OpenWebmail主頁提供許多格式的軟件,請根據Linux發行版本選擇合適的軟件包。本文使用rpm格式。本文設定一台Linux服務器配域名:cao.net,ip地址:192.168.1. 253, 郵件主機:mail.cao.net。所有需要安裝的軟件:cyrus-sasl、dovecot、httpd 、perl-Text-Iconv、perl-suidperl、perl-ComPRess-Zlib、perl-CGI-SpeedyCGI 。其中Postfix、sendmail +cyrus-sasl+dovecot+httpd+perl在安裝系統時一起安裝。其他軟件需要進行下載:
#wget http://openwebmail.com/openwebmail/download/redhat/rpm/release/openwebmail-2.51-1.i386.rpm
#wget http://distro.ibiblio.org/pub/linux/distributions/startcom/ML-4.0.4/updates/i386/perl-suidperl-5.8.5-12.1.1.i386.rpm
#wget http://mirrors.ircam.fr/pub/dag/packages/perl-Text-Iconv/perl-Text-Iconv-1.4-1.2.el4.rf.i386.rpm
#wget http://ftp.belnet.be/packages/dries.ulyssis.org/redhat/el4/en/i386/RPMS.dries/perl-CGI-SpeedyCGI-2.22-1.2.el4.rf.i386.rpm
二、 postfix的安裝與啓動過程:
(1)殺掉所有Sendmail進程
#killall sendmail (停止所有的Sendmaail進程)
sendmail: no process killed
# rpm -ivh postfix-2.2.5-3.rhel4.i386.rpm
(2)啓動dovecot服務過程:
# service postfix start
Starting postfix: [ 確定 ]
# service dovecot start
啓動 Dovecot Imap: [ 確定 ]
現在可以使用郵件服務器發送郵件了,但是還不能下載郵件,因爲新版redhat Linux中 dovecot代替了imap軟件包,但是還沒有綁定POP3和POP協議,下面修改配置文件: /etc/dovecot.conf,
#protocols = imap imap3
protocols = imap imap3 pop3 pop3s
auth_passdb =
更改爲:
auth_passdb = shadow
然後重新啓動dovecot服務:
# service dovecot restart
停止 Dovecot Imap: [ 確定 ]
啓動 Dovecot Imap: [ 確定 ]
(3)修改postfix郵件服務器配置文件:
#myhostname = host.domain.tld
更改爲:
myhostname = mail.cao.net
#mydomain = domain.tld
更改爲:
mydomain = cao.net
#myorigin = $mydomain
更改爲:
Myorigin = cao.net
#inet_interfaces = all
更改爲:
Inet_interfaces =all
#mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain, mail.$mydomain, www.$mydomain, ftp.$mydomain
更改爲:
mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain, mail.$mydomain, www.$mydomain,
ftp.$mydomain
#mynetworks = host
更改爲:
mynetworks = host
(4)端口測試:
# telnet mail.cao.net 25 (測試25端口)
Trying 127.0.0.1...
Connected to localhost.localdomain (127.0.0.1).
Escape character is '^]'.
220 mail.cao.net ESMTP Postfix
quit
221 Bye
Connection closed by foreign host.
# telnet mail.cao.net 110 (測試110端口)
Trying 127.0.0.1...
Connected to localhost.localdomain (127.0.0.1).
Escape character is '^]'.
+OK dovecot ready.
quit
+OK Logging out
Connection closed by foreign host.
(5)安裝防範病毒軟件
F-Prot Antivirus軟件包安裝和配置過程:
Wegt http://files.f-prot.com/files/linux-x86/fp-linux-ws.rpm
安裝F-Prot Antivirus軟件包前,請先啓動SpamAssassin服務器:
Matt Sergeant、Craig Hughes和Justin Mason于發布的SpamAssassin(SA)。目前最新版本是3.0.2,它是較爲流行的反垃圾郵件軟件,據SpamAssassin供應商 Deersoft的統計,目前大約有3萬台Unix服務器上使用了SpamAssassin。SpamAssassin利用Perl語言來對郵件內容進行規則匹配,從而達到判斷過濾垃圾郵件的目的。它的判斷方式是基于評分的方式,也就是說如果這封郵件符合某條規則,則給與一定分值;當累計的分值超過了一定限度時,則判定該郵件爲垃圾郵件。對Sendmail、Qmail、Postfix和Exim等各種郵件平台都適用。SpamAssassin的安裝過程比較簡單。
# service spamassassin start (啓動SpamAssassin服務器)
Starting spamd: [ 確定 ]
# rpm -ivh fp-linux-ws.rpm (安裝F-Prot Antivirus軟件包)
升級的F-Prot Antivirus病毒庫的操作:
# cd /usr/local/f-prot/tools/
# ./check-updates.pl (升級命令)
***************************************
* F-Prot Antivirus Updater *
***************************************
Nothing to be done...
MailScanner軟件包安裝和配置過程:
Wegt http://www.sng.ecs.soton.ac.uk/mailscanner/downloads.shtml
# mv MailScanner-4.50.5-1.rpm.tar.gz /tmp/source/ (移動文件到/tmp/source/目錄中)
# cd /tmp/source/ (進入source目錄中)
# tar -zxvf MailScanner-4.50.5-1.rpm.tar.gz (MailScanner解壓過程)
# cd MailScanner-4.50.5-1 (進入MailScanner軟件解壓目錄)
# ./install.sh (執行MailScanner軟件的安裝命令)
更改incoming、quarantine兩個目錄相關用戶和組的使用權限:
# chown postfix.postfix /var/spool/MailScanner/incoming
# chown postfix.postfix /var/spool/MailScanner/quarantine
修改/etc/MailScanner/目錄下的MailScanner.conf文件,修改詳細內容以下:
詳細內容:
Run As User =
Run As Group =
更改爲:
Run As User = postfix
Run As Group = postfix
Incoming Queue Dir = /var/spool/mqueue.in
Outgoing Queue Dir = /var/spool/mqueue
更改爲:
Incoming Queue Dir = /var/spool/postfix/hold
Outgoing Queue Dir = /var/spool/postfix/incoming
MTA = sendmail
更改爲:
MTA = postfix
Virus Scanners = none
更改爲:
Virus Scanners = f-prot
Always Include SpamAssassin Report = no
更改爲:
Always Include SpamAssassin Report = yes
Use SpamAssassin = no
更改爲:
Use SpamAssassin = yes
Required SpamAssassin Score = 6
更改爲:
Required SpamAssassin Score = 4
SpamAssassin User State Dir =
更改爲:
SpamAssassin User State Dir = /var/spool/MailScanner/spamassassin
SpamAssassin Install Prefix =
更改爲:
SpamAssassin Install Prefix = /usr/bin
SpamAssassin Local Rules Dir =
更改爲:
SpamAssassin Local Rules Dir = /etc/MailScanner
修改/etc/postfix/目錄下的header_checks文件,新增加以下一行內容到文件中,詳細內容如下:
/^Received:/ HOLD
修改/etc/postfix/目錄下的main.conf文件,詳細內容如下:
#header_checks = regexp:/etc/postfix/header_checks
更改爲:
header_checks = regexp:/etc/postfix/header_checks
停止Postfix服務器,因爲啓動MailScanner服務時會自動啓動Postfix服務器:
啓動MailScanner服務器和設置開機時自動啓動:
# service MailScanner start
Starting MailScanner daemons:
incoming postfix: [ 確定 ]
outgoing postfix: [ 確定 ]
MailScanner: [ 確定 ]
# chkconfig --level 33 MailScanner on
(6)病毒檢測測試:
從網站(http://www.eicar.org/anti_virus_test_file.htm)下載一個測試病毒文件:eicar.com。編寫一封測試郵件(附件中帶上的eicar.com文件)。系統檢測到郵件病毒,見圖1。
圖1 病毒檢測界面
查看maillog日志,請確認日志中是否存在以下相近的信息:
詳細內容:
Jan 8 12:11:08 mail MailScanner[9199]: Virus Scanning: F-Prot found virus EICAR_Test_File
Jan 8 12:11:08 mail MailScanner[9199]: Virus Scanning: F-Prot found 1 infections
Jan 8 12:11:08 mail MailScanner[9199]: Infected message E73EE13C07C.07685 came from
Jan 8 12:11:08 mail MailScanner[9199]: Virus Scanning: Found 1 viruses
Jan 8 12:11:09 mail MailScanner[9199]: Requeue: A9D6413C085.39DDE to 6414713C089
Jan 8 12:11:09 mail MailScanner[9199]: Uninfected: Delivered 1 messages
如出現以上的日志信息就代表您的F-Prot Antivirus + MailScanner-4.31.6-1架設已經成功啦,
(7)如果希望郵件服務器每次啓動都能自動運行,可以用服務設置功能。以root權限運行命令:
#redhat-config-services
圖2 郵件服務器自動啓動
打開如圖2所示的窗口,在dovecot服務選項加上勾,然後重新啓動系統,這樣系統會啓動郵件服務。
三、 安裝配置Web郵件服務器
(1)軟件安裝
#rpm -ivh perl-5.8.5-12.1.i386.rpm
# rpm -ivh perl-CGI-SpeedyCGI-2.22-1.2.el4.rf.i386.rpm
# rpm -ivh perl-Compress-Zlib-1.34-1.2.el4.rf.i386.rpm
# rpm -ivh perl-suidperl-5.8.5-12.1.1.i386.rpm
# rpm -ivh perl-Text-Iconv-1.4-1.2.el4.rf.i386.rpm
# rpm -ivh openwebmail-2.51-1.i386.rpm
(2) 初始化配置文件
運行命令:
# /var/www/cgi-bin/openwebmail/openwebmail-tool.pl ――init
根據屏幕提示修改配置文件,見圖3。
圖3 屏幕提示要修改配置文件
(3)修改配置文件
#cd /var/www/cgi-bin/openwebmail/etc/
使用編輯器手工建立 dbm.conf文件,主要包括以下內容:
dbm_ext .db
dbmopen_ext .dbm
dbmopen_haslock no
(4)重新初始化配置文件
# /openwebmail-tool.pl –init
系統詢問是否發送站點包括選擇不發送(按「n」按鈕),見圖4。
圖4 重新初試化設定
(5)修改其他文件
把/var/www/cgi-bin/openwebmail/etc/openwebmail.conf 文件中字段:
# domainnames auto
更改爲:
domainnames cao.net #更改爲自己定義的域名#
default_language en
更改爲:
default_language zh_CN.GB2312 #更改爲簡體中文版介面#
把/var/www/cgi-bin/openwebmail/etc/defaults/openwebmail.conf文件中的字斷:
smtpserver 127.0.0.1
更改爲:
smtpserver 192.168.1.253 #更改smtp服務器的地址#
authpop3_server localhost
更改爲:
authpop3_server 192.168.1.253 #更改pop3服務器的地址#
把/var/www/cgi-bin/openwebmail/etc/defaults/dbm.conf文件中的字斷:
dbmopen_ext none
更改爲:
dbmopen_ext .db
dbmopen_haslock no
更改爲:
dbmopen_haslock yes
smtpserver 192.168.1.253 #添加smtp服務器的地址#
(6)再次運行openwebmail-tool.pl文件
然後在浏覽器輸入:http://localhost/var/www/cgi-bin/openwebmail/openwebmail.pl即刻進入見圖5。
圖5 openwebmai的登錄界面
至此,Webmail郵件服務器設定就完成了,下一篇文章將介紹郵件服務器主要配置和管理,敬請關注。
利用浏覽器通過web方式來收發電子郵件的服務或技術(WebMail),不需借助郵件客戶端,可以說只要能上網就能使用極大地方便了用戶對郵件的收發。對于不能熟練使用郵件客戶端, 或者在網吧不便使用郵件客戶端的用戶來說,WebMail更是必不可少的選擇。另外, 設定 pop3 server, smtp server 等對于某些使用者來說也有點困難。這時候 WebMail 就顯出它的好處了。 ebMail 就是使用者透過浏覽器連到web服務器, 而由 web server 上的程序負責作收信/送信的動作. 使用者直接透過 browser 作讀信/寫信等操作, 信件其實並不存在使用者的計算機上. 因此無論使用者用的是哪一部計算機, 只要可以連上網絡, 都可以使用讀到之前與新收到的信件。 另外一個好處是 WebMail 不容易因爲讀取含有病毒的檔案而導致中毒, 更不會發生個人郵件系統中毒後, 寄送大量病毒信件給其它親朋好友的這種慘劇。
一、 軟件概述與下載:
Email能夠成爲當今Internet上應用最廣泛的網絡服務,WebMail可謂功不可沒。 在linux下系統中MTA服務的軟件有許多,常用Sendmail、Qmail、Postfix等軟件,本文使用RHEL 4.0 + Postfix + dovecot + Apache + OpenWebMail制作一個集POP和WebMail等功能的電子郵件系統。下面講述如何把Linux機器配置成一個基于Web的電子郵件系統。這個電子郵件系統可以用于一個小團體或者組織之中。當然如果你家裏有一個互聯網連接(比如ADSL),那麽它也可以用安全的方式遠程檢測你的電子郵件。
Postfix是一個非常優秀的MTA,她素以高效、安全的特點而著稱。Postfix是作者在UNIX上所見過的MTA中在反垃圾郵件(Anti-Spam或Anti-UCE)方面做得最好的一個,甚至有很多公司在Postfix代碼的基礎上進行二次開發而推出反垃圾郵件網關産品。MTA的反垃圾郵件功能,實際上就是在MTA處理過程中對會話進行過濾。這個過濾不但過濾了發往自身的垃圾郵件,而且還防止了自身被惡意利用發送垃圾郵件。Postfix實現了目前所有主要的MTA過濾技術。postfix是Wietse Venema在IBM的GPL協議之下開發的MTA(郵件傳輸代理)軟件。和Sendmail相比Postfix更快、更容易管理、更靈活、更安全,同時還與sendmail保持足夠的兼容性。Sendmail相比Postfix對比見表1。
[url=/bbs/detail_1734688.html][img]http://image.wangchao.net.cn/it/1323601003625.jpg[/img][/url]
表1 Sendmail與Postfix的對比
Open Webmail 優點:良好的使用接口 、 多國語言 (目前共支持超過 30 種語言) 、 多組圖示,多組布景,可以依個人喜好自訂背景、 在線更改密碼 (必需記得原來的密碼)、 與 Outlook 接近的多媒體信件顯示能力 、 多種字集內碼自動轉換、 支援 HTML 信件編寫 、拼字檢查 (英文字典字數可能不足)、 支持草稿暫存 、 可動態切換寫信字集內碼、 POP3 外部郵件 、 郵件規則 (可建立過濾規則 ) 、 信件「搬移/複制/刪除/下載」功能、 信箱「 建立/重整/更名/刪除/下載」功能 、 通訊簿 、 全文檢索 、自動清除垃圾桶 N 天以上郵件。openwebmail缺點:由于openwebmail使用perl腳本語言編寫的,執行速度可能不如php。OpenWebmail主頁提供許多格式的軟件,請根據Linux發行版本選擇合適的軟件包。本文使用rpm格式。本文設定一台Linux服務器配域名:cao.net,ip地址:192.168.1. 253, 郵件主機:mail.cao.net。所有需要安裝的軟件:cyrus-sasl、dovecot、httpd 、perl-Text-Iconv、perl-suidperl、perl-ComPRess-Zlib、perl-CGI-SpeedyCGI 。其中Postfix、sendmail +cyrus-sasl+dovecot+httpd+perl在安裝系統時一起安裝。其他軟件需要進行下載:
#wget http://openwebmail.com/openwebmail/download/redhat/rpm/release/openwebmail-2.51-1.i386.rpm
#wget http://distro.ibiblio.org/pub/linux/distributions/startcom/ML-4.0.4/updates/i386/perl-suidperl-5.8.5-12.1.1.i386.rpm
#wget http://mirrors.ircam.fr/pub/dag/packages/perl-Text-Iconv/perl-Text-Iconv-1.4-1.2.el4.rf.i386.rpm
#wget http://ftp.belnet.be/packages/dries.ulyssis.org/redhat/el4/en/i386/RPMS.dries/perl-CGI-SpeedyCGI-2.22-1.2.el4.rf.i386.rpm
二、 postfix的安裝與啓動過程:
(1)殺掉所有Sendmail進程
#killall sendmail (停止所有的Sendmaail進程)
sendmail: no process killed
# rpm -ivh postfix-2.2.5-3.rhel4.i386.rpm
(2)啓動dovecot服務過程:
# service postfix start
Starting postfix: [ 確定 ]
# service dovecot start
啓動 Dovecot Imap: [ 確定 ]
現在可以使用郵件服務器發送郵件了,但是還不能下載郵件,因爲新版redhat Linux中 dovecot代替了imap軟件包,但是還沒有綁定POP3和POP協議,下面修改配置文件: /etc/dovecot.conf,
#protocols = imap imap3
protocols = imap imap3 pop3 pop3s
auth_passdb =
更改爲:
auth_passdb = shadow
然後重新啓動dovecot服務:
# service dovecot restart
停止 Dovecot Imap: [ 確定 ]
啓動 Dovecot Imap: [ 確定 ]
(3)修改postfix郵件服務器配置文件:
#myhostname = host.domain.tld
更改爲:
myhostname = mail.cao.net
#mydomain = domain.tld
更改爲:
mydomain = cao.net
#myorigin = $mydomain
更改爲:
Myorigin = cao.net
#inet_interfaces = all
更改爲:
Inet_interfaces =all
#mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain, mail.$mydomain, www.$mydomain, ftp.$mydomain
更改爲:
mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain, mail.$mydomain, www.$mydomain,
ftp.$mydomain
#mynetworks = host
更改爲:
mynetworks = host
(4)端口測試:
# telnet mail.cao.net 25 (測試25端口)
Trying 127.0.0.1...
Connected to localhost.localdomain (127.0.0.1).
Escape character is '^]'.
220 mail.cao.net ESMTP Postfix
quit
221 Bye
Connection closed by foreign host.
# telnet mail.cao.net 110 (測試110端口)
Trying 127.0.0.1...
Connected to localhost.localdomain (127.0.0.1).
Escape character is '^]'.
+OK dovecot ready.
quit
+OK Logging out
Connection closed by foreign host.
(5)安裝防範病毒軟件
F-Prot Antivirus軟件包安裝和配置過程:
Wegt http://files.f-prot.com/files/linux-x86/fp-linux-ws.rpm
安裝F-Prot Antivirus軟件包前,請先啓動SpamAssassin服務器:
Matt Sergeant、Craig Hughes和Justin Mason于發布的SpamAssassin(SA)。目前最新版本是3.0.2,它是較爲流行的反垃圾郵件軟件,據SpamAssassin供應商 Deersoft的統計,目前大約有3萬台Unix服務器上使用了SpamAssassin。SpamAssassin利用Perl語言來對郵件內容進行規則匹配,從而達到判斷過濾垃圾郵件的目的。它的判斷方式是基于評分的方式,也就是說如果這封郵件符合某條規則,則給與一定分值;當累計的分值超過了一定限度時,則判定該郵件爲垃圾郵件。對Sendmail、Qmail、Postfix和Exim等各種郵件平台都適用。SpamAssassin的安裝過程比較簡單。
# service spamassassin start (啓動SpamAssassin服務器)
Starting spamd: [ 確定 ]
# rpm -ivh fp-linux-ws.rpm (安裝F-Prot Antivirus軟件包)
升級的F-Prot Antivirus病毒庫的操作:
# cd /usr/local/f-prot/tools/
# ./check-updates.pl (升級命令)
***************************************
* F-Prot Antivirus Updater *
***************************************
Nothing to be done...
MailScanner軟件包安裝和配置過程:
Wegt http://www.sng.ecs.soton.ac.uk/mailscanner/downloads.shtml
# mv MailScanner-4.50.5-1.rpm.tar.gz /tmp/source/ (移動文件到/tmp/source/目錄中)
# cd /tmp/source/ (進入source目錄中)
# tar -zxvf MailScanner-4.50.5-1.rpm.tar.gz (MailScanner解壓過程)
# cd MailScanner-4.50.5-1 (進入MailScanner軟件解壓目錄)
# ./install.sh (執行MailScanner軟件的安裝命令)
更改incoming、quarantine兩個目錄相關用戶和組的使用權限:
# chown postfix.postfix /var/spool/MailScanner/incoming
# chown postfix.postfix /var/spool/MailScanner/quarantine
修改/etc/MailScanner/目錄下的MailScanner.conf文件,修改詳細內容以下:
詳細內容:
Run As User =
Run As Group =
更改爲:
Run As User = postfix
Run As Group = postfix
Incoming Queue Dir = /var/spool/mqueue.in
Outgoing Queue Dir = /var/spool/mqueue
更改爲:
Incoming Queue Dir = /var/spool/postfix/hold
Outgoing Queue Dir = /var/spool/postfix/incoming
MTA = sendmail
更改爲:
MTA = postfix
Virus Scanners = none
更改爲:
Virus Scanners = f-prot
Always Include SpamAssassin Report = no
更改爲:
Always Include SpamAssassin Report = yes
Use SpamAssassin = no
更改爲:
Use SpamAssassin = yes
Required SpamAssassin Score = 6
更改爲:
Required SpamAssassin Score = 4
SpamAssassin User State Dir =
更改爲:
SpamAssassin User State Dir = /var/spool/MailScanner/spamassassin
SpamAssassin Install Prefix =
更改爲:
SpamAssassin Install Prefix = /usr/bin
SpamAssassin Local Rules Dir =
更改爲:
SpamAssassin Local Rules Dir = /etc/MailScanner
修改/etc/postfix/目錄下的header_checks文件,新增加以下一行內容到文件中,詳細內容如下:
/^Received:/ HOLD
修改/etc/postfix/目錄下的main.conf文件,詳細內容如下:
#header_checks = regexp:/etc/postfix/header_checks
更改爲:
header_checks = regexp:/etc/postfix/header_checks
停止Postfix服務器,因爲啓動MailScanner服務時會自動啓動Postfix服務器:
啓動MailScanner服務器和設置開機時自動啓動:
# service MailScanner start
Starting MailScanner daemons:
incoming postfix: [ 確定 ]
outgoing postfix: [ 確定 ]
MailScanner: [ 確定 ]
# chkconfig --level 33 MailScanner on
(6)病毒檢測測試:
從網站(http://www.eicar.org/anti_virus_test_file.htm)下載一個測試病毒文件:eicar.com。編寫一封測試郵件(附件中帶上的eicar.com文件)。系統檢測到郵件病毒,見圖1。
[url=/bbs/detail_1734688.html][img]http://image.wangchao.net.cn/it/1323601018834.jpg[/img][/url]
圖1 病毒檢測界面
查看maillog日志,請確認日志中是否存在以下相近的信息:
詳細內容:
Jan 8 12:11:08 mail MailScanner[9199]: Virus Scanning: F-Prot found virus EICAR_Test_File
Jan 8 12:11:08 mail MailScanner[9199]: Virus Scanning: F-Prot found 1 infections
Jan 8 12:11:08 mail MailScanner[9199]: Infected message E73EE13C07C.07685 came from
Jan 8 12:11:08 mail MailScanner[9199]: Virus Scanning: Found 1 viruses
Jan 8 12:11:09 mail MailScanner[9199]: Requeue: A9D6413C085.39DDE to 6414713C089
Jan 8 12:11:09 mail MailScanner[9199]: Uninfected: Delivered 1 messages
如出現以上的日志信息就代表您的F-Prot Antivirus + MailScanner-4.31.6-1架設已經成功啦,
(7)如果希望郵件服務器每次啓動都能自動運行,可以用服務設置功能。以root權限運行命令:
#redhat-config-services
[url=/bbs/detail_1734688.html][img]http://image.wangchao.net.cn/it/1323601019111.jpg[/img][/url]
圖2 郵件服務器自動啓動
打開如圖2所示的窗口,在dovecot服務選項加上勾,然後重新啓動系統,這樣系統會啓動郵件服務。
三、 安裝配置Web郵件服務器
(1)軟件安裝
#rpm -ivh perl-5.8.5-12.1.i386.rpm
# rpm -ivh perl-CGI-SpeedyCGI-2.22-1.2.el4.rf.i386.rpm
# rpm -ivh perl-Compress-Zlib-1.34-1.2.el4.rf.i386.rpm
# rpm -ivh perl-suidperl-5.8.5-12.1.1.i386.rpm
# rpm -ivh perl-Text-Iconv-1.4-1.2.el4.rf.i386.rpm
# rpm -ivh openwebmail-2.51-1.i386.rpm
(2) 初始化配置文件
運行命令:
# /var/www/cgi-bin/openwebmail/openwebmail-tool.pl ――init
根據屏幕提示修改配置文件,見圖3。
[url=/bbs/detail_1734688.html][img]http://image.wangchao.net.cn/it/1323601021603.jpg[/img][/url]
圖3 屏幕提示要修改配置文件
(3)修改配置文件
#cd /var/www/cgi-bin/openwebmail/etc/
使用編輯器手工建立 dbm.conf文件,主要包括以下內容:
dbm_ext .db
dbmopen_ext .dbm
dbmopen_haslock no
(4)重新初始化配置文件
# /openwebmail-tool.pl –init
系統詢問是否發送站點包括選擇不發送(按「n」按鈕),見圖4。
[url=/bbs/detail_1734688.html][img]http://image.wangchao.net.cn/it/1323601021809.jpg[/img][/url]
圖4 重新初試化設定
(5)修改其他文件
把/var/www/cgi-bin/openwebmail/etc/openwebmail.conf 文件中字段:
# domainnames auto
更改爲:
domainnames cao.net #更改爲自己定義的域名#
default_language en
更改爲:
default_language zh_CN.GB2312 #更改爲簡體中文版介面#
把/var/www/cgi-bin/openwebmail/etc/defaults/openwebmail.conf文件中的字斷:
smtpserver 127.0.0.1
更改爲:
smtpserver 192.168.1.253 #更改smtp服務器的地址#
authpop3_server localhost
更改爲:
authpop3_server 192.168.1.253 #更改pop3服務器的地址#
把/var/www/cgi-bin/openwebmail/etc/defaults/dbm.conf文件中的字斷:
dbmopen_ext none
更改爲:
dbmopen_ext .db
dbmopen_haslock no
更改爲:
dbmopen_haslock yes
smtpserver 192.168.1.253 #添加smtp服務器的地址#
(6)再次運行openwebmail-tool.pl文件
然後在浏覽器輸入:http://localhost/var/www/cgi-bin/openwebmail/openwebmail.pl即刻進入見圖5。
[url=/bbs/detail_1734688.html][img]http://image.wangchao.net.cn/it/1323601022118.jpg[/img][/url]
圖5 openwebmai的登錄界面
至此,Webmail郵件服務器設定就完成了,下一篇文章將介紹郵件服務器主要配置和管理,敬請關注。