歡迎您光臨本站 註冊首頁

CentOS5.4 postfix dovecot sasl openwebmail配置手記

←手機掃碼閱讀     火星人 @ 2014-03-09 , reply:0
最近接觸了一套新的郵件系統,使用的是Postfix的. 以前不太熟悉,照著單位的文檔和網上的教程,加上一些自己的修改就形成了這個文檔. 2010年7月7日---在新的機器上重新部署的時候發現MailScanner進程CPU佔用率很高,重啟依舊,而且還會報錯. 照著第四個參考鏈接修改了一下MailScanner和virus.scanners的配置文件就沒事了. 抽空還要研究一下讓郵件改用nod32. 真的很複雜啊. 過程基本都用yum的方式,需要用到rpmforge和openwebmail的源. 參考連接如下:
http://linux.chinaitlab.com/administer/774651.html
http://blog.chinaunix.net/u/10047/showart_311977.html
http://ciscolj.blog.51cto.com/330452/167427http://bbs.chinaunix.net/viewthread.php?tid=1033019
具體步驟如下: 1. 修改主機名
#vi /etc/sysconfig/network
HOSTNAME=mail.ywtest.com
#hostname mail.ywtest.com
2. 安裝配置DNS
#yum install bind bind-chroot caching-nameserver
DNS具體配置方法參考:
http://linux.chinaitlab.com/administer/774651.html
#chkconfig named on
#service named restart
#vi /etc/resolv.conf
3. 安裝Postfix、dovecot、openwebmail
#cd /etc/yum.repos.d
#lftpget http://openwebmail.org/openwebmail/download/redhat/rpm/release/openwebmail.repo
#yum install postfix dovecot openwebmail
4. 配置dovecot
#vi /etc/dovecot.conf
dovecot具體配置方法參考:
http://linux.chinaitlab.com/administer/774651_4.html
#chkconfig dovecot on
#service dovecot restart
5. 配置Postfix
#service sendmail stop
#chkconfig sendmail off
#chkconfig postfix on
#service postfix start
#alternatives --config mta
#vi /etc/postfix/main.cf
修改或添加下列內容:(這些都是基本配置,其他關於sasl、收信發信過濾的配置以後還要多學習.)


