前を向くために Part3

プログラミング、音楽、外交問題、その他思いついたことを何でも公開

人生、前向きに生きたいもの。でも、何かと後ろ向きになりがちな自分がいるのです。前向きに生きるには、まず前を向かなければなりませぬ。じゃあ前を向くためにはどうしたらいいの?と日々悩んどります。これはその記録の一部です。

2. Postfix

1. ntsysv でONにする。

Postfix はまったく systemd に対応していないので、ntsysv で起動を on にする。

2. SASL を有効にする。main.cf には記載はないので注意。

参考ページ:http://www.postfix.org/SASL_README.html
以下の行を main.cf に追加。


smtpd_sasl_type = dovecot
smtpd_sasl_path = private/auth
dovecot 側は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 に以下が必要のようだ。

smtpd_recipient_restrictions = permit_tls_clientcerts,permit_sasl_authenticated,reject_unauth_destination
参考ページ:http://www.miloweb.net/pastbbs/0010/2913.html#2913
もしかしたら、このコマンドも必要かもしれない。
# postconf -e "relay_recipient_maps = hash:/etc/postfix/relay_recipients"
参考ページ:http://www200.pair.com/mecham/spam/reject_unverified.html