Postfix support

其他支援
cyrus-sasl:smtp認証, http://cyrusimap.web.cmu.edu/
dovecot:imap,imaps及pop3,pop3s支援,  http://www.dovecot.org/
qpopper:pop3支援, http://www.eudora.com/products/unsupported/qpopper/
imap:pop3支援
…………………………………………..
cyrus-sasl2

編譯cyrus-sasl建議
./configure
–prefix=/usr/local/cyrus-sasl2
–enable-login
–enable-plain
–enable-pwcheck
–with-saslauthd=/var/run
ps:cyrus會主動去找/usr/lib/sasl2/內的資料
所以若編譯到/usr/local/cyrus-sasl2下
則要進到/usr/lib,並執行ln -s /usr/local/cyrus-sasl2/lib/* .
ps:在原始檔目錄內執行make testsaslauthd,可產生testsaslauthd
這可測試sasl是否成功啟動
ps:若以rpm安裝,需要cyrus-sasl,cyrus-sasl-devel,cyrus-sasl-plain,等套件

設定方式
1
設定sasl2,在smtpd.conf內加入以下兩項
 pwcheck_method: saslauthd  //使用saslauthd這個daemon進行認證的工作
 mech_list: plain login  //列出支援的認證機制,使用login與plain兩種機制
ps:smtpd.conf通常在此目錄下/usr/lib/sasl2/
ps:Postfix預設使用SASL2的設定檔
2
設定postfix增加sasl2認證,在main.cf設定
smtpd_sasl_auth_enable = yes 
smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination
smtpd_sasl_security_options = noanonymous
3
設定實際使用的機制
在/etc/sysconfig/saslauthd設定
MECH=shadow
ps:mech可選pam或shadow

啟動方法
/usr/local/cyrus-sasl2/sbin/saslauthd -a shadow //啟動saslauthd
ps:saslauthd 的 PID 會被紀錄到 /var/run/mux.pid 這個檔案
ps:也可執行service saslauthd start啟動

ps:執行saslauthd這支程式,判斷sasl是否啟動會顯示0: OK “Success.”
testsaslauthd -u user -p ‘passwd’
ex:設root密碼是fedora
testsaslauthd -u root -p ‘fedora’
0: OK “Success.”

ps:postfix的main.cf
smtpd_sasl_auth_enable = yes//確定是否要針對 Client 啟動 sasl 的認證
smtpd_recipient_restrictions= option1, option2 ,… //信件收件的限制規則,option有以下
 permit_sasl_authenticated :允許使用者經過 SASL 的認證方式寄信
 reject_unauth_destination :通過一些測試之後的主機可以進行relay,用在sasl2
smtpd_client_restrictions= option1, option2 ,… //針對 client 端的限制規則,option和以上同
smtpd_sasl_security_options = option //限制某些登入的方式,option有以下
 noanonymous :取消掉匿名登入的型態
broken_sasl_auth_clients = yes //支援非正規的mua設定 ex:outlook4

……………………………………………
devecot

1設定
在/etc/dovecot.conf內設定
protocols = pop3
2啟動
/etc/init.d/dovecot restart或service dovecot start
……………..
imap

啟動
chkconfig –add ipop3
/etc/rc.d/init.d/xinetd restart
…………………………………………………………………………………………………………………………………………

其他補充

測試是否成功安裝
>telnet localhost 25
Trying 127.0.0.1…
Connected to localhost (127.0.0.1).
Escape character is ‘^]’.
220 localhost ESMTP Postfix
>ehlo localhost
250-localhost
250-PIPELINING
250-SIZE 10240000
250-VRFY
250-ETRN
250-AUTH PLAIN LOGIN  (支援sasl認證)
250-XVERP
250 8BITMIME

寄信測試
>telnet mailserverip 25   //mailserverip為郵件伺服器所在機器的ip
>mail from=root@localhost.localdomain  //localhost.localdomain為主機名稱
>rcpt to:user@localhost.localdomain   //localhost.localdomain為主機名稱
>data
>this is a test   //開始輸入訊息
>.             //用 . 表結束
若user有收到表示成功