postfix設定值筆記
vi /etc/postfix/main.cf
#查看參數是否套用
/sbin/postconf mail_version
#自動增加缺少的標頭,如date、Message-Id (outlook測試信時發生)
always_add_missing_headers = yes
#認證-串dovecot
vi /etc/postfix/main.cf
smtpd_sasl_type = dovecot
smtpd_sasl_path = private/auth
#SMTP Server 盡可能使用 TLS 加密
smtpd_tls_security_level = may
#SMTP Client 盡可能使用 TLS 加密
smtp_tls_security_level = may
#憑證設定
smtpd_tls_cert_file=/etc/dovecot/private/dovecot_mail.tscgg.com.tw.pem
smtpd_tls_key_file=/etc/dovecot/private/dovecot_mail.tscgg.com.tw.key
#使用ldap方式指定使用信箱存放位置
(01)建立查詢連線設定檔
vi /etc/postfix/cust/ldap_virtual_mailbox_maps.cf
server_host = 10.3.1.6 10.3.1.3
server_port = 389
version = 3
bind = yes
start_tls = no
bind_dn = domain\user
bind_pw = password
search_base = OU=TSCS,dc=tgenergy,dc=com,dc=tw
scope = sub
query_filter = (&(objectclass=person)(mail=%s)(!(userAccountControl:1.2.840.113556.1.4.803:=2)))
result_attribute= mail
result_format = %d/%u/
debuglevel = 0
(02)測試
/usr/sbin/postmap -q josh.hsu@tscs.com.tw ldap:/etc/postfix/cust/ldap_virtual_mailbox_maps.cf
(03)POSTFIX套用設定
virtual_mailbox_maps=proxy:ldap:/etc/postfix/cust/ldap_virtual_mailbox_maps.cf
#驗證寄件人員mail必須內部人員
(01)建立查詢連線設定檔
vi /etc/postfix/cust/ldap_sender_login_maps.cf
server_host = 10.3.1.6 10.3.1.3
server_port = 389
version = 3
bind = yes
start_tls = no
bind_dn = tgenergy\ldap
bind_pw = l12345678
search_base = OU=TSCS,dc=tgenergy,dc=com,dc=tw
scope = sub
query_filter = (&(mail=%s)(objectClass=person)(!(userAccountControl:1.2.840.113556.1.4.803:=2)))
result_attribute= mail
debuglevel = 0
(02)測試
/usr/sbin/postmap -q josh.hsu@tscs.com.tw ldap:/etc/postfix/cust/ldap_sender_login_maps.cf
(03)POSTFIX套用設定
smtpd_sender_restrictions=reject_authenticated_sender_login_mismatch
smtpd_sender_login_maps=proxy:ldap:/etc/postfix/cust/ldap_sender_login_maps.cf
dovecot設定筆記
vi /etc/dovecot/conf.d/10-logging.conf
#除錯
#可顯示存取那個資料夾等資訊
mail_debug = yes
#顯示身份驗證和密碼相關
auth_verbose = yes
auth_verbose_passwords = plain
#認證 Postfix smtp-auth
vi /etc/dovecot/conf.d/10-master.conf
unix_listener /var/spool/postfix/private/auth {
mode = 0666
}
#憑證設定
vi /etc/dovecot/conf.d/10-ssl.conf
ssl_cert = </etc/dovecot/private/dovecot_mail.tscgg.com.tw.pem
ssl_key = </etc/dovecot/private/dovecot_mail.tscgg.com.tw.key