myhostname = mail.ywtest.com
mydomain = ywtest.com
myorigin = $mydomain (= $myhostname也可以)
inet_interfaces = all
mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain,mail.$mydomain, www.$mydomain, ftp.$mydomain
mail_spool_directory = /var/spool/mail
mailbox_command = /usr/bin/procmail (修改procmail的許可權,g s.在/etc/procmailrc中加入LOGFILE=/var/log/mail/procmail.log,修改mail目錄的許可權.很多教程里都沒有關於procmail的配置;Postfix默認沒有指定郵件投遞程序,這個不做的話郵件能傳遞,不能被投遞.)
smtpd_banner = $myhostname ESMTP $mail_name ($mail_version) (自願添加)
#vi /etc/postfix/access 寫入mail.ywtest.com OK、ywtest.com OK、192.168.10 OK
#postmap /etc/postfix/access #smtpd_client_restrictions = permit_sasl_authenticated
#smtpd_recipient_restrictions = permit_mynetworks,permit_sasl_authenticated,reject_unauth_destination
6. 測試postfix、dovecot埠
#netstat -altpn|grep 25
#netstat -altpn|grep 110
#netstat -altpn|grep 143
#netstat -altpn|grep 993
#netstat -altpn|grep 995 PS:有必要修改iptables的配置,/etc/sysconfig/iptables.
7. 測試命令行方式的郵件收發
#echo "mail test"|mail -v -s "from root@ywtest.com at 20.30" user1@ywtest.com
#mutt -f pop://user1@ywtest.com (mutt可以收發郵件,具體用法不做解釋.)
8. 配置sasl
#vi /etc/sysconfig/saslauthd
修改或添加下列內容:
MECH=shadow
#chkconfig saslauthd on
#service saslauthd start
9. 配置openwebmail (個人不推薦使用,還是知名軟體例如horde、squirrelmail、roundcube比較靠譜.對比連接http://www.extmail.org/forum/thread-440-1-1.html --老了點,呵呵.)
先要有httpd,不過默認的安裝就可以了,不多說了.
openwebmail具體配置方法參考:


http://linux.chinaitlab.com/administer/774651_4.html
#vi /var/www/cgi-bin/openwebmail/etc/openwebmail.conf
修改或添加下列內容:
domainnames ywtest.com
default_language zh_CN.GB2312
default_timeoffset 0800
default_iconset Cool3D.Chinese.Simplified
#vi /var/www/cgi-bin/openwebmail/etc/defaults/openwebmail.conf
修改或添加下列內容:
smtpserver 192.168.10.202
authpop3_server 192.168.10.202
#cd /var/www/cgi-bin/openwebmail
#./openwebmail-tool.pl --init
10.測試openwebmail
是rpm裝的ScriptAlias的配置已經自動添加了,裝了openwebmail之後記得重啟httpd.
瀏覽http://mail.ywtest.com/webmail即可. 11.安裝Mail-SpamAssassin
本來想和別人一樣用rpmbuild的方法安裝,但是提示找不到/var/tmp/下的一個文件,那個文件命名存在.
後來改用yum的方法了,不知道後面會有什麼問題.
#yum -y install spamassassin
#chkconfig spamassassin on
#service spamassassin start 12.安裝MailScanner和install-Clam-SA
#tar zxf MailScanner-4.51.5-1.rpm.tar.gz
#tar zxf install-Clam-SA.tar.gz
#cd MailScanner-4.51.5-1
#./install.sh
#cd ../install-Clam-SA
#./install.sh
時間真的很長.
具體參考:
http://ciscolj.blog.51cto.com/330452/167427 13.配置
#vi /etc/mail/spamassassin/init.pre
取消下面插件的註釋,如果有的話:
loadplugin Mail::SpamAssassin::Plugin::Razor2
#vi /etc/MailScanner/MailScanner.conf
修改或添加下列內容:
%org-name% = ywtest
%org-long-name% = ywtest
%web-site% = www.ywtest.com
Run As User = postfix
Run As Group = postfix
Incoming Work User = postfix
Incoming Work Group = postfix
Incoming Queue Dir = /var/spool/postfix/hold
Outgoing Queue Dir = /var/spool/postfix/incoming
Quarantine User = postfix
Quarantine Group = postfix


MTA = postfix
Virus Scanning = yes
Virus Scanners = clamav
參考鏈接:http://bbs.chinaunix.net/viewthread.php?tid=1033019 調整下列目錄許可權: #chown postfix.postfix mqueue -R #chown postfix.postfix mqueue.in/ -R #chown postfix.postfix MailScanner/ -R #chown postfix.postfix postfix/ -R
*.ywtest.com是我自己常用的測試用域名,不是真正能解析的. 其他:
訪問mail.ywtest.com直接看到openwebmail登陸界面:
創建opwebmail的虛擬主機:
NameVirtualHost *:80
<VirtualHost *:80>
ServerAdmin root@localhost
ServerName mail.ywtest.com
DocumentRoot "/usr/local/apache/htdocs/openwebmail"
Alias /data /usr/local/apache/data
ErrorLog "logs/mail.ywtest.com-error_log"
CustomLog "logs/mail.ywtest.com-access_log" combined
</VirtualHost>
#vi index.html 創建index.html頁面,內容如下:
<html>
<body onload=
"window.open('http://mail.ywtest.com/cgi-bin/openwebmail/openwebmail.pl','_top')">
</body>
</html>


[火星人 ] CentOS5.4 postfix dovecot sasl openwebmail配置手記已經有384次圍觀

http://coctec.com/docs/linux/show-post-50790.html