close

安裝postfix, dovecot, cyrus-sasl, cyrus-sasl-devel, cyrus-sasl-plain, cyrus-sasl-md5

 

主要檔案:
/etc/postfix/main.cf
 postfix主要設定檔,只要修改過這個檔案,要重新啟動 postfix。

/etc/postfix/master.cf
主要規定 postfix 每個程序的運作參數。 通常不需要更動。

/etc/postfix/access (利用 postmap 處理)


/etc/aliases (利用 postalias 或 newaliases 均可)


基本指令:
 postfix check   <==檢查 postfix 相關的檔案、權限等是否正確!
 postfix start   <==開始 postfix 的執行
 postfix stop    <==關閉 postfix
 postfix flush   <==強制將目前正在郵件佇列的郵件寄出!
 postfix reload  <==重新讀入設定檔,也就是 /etc/postfix/main.cf


1.修改的選項  main.cf


myhostname = linux.test.com(完整主機名稱)
myorigin = $myhostname
inet_interfaces = all
mydestination = $myhostname, localhost.$mydomain, localhost,
     www.test.com
mynetworks = 127.0.0.0/8, 192.168.1.0/24, hash:/etc/postfix/access
relay_domains = $mydestination
always_bcc = user@test.com(所有寄出郵件都寄備份給 user@test.com)
message_size_limit =   20000000(單封郵件大小 20M)
mailbox_size_limit = 10000000000(mailbox容量 10G)

smtpd_sasl_local_domain =

找到跟 relay 有關的設定項目,增加一段允許 SMTP 認證的字樣:
smtpd_recipient_restrictions =
     permit_mynetworks
     permit_sasl_authenticated
     reject_unauth_destination
     reject_unknown_sender_domain
     reject_unknown_recipient_domain
     reject_rbl_client cbl.abuseat.org
     reject_rbl_client bl.spamcop.net
     reject_rbl_client cblless.anti-spam.org.cn
     reject_rbl_client sbl-xbl.spamhaus.org
     check_policy_service unix:/var/spool/postfix/postgrey/socket

smtpd_client_restrictions =
  permit_mynetworks
  hash:/etc/postfix/access
  permit_sasl_authenticated
  reject_rbl_client relays.ordb.org
  reject_rhsbl_client dsn.rfc-ignorant.org


最後面增加這些設定資料:
smtpd_sasl_auth_enable = yes
smtpd_sasl_security_options = noanonymous
broken_sasl_auth_clients = yes

 

2.執行以下命令

postmap hash:/etc/postfix/access
postalias hash:/etc/aliases
postfix check   (如果沒有錯誤訊息表示正常)


3. 設定郵件主機使用權限與過濾機制 /etc/postfix/access
140.116.44.202  ACCEPT
.edu.tw   ACCEPT
av.com   REJECT
192.168.100  REJECT
# ACCEPT 表示可接受,而 REJECT 則表示拒絕。
設定完成執行
postmap hash:/etc/postfix/access


4. 設定郵件別名 /etc/aliases
mailer-daemon:  postmaster
postmaster:     root
bin:            root
daemon:         root
設定完成執行
postalias hash:/etc/aliases

可設定群組寄信  /etc/aliases
sales: sales01,sales02,sales03,sales04

Or 設定成外部郵件

testuser: test,user@yahoo.com.tw(外部收件者)

 

修改POP/IMAP等協定   /etc/dovecot.conf
protocols = pop3
listen = [::]

SMTP 身份認證之 relay  /etc/sysconfig/saslauthd
MECH=shadow

修改 /usr/lib/sasl2/smtpd.conf
log_level: 3                <==登錄檔資訊等級的設定,設定 3 即可
pwcheck_method: saslauthd   <==選擇什麼服務來負責密碼的比對
mech_list: PLAIN LOGIN     


啟動服務
service dovecot start(注意 cyrus-imap 是否已經啟動佔用?)
service saslauthd start
service postfix start

 

arrow
arrow
    全站熱搜

    billtang0311 發表在 痞客邦 留言(0) 人氣()