Oefenweb.postfix
postfix
Debian系のシステムにPostfixサーバーを設定します。
要件
なし
変数
postfix_install[デフォルト:[postfix, mailutils, libsasl2-2, sasl2-bin, libsasl2-modules]]: インストールするパッケージpostfix_hostname[デフォルト:{{ ansible_fqdn }}]: ホスト名、myhostnameやmydestinationに使用されますpostfix_mailname[デフォルト:{{ ansible_fqdn }}]: メール名 (/etc/mailname内)、myoriginに使用されますpostfix_compatibility_level[オプション]: 後方互換性を有効にすると、Postfixは暗黙のデフォルト値に設定された設定を探し、後方互換性が必要なデフォルト設定が必要な場合にメッセージをログに記録します(例:2,Postfix >= 3.0)postfix_default_database_type[デフォルト:hash]:newaliases,postalias,postmapコマンドに使用するデフォルトデータベースタイプpostfix_aliases[デフォルト:[]]:/etc/aliasesに確実に存在させるエイリアスpostfix_aliases_database_type[デフォルト:"{{ postfix_default_database_type }}"]: エイリアスに使用するデータベースタイプpostfix_virtual_aliases[デフォルト:[]]:/etc/postfix/virtualに確実に存在させる仮想エイリアスpostfix_sender_canonical_maps[デフォルト:[]]:/etc/postfix/sender_canonical_maps内の送信者アドレスの書き換えpostfix_sender_canonical_maps_database_type[デフォルト:"{{ postfix_default_database_type }}"]:postfix_sender_canonical_mapsに使用するデータベースタイプpostfix_recipient_canonical_maps[デフォルト:[]]:/etc/postfix/recipient_canonical_maps内の受信者アドレスの書き換えpostfix_recipient_canonical_maps_database_type[デフォルト:"{{ postfix_default_database_type }}"]:postfix_recipient_canonical_mapsに使用するデータベースタイプpostfix_transport_maps[デフォルト:[]]: 受信者アドレスに基づくトランスポートマッピング/etc/postfix/transport_mapspostfix_transport_maps_database_type[デフォルト:"{{ postfix_default_database_type }}"]:postfix_transport_mapsに使用するデータベースタイプpostfix_sender_dependent_relayhost_maps[デフォルト:[]]: 送信者アドレスに基づくトランスポートマッピング/etc/postfix/sender_dependent_relayhost_mapspostfix_header_checks[デフォルト:[]]: プライマリ非MIMEメッセージヘッダーのコンテンツ検査のためのルックアップテーブル/etc/postfix/header_checkspostfix_header_checks_database_type[デフォルト:regexp]:header_checksに使用するデータベースタイプpostfix_generic[デフォルト:postfix_smtp_generic_maps]: 廃止,postfix_smtp_generic_mapsを使用してくださいpostfix_smtp_generic_maps[デフォルト:[]]:/etc/postfix/generic内の一般的なテーブルアドレスマッピングpostfix_smtp_generic_maps_database_type[デフォルト:"{{ postfix_default_database_type }}"]:smtp_generic_mapsに使用するデータベースタイプpostfix_mydestination[デフォルト:["{{ postfix_hostname }}", 'localdomain', 'localhost', 'localhost.localdomain']]: このマシンがローカルに配信するドメインを指定します。他のマシンに転送するのではなく。postfix_mynetworks[デフォルト:['127.0.0.0/8', '[::ffff:127.0.0.0]/104', '[::1]/128']]: "信用できる"リモートSMTPクライアントのリストpostfix_inet_interfaces[デフォルト:all]: バインドするネットワークインターフェースpostfix_inet_protocols[デフォルト:all]: Postfixが接続を作成または受け入れるときに使用するインターネットプロトコルpostfix_smtp_ipv4_bind[オプション]: 使用する送信ネットワークインターフェース(IPv4)postfix_smtp_ipv6_bind[オプション]: 使用する送信ネットワークインターフェース(IPv6)postfix_relayhost[デフォルト:''(リレーするホストなし)]: すべてのメールをリレーするホスト名postfix_relayhost_mxlookup[デフォルト:false(mxルックアップを使用しない)]: リレーホストのAレコードではなくMXレコードをルックアップしますpostfix_relayhost_port[デフォルト: 587]: リレーポート(設定されている場合、postfix_relayhostに)postfix_relaytls[デフォルト:false]: リレーhostに送信する際にTLSを使用postfix_smtpd_client_restrictions[オプション]: クライアント制限のリストpostfix_smtpd_helo_restrictions[オプション]: helo制限のリストpostfix_smtpd_sender_restrictions[オプション]: 送信者制限のリストpostfix_smtpd_recipient_restrictions[オプション]: 受信者制限のリストpostfix_smtpd_relay_restrictions[オプション]: メールリレー制御のアクセス制限のリストpostfix_smtpd_data_restrictions[オプション]: データ制限のリストpostfix_sasl_auth_enable[デフォルト:true]: SMTPクライアントでSASL認証を有効にするpostfix_sasl_user[デフォルト:postmaster@{{ ansible_domain }}]: SASLリレーのユーザー名postfix_sasl_password[デフォルト:k8+haga4@#pR]: SASLリレーのパスワード 変更することを忘れずに!postfix_sasl_security_options[デフォルト:noanonymous]: SMTPクライアントのSASLセキュリティオプションpostfix_sasl_tls_security_option[デフォルト:noanonymous]: SMTPクライアントのSASL TLSセキュリティオプションpostfix_sasl_mechanism_filter[デフォルト:'']: SMTPクライアントのSASL認証メカニズムフィルターpostfix_smtp_tls_security_level[デフォルト:encrypt]: Postfix SMTPクライアントのデフォルトのSMTP TLSセキュリティレベルpostfix_smtp_tls_wrappermode[デフォルト:false]: Postfix SMTPクライアントがSTARTTLSコマンドを使用する代わりにレガシーSMTPSプロトコルを使用して接続をリクエストpostfix_smtp_tls_note_starttls_offer[デフォルト:true]: そのサーバーに対してTLSがすでに有効でない場合、STARTTLSを提供するリモートSMTPサーバーのホスト名をログに記録postfix_smtp_tls_cafile[オプション]: リモートSMTPサーバーの証明書または中間CA証明書を署名するために信頼されるルートCAのCA証明書を含むファイル(例:/etc/ssl/certs/ca-certificates.crt)postfix_smtpd_banner[デフォルト:$myhostname ESMTP $mail_name (Ubuntu)]: 挨拶のバナー テキストの最初に必ず$myhostnameを指定してください。これはSMTPプロトコルで必要です。postfix_disable_vrfy_command[デフォルト:true]:SMTP VRFYコマンドを無効にします。これにより、メールアドレス採取に使用される技術のいくつかを防ぎますpostfix_message_size_limit[デフォルト:10240000]: メッセージの最大サイズ(バイト数で、エンベロープ情報を含む)postfix_smtpd_tls_cert_file[デフォルト:/etc/ssl/certs/ssl-cert-snakeoil.pem]: 証明書ファイルへのパスpostfix_smtpd_tls_key_file[デフォルト:/etc/ssl/certs/ssl-cert-snakeoil.key]: キーファイルへのパスpostfix_smtpd_security_level[オプション]: Postfix SMTPサーバーのSMTP TLSセキュリティレベルpostfix_smtp_tls_mandatory_ciphers[オプション]: Postfix SMTPクライアントが使用する必須TLSの最小暗号グレードpostfix_smtp_tls_mandatory_protocols[オプション]: Postfix SMTPクライアントが使用する必須TLS暗号化に関するTLSプロトコルpostfix_smtp_tls_protocols[オプション]: Postfix SMTPクライアントが使用する機会主義的TLS暗号化に関するTLSプロトコルpostfix_smtpd_tls_mandatory_ciphers[オプション]: Postfix SMTPサーバーが使用する必須TLS暗号化に関する最小暗号グレードpostfix_smtpd_tls_mandatory_protocols[オプション]: Postfix SMTPサーバーが必須TLS暗号化で受け入れるTLSプロトコルpostfix_smtpd_tls_protocols[オプション]: Postfix SMTPサーバーが機会主義的TLS暗号化で受け入れるTLSプロトコルpostfix_raw_options[デフォルト:[]]: 追加の(未サポートの)設定を渡すための行のリスト
依存関係
debconfdebconf-utils
例
SASLリレーを使用しないシンプルな例:
---
- hosts: all
roles:
- oefenweb.postfix
vars:
postfix_aliases:
- user: root
alias: [email protected]
SASLリレーを使用しないメール転送のための仮想エイリアスを含むシンプルな例:
---
- hosts: all
roles:
- oefenweb.postfix
vars:
postfix_mydestination:
- "{{ postfix_hostname }}"
- '$mydomain'
- localdomain
- localhost
- localhost.localdomain
postfix_virtual_aliases:
- virtual: [email protected]
alias: [email protected]
- virtual: [email protected]
alias: [email protected], [email protected]
送信者アドレスを書き換えるシンプルな例:
---
- hosts: all
roles:
- oefenweb.postfix
vars:
postfix_sender_canonical_maps:
- sender: root
rewrite: [email protected]
リレーを有効にするためにリレーホスト名を指定する:
---
- hosts: all
roles:
- oefenweb.postfix
vars:
postfix_aliases:
- user: root
alias: [email protected]
postfix_relayhost: mail.yourdomain.org
リレー用のドメイン名を提供し、ドメインのDNS MXレコードを使用するには:
---
- hosts: all
roles:
- oefenweb.postfix
vars:
postfix_aliases:
- user: root
alias: [email protected]
postfix_relayhost: yourdomain.org
postfix_relayhost_mxlookup: true
条件付きリレー:
---
- hosts: all
roles:
- oefenweb.postfix
vars:
postfix_transport_maps:
- pattern: '[email protected]'
result: ':'
- pattern: '*'
result: "smtp:{{ ansible_lo['ipv4']['address'] }}:1025"
postfix_sender_dependent_relayhost_maps:
- pattern: '[email protected]'
result: 'DUNNO'
- pattern: '[email protected]'
result: 'DUNNO'
- pattern: '*'
result: "smtp:{{ ansible_lo['ipv4']['address'] }}:1025"
正規表現テーブルを使用したエイリアス(すべてのローカルメールを指定されたアドレスに転送):
---
- hosts: all
roles:
- oefenweb.postfix
vars:
postfix_aliases_database_type: regexp
postfix_aliases:
- user: /.*/
alias: [email protected]
AWS SESのサポート用:
---
- hosts: all
roles:
- oefenweb.postfix
vars:
postfix_aliases:
- user: root
alias: [email protected]
postfix_relayhost: email-smtp.us-east-1.amazonaws.com
postfix_relaytls: true
# AWS IAM SESの資格情報(アクセスキーではない):
postfix_sasl_user: AKIXXXXXXXXXXXXXXXXX
postfix_sasl_password: ASDFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
MailHogのサポート用:
---
- hosts: all
roles:
- oefenweb.postfix
vars:
postfix_aliases:
- user: root
alias: [email protected]
postfix_relayhost: "{{ ansible_lo['ipv4']['address'] }}"
postfix_relayhost_port: 1025
postfix_sasl_auth_enable: false
Gmailのサポート用:
---
- hosts: all
roles:
- oefenweb.postfix
vars:
postfix_aliases:
- user: root
alias: [email protected]
postfix_relayhost: smtp.gmail.com
postfix_relaytls: true
postfix_smtp_tls_cafile: /etc/ssl/certs/ca-certificates.crt
postfix_sasl_user: 'foo'
postfix_sasl_password: 'bar'
Googleアカウントの設定で追加のセキュリティを有効にし、2段階認証を使用するように設定した場合、Postfixはメールを送信できなくなり、/var/log/mail.logファイルにエラーメッセージが表示されることがあります。
この問題を解決するには、Googleアカウント設定の(アプリとサイトの許可)ページを訪問します。このページで、許可するアプリケーション名(Postfix)を入力し、生成ボタンをクリックします。生成されたパスワードでpostfix_sasl_password変数を設定します。
未処理の設定を追加する方法を示すシンプルな例:
---
- hosts: all
roles:
- oefenweb.postfix
vars:
postfix_raw_options:
- |
milter_default_action = accept
milter_protocol = 6
smtpd_milters = unix:opendkim/opendkim.sock unix:opendmarc/opendmarc.sock unix:spamass/spamass.sock unix:clamav/clamav-milter.ctl
milter_connect_macros = "i j {daemon_name} v {if_name} _"
policyd-spf_time_limit = 3600
ライセンス
MIT
著者情報
Mischa ter Smitten
フィードバック、バグレポート、リクエスト...
ansible-galaxy install Oefenweb.postfix