Postfix+Cyrus-SASL+dovecot搭建POP3/SMTP郵件服務器

安裝

須要安裝如下組件:服務器

  • postfix
  • cyrus_sasl
  • dovecot

爲了省事,我是直接yum install的。dom

配置

postfix

1 sudo vi /etc/postfix/main.cf

設置post

1 myhostname = mail.lzhaohao.info
2 mydomain = lzhaohao.info
3 myorigin = $myhostname

而後設置spa

1 inet_interfaces = all
2 mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain, mail.$mydomain, www.$mydomain, ftp.$mydomain

其中,inet_interfaces指定能夠鏈接郵件服務器的網卡界面;mydestination指定本郵件服務器會收下的信件的域名。rest

SMTP密碼驗證

安裝好cyrus-sasl後code

1 sudo vi /etc/sysconfig/saslauthd

設置ip

1 MECH = shadow

shadow的意思是使用系統自帶的/etc/passwd,/etc/shadow進行密碼驗證,也就是系統用戶名和密碼就是郵箱的用戶名和密碼。cyrus-sasl還能夠使用LDAP等驗證方式,此處使用shadow做爲例子。
而後設置cyrus使用saslauthd這個服務來驗證:ci

1 sudo vi /usr/lib/sasl2/smtpd.conf
2 log_level: 3
3 pwcheck_method: saslauthd
4 mech_list: PLAIN LOGIN

再告訴postfix使用smtp驗證:域名

1 sudo vi /etc/postfix/main.cf

增長如下內容it

1 smtpd_sasl_auth_enable = yes
2 smtpd_sasl_security_options = noanonymous
3 broken_sasl_auth_clients = yes
4 smtpd_recipient_restrictions =
5      permit_mynetworks
6      permit_sasl_authenticated
7      reject_unauth_destination

驗證:

1 telnet localhost 25
2 ehlo localhost

看到250-AUTH LOGIN PLAIN字樣即表示配置成功。

POP3配置

安裝好dovecot後,修改配置項爲:

1 protocols = pop3
2 listen = *
相關文章
相關標籤/搜索