CentOS+Sendmail+sasl2+Dovecot

來源:互聯網
上載者:User

1.預設安裝CentOS,sasl2所需要的包和sendmail包;2.關閉selinux,否則會影響saslauthd使用shadow認證;

vi /etc/selinux/config

將SELINUX=enforce改成SELINUX=disabled,需要重新啟動電腦生效;

3.修改saslauthd的設定檔,選擇使用shadow方式認證;

vi /etc/sysconfig/saslauthd

將MECH=pam改成MECH=shadow;

4.啟動saslauthd並驗證是否正常工作;

service saslauthd start       #啟動saslauthd

chkconfig saslauthd on      #設定saslauthd開機自動啟動

testsaslauthd -u username -p password

如果顯示0: OK “Success.”則表明saslauthd工作正常;

5.安裝sendmail-cf,用來配置sendmail設定檔的工具;

yum install sendmail-cf

6.配置sendmail.conf

vi /etc/mail/sendmail.mc

刪除下邊兩行開頭的dnl:

TRUST_AUTH_MECH(`EXTERNAL DIGEST-MD5 CRAM-MD5 LOGIN PLAIN’)dnl

define(`confAUTH_MECHANISMS’,`EXTERNAL GSSAPI DIGEST-MD5 CRAM-MD5 LOGIN PLAIN’)dnl

#配置支援的認證方式,配置後通過驗證的使用者都可以發郵件,不用在access裡配置Relay

DAEMON_OPTIONS(`Port=smtp,Addr=0.0.0.0, Name=MTA’)dnl    #修改偵聽範圍

DAEMON_OPTIONS(`Port=587,Name=MSA,M=a')dnl     #增加通過587連接埠發郵件

m4 /etc/mail/sendmail.mc > /etc/mail/sendmail.cf      #組建組態

7.添加sendmail接受郵件的網域名稱;

vi /etc/mail/local-host-names

添加網域名稱如: an.test //每個網域名稱一行

8.重新啟動sendmail並驗證能否正常使用;

service sendmail restart

chkconfig sendmail on

telnet smtp_server 25

HELO domainname

250 domainname Hello [10.57.28.221], pleased to meet you

AUTH LOGIN

#輸入這個後,使用base64編碼的使用者名稱密碼,使用下面一句話來產生

perl -MMIME::Base64 -e ‘print encode_base64(“word”)’

334 VXNlcm5hbWU6

dGVzdA== # base64編碼後的test

334 UGFzc3dvcmQ6

YWJjZC4xMjM0 #base64編碼後的abcd.1234

235 2.0.0 OK Authenticated

MAIL FROM:test@an.test

250 2.1.0 test@an.test… Sender ok

RCPT TO:test@an.test

250 2.1.5 test@an.test… Recipient ok

DATA # 開始郵件的內容

Subject:test #郵件標題

This a test email. #郵件內文

. #用一個.結束郵件

9.安裝dovecot支援pop3;

yum install dovecot

10.配置dovecot.conf

vi /etc/dovecot.conf

去掉以下幾行前邊的#並修改;

protocols = imap pop3

disable_plaintext_auth = no

mail_location = mbox:/var/mail:INBOX=/var/mail/%u

11.啟動dovecot;

service dovecot start

chkconfig dovecot on

12.驗證pop3能否正常使用;

telnet pop3_server 110

auth

user user_name

pass user_password

#驗證OK以後就可以使用pop3模式收發郵件了;

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.