天天看點

郵件伺服器搭建之:詳解Dovecot配置

Dovecot是一個安全性較好的POP3/IMAP伺服器軟體,響應速度快而且擴充性好

POP3 / IMAP 是 MUA 從郵件伺服器中讀取郵件時使用的協定。其中,POP3是從郵件伺服器中下載下傳郵件,而IMAP則是将郵件留在伺服器端直接對郵件進行管理、操作。

Dovecot使用PAM方式( Pluggable Authentication Module,可插拔認證子產品)進行身份認證,以便識别并驗證系統使用者,通過認證的使用者才允許從郵箱中收取郵件。對于RPM方式安裝的dovecot,會自動建立該PAM檔案

RHEL6系統自帶了Dovecot軟體,可通過yum之間安裝

[root@rhel6 ~]# yum -y install dovecot\* 

[root@rhel6 ~]# vi /etc/dovecot/dovecot.conf  

protocols = imap pop3  //使用的協定

login_trusted_networks = 192.168.0.0/24                         //設定允許連接配接的位址 

!include conf.d/*.conf                                          //說明conf.d下的是以conf結尾的檔案均有效 

[root@rhel6 ~]# cat /etc/dovecot/conf.d/10-mail.conf  //設定郵件存放的路徑

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

基礎的 POP3/IMAP 設定 

[root@rhel6 ~]# vi /etc/dovecot/conf.d/10-ssl.conf  

ssl = no                                                         //關閉SSL加密 

[root@rhel6 ~]# /etc/init.d/dovecot restart         

[root@rhel6 ~]# netstat -lntp | grep dovecot                        //隻開放了110、143端口 

tcp        0      0 0.0.0.0:110                 0.0.0.0:*                   LISTEN      2434/dovecot         

tcp        0      0 0.0.0.0:143                 0.0.0.0:*                   LISTEN      2434/dovecot         

tcp        0      0 :::110                      :::*                        LISTEN      2434/dovecot         

tcp        0      0 :::143                      :::*                        LISTEN      2434/dovecot 

發送一封郵件給[email protected]使用者,到windows系統通過outlook接收郵件進行測試:

[root@rhel6 ~]# mail -s 'postfix' [email protected] < /etc/hosts

<a target="_blank" href="http://blog.51cto.com/attachment/201304/172406566.png"></a>

<a target="_blank" href="http://blog.51cto.com/attachment/201304/172420260.png"></a>

<a target="_blank" href="http://blog.51cto.com/attachment/201304/165751496.png"></a>

加密的POP3s/IMAPs設定 

[root@rhel6 ~]# vi /etc/dovecot/conf.d/10-auth.conf  

disable_plaintext_auth = yes                                        //設定密文傳輸 

ssl=required  //開啟SSL

ssl_cert = &lt;/etc/pki/dovecot/certs/dovecot.pem  //公鑰路徑

ssl_key = &lt;/etc/pki/dovecot/private/dovecot.pem  //私鑰路徑

[root@rhel6 ~]# vi /etc/dovecot/conf.d/10-master.conf  

service imap-login { 

  inet_listener imap { 

    port = 0 

  } 

  inet_listener imaps { 

    #port = 993 

    #ssl = yes 

service pop3-login { 

  inet_listener pop3 { 

  inet_listener pop3s { 

    #port = 995 

[root@rhel6 ~]# /etc/init.d/dovecot restart          

[root@rhel6 ~]# netstat -lntp | grep dovecot         

tcp        0      0 0.0.0.0:993                 0.0.0.0:*                   LISTEN      2547/dovecot         

tcp        0      0 0.0.0.0:995                 0.0.0.0:*                   LISTEN      2547/dovecot         

tcp        0      0 :::993                      :::*                        LISTEN      2547/dovecot         

tcp        0      0 :::995                      :::*                        LISTEN      2547/dovecot 

本文轉自Vnimos51CTO部落格,原文連結:http://blog.51cto.com/vnimos/1176240,如需轉載請自行聯系原作者

繼續閱讀