postfix 設定(メール転送)
設計
外部からは以下メールアドレスのみ受付け転送する。他のメールアドレスは拒否。
test@xxxx.com
test1@xxxx.com
test2@xxxx.com
test@xxxx.com
test1@xxxx.com
test2@xxxx.com
内部からはどの宛先にでも送信可能。
設定ファイル
main.cf
# aliasを指定alias_database = hash:/etc/aliasesalias_maps = hash:/etc/aliases# "user%domain" の形から "user@domain" への書き換えを有効にします。 これはデフォルトで有効。allow_percent_hack = yes# 全ての Postfix 管理コマンドの場所command_directory = /usr/sbin# コンフィグの場所config_directory = /etc/postfix# Postfix サポートプログラムおよびデーモンプログラムがあるディレクトリdaemon_directory = /usr/libexec/postfix#data_directory = /var/lib/postfix# リモートクライアントまたはサーバが debug_peer_list パラメータの パターンにマッチした場合の、冗長ログレベルの増分debug_peer_level = 2# SMTP VRFY コマンドを無効にします。(default : no)disable_vrfy_command = yes# Postfix サブシステムや機能に関する構築方法や設定方法、操作方法が 書かれた Postfix HTML ファイルの場所html_directory = no# このメールシステムがメールを受け取るネットワークインターフェース アドレスinet_interfaces = all#inet_protocols = all# アカウントmail_owner = postfix# mailqコマンドがインストールされた場所mailq_path = /usr/bin/mailq.postfix# manの場所manpage_directory = /usr/share/man# $local_transport メール配送 transport を使って配送されるドメインの リストmydestination = $myhostname, localhost.$mydomain, localhost# このメールシステムのインターネットドメイン名mydomain = mail.***.com# このメールシステムのインターネットホスト名myhostname = ***.com# "信頼された" SMTP クライアントの リストmynetworks = 0.0.0.0/0, 127.0.0.0/8# Postfix がローカルマシンのみを信頼するため、hostmynetworks_style = host# 外部へ送信するドメイン名myorigin = $myhostname# Postfix newaliasesコマンドの場所newaliases_path = /usr/bin/newaliases.postfix# キューの場所queue_directory = /var/spool/postfix# readmeドキュメントの場所readme_directory = /usr/share/doc/postfix-2.6.6/README_FILES# 設定サンプルの場所sample_directory = /usr/share/doc/postfix-2.6.6/samples# Postfix sendmailコマンドの場所を指定している Sendmail 互換機能sendmail_path = /usr/sbin/sendmail.postfix# set-gid Postfix コマンドおよびグループ書き込み可能な Postfix ディレクトリsetgid_group = postdrop# リモート SMTP クライアントが SMTP セッションの最初で HELO または EHLO コマンドで自己紹介することを要求します(default : no)smtpd_helo_required = yes# Postfix SMTP サーバが SMTP HELO コマンドの場面で適用する、オプションの 制限# reject_invalid_hostname : HELO または EHLO ホスト名の文法が不正な場合に、要求を拒否します# permit_mynetworks : クライアントの IP アドレスが $mynetworks にリストアップされた ネットワークのいずれかにマッチする場合、要求を許可しますsmtpd_helo_restrictions = reject_invalid_hostname, permit_mynetworks# Postfix SMTP サーバが RCPT TO コマンドの場面で適用するアクセス制限# check_client_access : 指定された access データベースでクライアントのホスト名# reject_unauth_destination : $mydestination, $inet_interfaces, $virtual_maps, $relay_domains それぞれのパラメータ値にリストされたアドレス宛かチェックし、それ以外は拒否する。# check_recipient_access : 転送するアドレスやドメイン、 親ドメインを指定する。こちらに記載されたもの以外は転送拒否smtpd_recipient_restrictions = check_client_access hash:/etc/postfix/internal_senders_access, reject_unauth_destination, check_recipient_access hash:/etc/postfix/recipient_mail_access, reject# 受信者アドレスがローカルで、$local_recipient_maps がその受信者に マッチしない検索テーブルのリストを指定していた場合に、Postfix SMTP サーバが応答する数字のコードunknown_local_recipient_reject_code = 550 |
internal_senders_access(MTAから送信を許可するクライアント)
localhost OK133.242.187. OK |
recipient_mail_access (転送を許可するメールアドレス)
test@ OKtest1@ OKtest2@ OK |
/etc/access (転送先)
test : xxxxx@gmail.comtest1 : xxxxx@gmail.com,xxxxxx@hotmail.comtest2 : xxxxx@hotmail.com |