#contents
*Postfix設定 [#d7788ad6]
/etc/postfix/main.cf
# 証明書の指定
smtpd_tls_cert_file=/etc/postfix/server.crt
smtpd_tls_key_file=/etc/postfix/server.key
# 認証ON
smtpd_sasl_auth_enable = yes
# 認証済み以外は拒否
# 送信コマンド実行時の制限
smtpd_recipient_restrictions = permit_sasl_authenticated, reject
# 全コマンドに対する制限
smtpd_client_restrictions = permit_sasl_authenticated, reject
# 暗号化されていない接続では認証しない
smtpd_tls_auth_only = yes
*認証設定 [#ocb37572]
認証に必要なパッケージをインストール
sudo apt-get install sasl2-bin
/etc/postfix/sasl/smtpd.conf
pwcheck_method: saslauthd
mech_list: plain login
「mech_list: plain login」は
TLS有効でないとパスワードが盗聴されるので注意
インストールしただけでは起動時に自動的に立ち上がってこなかったはずなので
下記場所に適当にシンボリックリンクを作成
/etc/rc[3-5].d/
**Ubuntuの場合 [#g9cbcc6b]
Ubuntuの場合は下記追加が必要
/etc/default/saslauthd
START=no -> START=yes
postfixがchrootで起動されているので、saslを使えるようにシンボリックリンク作って、アクセス権限を設定しておく。
sudo rm -r /var/run/saslauthd/
sudo mkdir -p /var/spool/postfix/var/run/saslauthd
sudo ln -s /var/spool/postfix/var/run/saslauthd /var/run
sudo chgrp sasl /var/spool/postfix/var/run/saslauthd
sudo adduser postfix sasl
上記のリンクではうまく動かなかったっぽくて
/etc/default/saslauthd
OPTIONS="-c -m /var/spool/postfix/var/run/saslauthd"
を追記してるみたい。
*ポートの設定 [#p0cdc930]
/etc/postfix/master.cf
smtp inet n - - - - smtpd
-o mynetworks=127.0.0.1/32
-o smtpd_recipient_restrictions=permit_mynetworks,reject
-o smtpd_client_restrictions=permit_mynetworks,reject
# ローカルからはfetchmailしている関係上そのまま受信できるようにする。
smtps inet n - - - - smtpd
-o smtpd_tls_wrappermode=yes
# overSSLモード
-o smtpd_sasl_auth_enable=yes
# SMTP認証有効
-o smtpd_client_restrictions=permit_sasl_authenticated,reject
# 設定ファイル内でも指定しているが認証していなければコマンド使用不可
とする。
*参考サイト [#h47899d0]
-[[メールサーバの設定(postfix・dovecot):http://tech.ckme.co.jp/mail.shtml]] -- 設定の流れ参考ページ
-[[Postfix設定パラメータ:http://www.postfix-jp.info/trans-2.2/jhtml/postconf.5.html]] -- 設定パラメータについての参考ページ