安裝 postfix dovecot cyrus-sasl on centos 5.5

  • Category: 電腦相關
  • Last Updated: Sunday, 28 November 2010 15:34
  • Published: Sunday, 28 November 2010 13:12
  • Written by sam

作個筆記…不過是是事隔了一個星期了 可能會有點不清楚…

首先當然是關掉centos預設的sendmail

先看有沒有啟動 netstat -ntulp |grep :25 查看監聽埠

service sendmail stop 停止服務

chkconfig sendmail off 關了它

chkconfig --list sendmail  確認是否關閉

rpm -e sendmail 移除…

安裝 yum -y install postfix cyrus-sasl dovecot

修改 postfix 設定檔

vi /etc/postfix/main.cf

直接貼上我的內容 只需修改幾個重點位置即可

可以在/usr/sbin/postconf -n

能看到以下資訊

 

alias_database = hash:/etc/aliases

alias_maps = hash:/etc/aliases

broken_sasl_auth_clients = yes

command_directory = /usr/sbin

config_directory = /etc/postfix

daemon_directory = /usr/libexec/postfix

debug_peer_level = 2

home_mailbox = Maildir/

html_directory = no

inet_interfaces = all

mail_owner = postfix

mailbox_command = /usr/libexec/dovecot/deliver

mailq_path = /usr/bin/mailq.postfix

manpage_directory = /usr/share/man

mydestination = $myhostname, localhost.$mydomain, localhost, gotdns.com, myla.gotdns.com,       mail.myla.gotdns.com

mydomain = gotdns.com

myhostname = myla.gotdns.com

mynetworks = 192.168.0.0/16, 127.0.0.0/8

newaliases_path = /usr/bin/newaliases.postfix

queue_directory = /var/spool/postfix

readme_directory = /usr/share/doc/postfix-2.3.3/README_FILES

sample_directory = /usr/share/doc/postfix-2.3.3/samples

setgid_group = postdrop

smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination

smtpd_sasl_auth_enable = yes

smtpd_sasl_security_options = noanonymous

unknown_local_recipient_reject_code = 550

在dovecot 只需修改

 

vi /etc/dovecot.conf

於main.cf 加入 mailbox_command = /usr/libexec/dovecot/deliver

protocols = pop3 imap --> 之後要安裝 roundcube 用!

service dovecot start 啟動

netstat -ntulp |grep :110 看有無啟動

啟動 suslauthd

於main.cf 加入

smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination

smtpd_sasl_auth_enable = yes

smtpd_sasl_security_options = noanonymous

unknown_local_recipient_reject_code = 550

 

重啟 postfix

測試 smtp 認證是否有成功啟動

telnet x.x.x.x 25

ehlo localhost

看有無出現 250-AUTH=PLAIN CRAM-MD5 DIGEST-MD5 LOGIN

有就是ok了

最主要收發信 重點還是在於dns 不過目前這樣的設定 在內網是沒有問題的了