close

作業環境】

FreeBSD 6.0-RELEASE-i386

cyrus-sasl-1.5.28_4

postfix-2.2.8_2,1


SETUP1.


cd /usr/ports/mail/postfix


//切換到安裝路徑

make install clean


//安裝並清除過程中不必要的檔案

訊息 Postfix configuration options選單時,選擇SASL、TLS、DB3等三個項目

[X] SASL Cyrus SASLv1 (Simple Authentication and Security Layer)
[X] TLS SSL and TLS
[X] DB3 Berkeley DB3 (required if SASL also built with DB3)


訊息 Additional SASL options選單時,只選擇DB3、PWCHECK

[X] DB3 Berkeley DB, revision 3
[X] PWCHECK Use pwcheck for password Authentication


安裝到一半尋問訊息:

You need user "postfix" added to group "mail".Would you like me to add it [y]? 我選y


訊息 Would you like to activate Postfix in /etc/mail/mailer.conf [n]?我選n
如果答yes的話要到/etc/rc.conf內亂加一堆,我選no等一下自己去修改mailer.conf

修改/usr/local/etc/postfix/main.cf內容如下

SETUP2.
設定主機收信網域-->新增SASL Auth設定


mydestination = $myhostname, localhost.$mydomain $mydomain //設定主機能收信的網域與主機名稱若沒設會收不到信哦
//新增下列五行以便執行SASL AUTH

smtpd_recipient_restrictions = permit_sasl_autheNticated,permit_mynetworks,check_relay_domains
smtpd_client_restrictions = permit_sasl_authenticated
smtpd_sasl_auth_enable= yes
smtpd_sasl_security_options= noanonymous
smtpd_sasl_local_domain = $myhostname


SETUP3.
主機sendmail 執行位置(/etc/mail/mailer.conf) 更改內容為如下



sendmail /usr/local/sbin/sendmail
send-mail /usr/local/sbin/sendmail
mailq /usr/local/sbin/sendmail
newaliases /usr/local/sbin/sendmail


SETUP4.
編輯別名設定檔

別名aliases的設定-->更新aliases.db


postmaster:root, gary //寄給postmaster會寄給root及gary
#newaliases //更新/etc/mail/aliases.db的內容

SETUP5.

啟動postfix

啟動Postfix前記得刪除sendmail執行程序


#/usr/local/sbin/postfix start //啟動postfix
reload //重新檢驗所有的設定檔是否更新

SETUP6.
SASL AUTH設定

因為使用 SASL 認證的方式,必須讓 postfix 帳號可以讀取 /usr/local/etc/sasldb 這個檔案,所以將 postfix 這個帳號加到 cyrus 群組中,讓 postfix 可以讀取 sasldb 檔案。


#vi /etc/group //編輯/etc/group檔內容如下
cyrus:*:60:postfix //將postfix加入cyrus群組內

編寫 SASL smtpd 的認證(/usr/local/lib/sasl/smtpd.conf若沒有就新增一個吧)


#cd /usr/local/lib/sasl //切換路徑
#vi smtpd.conf //編輯內容如下

pwcheck_method: pwcheck


SETUP7.

啟動pwcheck服務

切換路徑-->查看cyrus_pwcheck.sh內容-->啟動cyrus_pwcheck服務


#cd /usr/local/etc/rc.d //切換路徑
#less cyrus_pwcheck.sh //查看cyrus_pwcheck.sh內容
//確定有下面這一行
cyrus_pwcheck_enable="yes"
#/usr/local/etc/rc.d/cyrus_pwcheck.sh start //啟動 cyrus_pwcheck

SETUP8.
POP3 Server (隨便選一個pop3的軟體吧)

切換路徑-->安裝套件-->修改inetd.conf


cd /usr/ports/mail/qpopper

make

make install



把qpopper啟動路徑加入inetd.conf

vi /etc/inetd.conf

pop3  stream  tcp  nowait  root  /usr/local/libexec/qpopper  qpopper  -s


inetd 重跑指令

inetd -wW

測試110是否運作


#telnet localhost 110 //測試收信是否正常,Connection refused代表110並沒運作
Trying 127.0.0.1...
telnet: connect to address 127.0.0.1: Connection refused
telnet: Unable to connect to remote host
#/usr/sbin/inetd //啟動inetd服務(上述測試110未運作)
#telnet localhost 110 //代表110運作正常
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
+OK

SETUP9.測試SASL功能是否運作


#telnet localhost 25 //測試本機smtp auth功能是否運作(主機便出現如下訊息)
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
220 dns.jc104.idv.tw ESMTP Postfix
ehlo localhost //測試sasl(自行輸入)
250-dns.jc104.idv.tw
250-PIPELINING
250-SIZE 10240000
250-VRFY
250-ETRN
250-AUTH LOGIN PLAIN DIGEST-MD5 CRAM-MD5 //主機回應AUTH LOGIN成功
250-XVERP
250 8BITMIME
quit //離開(自行輸入)

arrow
arrow
    全站熱搜
    創作者介紹
    創作者 garyliuh 的頭像
    garyliuh

    沉溺於網海中的痞子

    garyliuh 發表在 痞客邦 留言(0) 人氣()