2. Postfix
1. ntsysv でONにする。
Postfix はまったく systemd に対応していないので、ntsysv で起動を on にする。
2. SASL を有効にする。main.cf には記載はないので注意。
参考ページ:http://www.postfix.org/SASL_README.html
以下の行を main.cf に追加。
dovecot 側は
smtpd_sasl_type = dovecot
smtpd_sasl_path = private/auth
10-master.conf
にがあったので、そのまま使う。
# Postfix smtp-auth
unix_listener /var/spool/postfix/private/auth {
mode = 0666
3. TLS を有効にする。
参考ページ:http://www.postfix.org/TLS_README.html
以下の行を main.cf に追加。
smtpd_tls_cert_file = /etc/pki/hagiland/cert.pem
smtpd_tls_key_file = /etc/pki/hagiland/private.pem
smtpd_tls_loglevel = 2
smtpd_tls_security_level = encrypt
smtpd_tls_auth_only = yes
smtpd_tls_session_cache_database = btree:/var/lib/postfix/smtpd_scache
smtpd_tls_session_cache_timeout = 3600s
smtpd_recipient_restrictions = permit_tls_clientcerts,reject_unauth_destination
4. リレーされない問題
自宅外でもメール送信ができるように、from
の範囲をsmtpd_recipient_restrictions
で定義。/etc/postfix/relay_recipients
の内容は以下のような感じ。受け付けるメールアドレスが左側、右側は何でもいい(けど必要)。
その後、
hagi@xxx.com ok
hagi@yyy.net ok
# postmap /etc/postfix/relay_recipientsを実行。さらに main.cf に以下が必要のようだ。
参考ページ:http://www.miloweb.net/pastbbs/0010/2913.html#2913
smtpd_recipient_restrictions = permit_tls_clientcerts,permit_sasl_authenticated,reject_unauth_destination
もしかしたら、このコマンドも必要かもしれない。
# postconf -e "relay_recipient_maps = hash:/etc/postfix/relay_recipients"参考ページ:http://www200.pair.com/mecham/spam/reject_unverified.html