Postfixのサブミッションポートへの対応

By siteadministrator, 9 2月, 2020

スパムメール対策のために、Outbound Port 25 Blockingを施したメールサーバーに適合する。

前提

  • Postfixは既にセットアップ出来ており、相手サーバーが許せば、25番ポートでのメールの送受信は可能であるとする。
  • Postfixは、サテライトシステムとして、構成・運用されている。

リレーサーバーの設定を確認

サーバーの認証ID・パスワードは「ユーザーID\0ユーザーID\0パスワード」をbase64エンコードしたものを使用する。リレーサーバーの確認のみに使用する。

perl -MMIME::Base64 -e 'print encode_base64("USER\0USER\0PASSWORD")';

で表示されたものを使用する。

認証の確認を行う。

telnet メールサーバー名 587

認証方式によっては以下の手法は使用できない。

Postfixの設定を行う。

/etc/postfix/main.cf を編集する。

relayhost = [リレー担当メールサーバー名]:587
smtpd_sasl_auth_enable = yes
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/isp_mailpasswd
smtp_sasl_security_options = noanonymous
smtp_sasl_mechanism_filter = plain

[]で囲むこと。

認証方式を定義する。/etc/postfix/sasl/smtpd.conf を編集する。

pwcheck_method: authdaemond
authdaemond_path: /var/run/courier/authdaemon/socket
mech_list: plain login

ユーザー認証技術「SMTP AUTH」(SMTP authentication)認証用のパスワードファイルを作成する。

/etc/postfix/isp_mailpasswd ファイルを作成する。

[リレー担当メールサーバー名]:587 ID:パスワード

パスワードファイルをhash 型式のバークレイ DB型にする。

postmap hash:/etc/postfix/isp_mailpasswd

※LDAPサーバーを参照する場合には、hashに変わってldapを指定する。

iptables等のファイアーウォールの設定を行っている場合には、587ポートを開ける。

GMailをリレーサーバーとする

上記設定に加えて

vi /etc/postfix/main.cf

relayhost = [smtp.gmail.com]:587
smtp_use_tls = yes
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_sasl_tls_security_options = noanonymous

上記/etc/postfix/isp_mailpasswd ファイルを作成する。GMailを例とすると、

[smtp.gmail.com]:587 ID:パスワード

とする。

 

 

タグ

コメント