邮件服务器搭建之:详解Dovecot配置

Dovecot是一个安全性较好的POP3/IMAP服务器软件,响应速度快而且扩展性好
POP3 / IMAP 是 MUA 从邮件服务器中读取邮件时使用的协议。其中,POP3是从邮件服务器中下载邮件,而IMAP则是将邮件留在服务器端直接对邮件进行管理、操作。
Dovecot使用PAM方式( Pluggable Authentication Module,可插拔认证模块)进行身份认证,以便识别并验证系统用户,通过认证的用户才允许从邮箱中收取邮件。对于RPM方式安装的dovecot,会自动建立该PAM文件
RHEL6系统自带了Dovecot软件,可通过yum之间安装
 
  1. [root@rhel6 ~]# yum -y install dovecot\* 
  2. [root@rhel6 ~]# vi /etc/dovecot/dovecot.conf  
  3. protocols = imap pop3  //使用的协议
  4. login_trusted_networks = 192.168.0.0/24                         //设置允许连接的地址 
  5. !include conf.d/*.conf                                          //说明conf.d下的所以conf结尾的文件均有效 
  6.  
  7. [root@rhel6 ~]# cat /etc/dovecot/conf.d/10-mail.conf  //设置邮件存放的路径
  8. mail_location = mbox:~/mail:INBOX=/var/mail/%u 
  
  1. 基础的 POP3/IMAP 设置 
  2. [root@rhel6 ~]# vi /etc/dovecot/conf.d/10-ssl.conf  
  3. ssl = no                                                         //关闭SSL加密 
  4. [root@rhel6 ~]# /etc/init.d/dovecot restart         
  5. [root@rhel6 ~]# netstat -lntp | grep dovecot                        //只开放了110、143端口 
  6. tcp        0      0 0.0.0.0:110                 0.0.0.0:*                   LISTEN      2434/dovecot         
  7. tcp        0      0 0.0.0.0:143                 0.0.0.0:*                   LISTEN      2434/dovecot         
  8. tcp        0      0 :::110                      :::*                        LISTEN      2434/dovecot         
  9. tcp        0      0 :::143                      :::*                        LISTEN      2434/dovecot 
发送一封邮件给[email protected]用户,到windows系统通过outlook接收邮件进行测试:
[root@rhel6 ~]# mail -s 'postfix' [email protected] < /etc/hosts

  1. 加密的POP3s/IMAPs设置 
  2. [root@rhel6 ~]# vi /etc/dovecot/conf.d/10-auth.conf  
  3. disable_plaintext_auth = yes                                        //设置密文传输 
  4.  
  5. [root@rhel6 ~]# vi /etc/dovecot/conf.d/10-ssl.conf  
  6. ssl=required  //开启SSL
  7. ssl_cert = </etc/pki/dovecot/certs/dovecot.pem  //公钥路径
  8. ssl_key = </etc/pki/dovecot/private/dovecot.pem  //私钥路径
  9.  
  10. [root@rhel6 ~]# vi /etc/dovecot/conf.d/10-master.conf  
  11. service imap-login { 
  12.   inet_listener imap { 
  13.     port = 0 
  14.   } 
  15.   inet_listener imaps { 
  16.     #port = 993 
  17.     #ssl = yes 
  18.   } 
  19.  
  20. service pop3-login { 
  21.   inet_listener pop3 { 
  22.     port = 0 
  23.   } 
  24.   inet_listener pop3s { 
  25.     #port = 995 
  26.     #ssl = yes 
  27.   } 
  28.                                       
  29. [root@rhel6 ~]# /etc/init.d/dovecot restart          
  30. [root@rhel6 ~]# netstat -lntp | grep dovecot         
  31. tcp        0      0 0.0.0.0:993                 0.0.0.0:*                   LISTEN      2547/dovecot         
  32. tcp        0      0 0.0.0.0:995                 0.0.0.0:*                   LISTEN      2547/dovecot         
  33. tcp        0      0 :::993                      :::*                        LISTEN      2547/dovecot         
  34. tcp        0      0 :::995                      :::*                        LISTEN      2547/dovecot 
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章