buluma.postfix
Ansibleロール postfix
システムにPostfixをインストールし、設定します。
GitHub | バージョン | 課題 | プルリクエスト | ダウンロード |
---|---|---|---|---|
例のプレイブック
この例はmolecule/default/converge.yml
から取得されており、各プッシュ、プルリクエスト、リリースの際にテストされています。
---
- name: 収束
hosts: all
become: true
gather_facts: true
roles:
- role: buluma.postfix
# postfix_relayhost: "[relay.example.com]"
postfix_myhostname: "smtp.example.com"
postfix_mydomain: "example.com"
postfix_myorigin: "example.com"
postfix_mynetworks:
- 127.0.0.0/8
- 192.168.0.0/16
postfix_aliases:
- name: root
destination: [email protected]
# Ziggoの設定("email-address"と"email-password"は仮の値です)
postfix_relayhost: "[smtp.ziggo.nl]:587"
postfix_smtp_sasl_auth_enable: true
postfix_smtp_sasl_password_map: "/etc/postfix/relay_pass"
postfix_smtp_sasl_security_options: ""
postfix_smtp_tls_wrappermode: false
postfix_smtp_tls_security_level: may
postfix_smtp_sasl_password_map_content: |
[smtp.ziggo.nl]:587 email-address:email-password
マシンを準備する必要があります。CIでは、molecule/default/prepare.yml
を使用してこれを行います:
---
- name: 準備
hosts: all
become: true
gather_facts: false
roles:
- role: buluma.bootstrap
- role: buluma.core_dependencies
これらのロールの使用方法については、完全な説明と例を参照してください。
ロール変数
変数のデフォルト値はdefaults/main.yml
に設定されています。
---
# postfixのデフォルト設定ファイル
# これらの設定はPostfixに必須です。
postfix_myhostname: "{{ ansible_fqdn }}"
postfix_mydomain: "{{ ansible_domain | default('localdomain', true) }}"
postfix_myorigin: "{{ ansible_domain | default('localdomain', true) }}"
# 公開インターフェースで「リスン」するには、inet_interfacesを次のように設定します
# "all"またはインターフェースの名前(例:"eth0")。
postfix_inet_interfaces: "loopback-only"
# IPv4とIPv6がサポートされている場合は有効にし、IPv4のみの場合はipv4に設定
postfix_inet_protocols: all
# バナーを設定
postfix_banner: "$myhostname ESMTP $mail_name"
# 受け入れるメールを指定するdestination。
postfix_mydestination: $mydomain, $myhostname, localhost.$mydomain, localhost
# 他のマシンからのメールを受け入れるには、mynetworksを次のように設定します
# "- 192.168.0.0/24"。
postfix_mynetworks:
- 127.0.0.0/8
# これらの設定はPostfixサーバーの役割をリレーホストに変更します。
# postfix_relay_domains: "$mydestination"
# メールを中央のリレーサーバーに転送する場合は、relayhostを設定します。
# relayhostのAレコードに送信するために括弧を使用します。
# postfix_relayhost: "[relay.example.com]"
# メール受信の制限を設定します。
postfix_smtpd_recipient_restrictions:
- permit_mynetworks
- permit_sasl_authenticated
- reject_unauth_destination
- reject_invalid_hostname
- reject_non_fqdn_hostname
- reject_non_fqdn_sender
- reject_non_fqdn_recipient
- reject_unknown_sender_domain
- reject_unknown_recipient_domain
- reject_rbl_client sbl.spamhaus.org
- reject_rbl_client cbl.abuseat.org
- reject_rbl_client dul.dnsbl.sorbs.net
- permit
postfix_smtpd_sender_restrictions:
- reject_unknown_sender_domain
# Postfix SMTPクライアントのデフォルトのTLSセキュリティレベル
# 有効な値:dane, encrypt, fingerprint, may, none, secure, verify
postfix_smtp_tls_security_level: none
# spamassassinを有効にするには、まずspamassassinをインストールし、
# (ヒント:role: buluma.spamassassin)この2つの変数を設定します:
# postfix_spamassassin: enabled
# postfix_spamassassin_user: spamd
# clamavを有効にするには、clamavをインストールし、
# (ヒント:role: buluma.clamav)この変数を設定します:
# postfix_clamav: enabled
# ここでエイリアスを設定できます。通常、`root`をリダイレクトするのが良いプランです。
# postfix_aliases:
# - name: root
# destination: [email protected]
# ここで送信者アクセス制御を設定できます。
# postfix_sender_access:
# - domain: gooddomain.com
# action: OK
# - domain: baddomain.com
# action: REJECT
# ここで受信者アクセス制御を設定できます。
# postfix_recipient_access:
# - domain: gooddomain.com
# action: OK
# - domain: baddomain.com
# action: REJECT
# ここでSSL/TLSバージョンを無効にできます。
# postfix_tls_protocols: '!SSLv2, !SSLv3, !TLSv1, !TLSv1.1'
# ここにtransport_maps Jinja2テンプレートを指定できます
# postfix_transport_maps_template: /path/to/transport.j2
# ここにheader_checks Jinja2テンプレートを指定できます
# postfix_header_checks_template: /path/to/header_checks.j2
# ローカルビフサービスを使用するかどうか。
# postfix_biff: true
# ローカルで送信されたメールの場合、ドメイン情報がないアドレスには ".$mydomain" を追加します
# postfix_append_dot_mydomain: false
# ローカル(8)配信に使用されるエイリアスデータベース
# postfix_alias_maps: "hash:/etc/aliases"
# $virtual_mailbox_mapsテーブルの検索結果すべてのパス名に接頭辞を付けるプレフィックス
# postfix_virtual_mailbox_base: /var/mail
# 一致するドメイン内のすべての有効なアドレスに関するオプションのルックアップテーブル。
# postfix_virtual_mailbox_maps: mysql:/etc/postfix/mysql-virtual_mailbox_maps.cf
# Postfixは指定されたドメインリストについて最終的な宛先です。
# postfix_virtual_mailbox_domains: "$virtual_mailbox_maps"
# 複数のエイリアスドメインの最終宛先。
# postfix_virtual_alias_domains: "$virtual_alias_maps"
# 特定のメールアドレスやドメインを別のローカルまたはリモートのアドレスにエイリアス化するオプションのルックアップテーブル。
# postfix_virtual_alias_maps: "$virtual_maps"
# ユーザーIDのルックアップテーブル。
# postfix_virtual_uid_maps: "static:2000"
# グループIDのルックアップテーブル。
# postfix_virtual_gid_maps: "static:2000"
# Postfix SMTPサーバーでSASL認証を有効にします。
# postfix_smtpd_sasl_auth_enable: true
# Postfix SMTPサーバーSASL認証のローカルドメイン名。
# postfix_smtpd_sasl_local_domain: $myhostname
# Postfix SMTPサーバーSASLセキュリティオプション
# postfix_smtpd_sasl_security_options: noanonymous
# smtpd(8) ReceivedメッセージヘッダーでSASL認証されたユーザー名を報告します。
# postfix_smtpd_sasl_authenticated_header: true
# 古いバージョンのAUTHコマンドを実装するリモートSMTPクライアントとの相互運用性を有効にします。
# postfix_broken_sasl_auth_clients: false
# リモートSMTPクライアント証明書または中間CA証明書を信頼するroot CAの間にあるCA証明書を含むファイル。
# postfix_smtpd_tls_CAfile: /etc/letsencrypt/live/smtp.syhosting.ch/chain.pem
# Postfix SMTPサーバーのRSA証明書ファイル(PEM形式)。
# postfix_smtpd_tls_cert_file: /etc/letsencrypt/live/smtp.syhosting.ch/cert.pem
# ターゲットホストにコピーするPostfix SMTPサーバーのRSA証明書ファイル(PEM形式)。
# postfix_smtpd_tls_cert_file_source: ./certs/cert.pem
# Postfix SMTPサーバーRSAプライベートキー(PEM形式)。
# postfix_smtpd_tls_key_file: /etc/letsencrypt/live/smtp.syhosting.ch/privkey.pem
# ターゲットホストにコピーするPostfix SMTPサーバーRSAプライベートキーのローカルファイル(PEM形式)。
# postfix_smtpd_tls_key_file_source: ./certs/privkey.pem
# Postfix SMTPサーバーが使用したプロトコルや暗号に関する情報を含むReceivedメッセージヘッダーを生成するよう要求します。
# postfix_smtpd_tls_received_header: true
# Postfix SMTPクライアントのデフォルトのTLSセキュリティレベル。
# postfix_smtpd_tls_security_level: may
# リモートSMTPクライアントにクライアント証明書の要求。
# postfix_smtpd_tls_ask_ccert: true
# TLS活動の追加ログ記録を有効にします。
# postfix_smtpd_tls_loglevel: 1
# オプションのPostfix SMTPサーバーTLSセッションキャッシュのファイル名。
# postfix_smtpd_tls_session_cache_database: btree:/var/lib/postfix/smtpd_tls_session_cache
# リモートSMTPサーバー証明書または中間CA証明書を信頼するroot CAの間にあるCA証明書を含むファイル。
# postfix_smtp_tls_CAfile: /etc/letsencrypt/live/smtp.syhosting.ch/chain.pem
# Postfix SMTPクライアントRSA証明書ファイル(PEM形式)。
# postfix_smtp_tls_cert_file: /etc/letsencrypt/live/smtp.syhosting.ch/cert.pem
# Postfix SMTPクライアントRSAプライベートキー(PEM形式)。
# postfix_smtp_tls_key_file: /etc/letsencrypt/live/smtp.syhosting.ch/privkey.pem
# オプションのPostfix SMTPクライアントTLSセッションキャッシュのファイル名。
# postfix_smtp_tls_session_cache_database: btree:/var/lib/postfix/smtp_tls_session_cache
# メモリ内tlsmgr(8)の擬似乱数生成器の外部エントロピーソース。
# postfix_tls_random_source: dev:/dev/urandom
# Postfix SMTPサーバーが必須のTLS暗号化で受け入れるTLSプロトコル。
# postfix_smtpd_tls_mandatory_protocols: TLSv1
# Postfix SMTPクライアントが必須のTLS暗号化で使用するTLSプロトコル。
# postfix_smtp_tls_mandatory_protocols: TLSv1
# $virtual_mailbox_domainsにリストされたドメインへの最終配信のためのデフォルトのメール配信トランスポート。
# postfix_virtual_transport: maildrop1
# ローカル(8)ユーザーのホームディレクトリに対するメールボックスファイルのオプションのパス名。
# postfix_home_mailbox: Maildir/
# メッセージの最大サイズ(バイト単位)、封筒情報を含む。
# postfix_message_size_limit: 10240000
# リモートSMTPクライアントがMAILコマンドまたは他のコマンドを送信する前に自己紹介する必要があります。
# postfix_smtpd_helo_required: false
# クライアント接続率やその他の率を計算するための時間単位。
# postfix_anvil_rate_time_unit: 60s
# サービスへの接続試行の最大数。
# postfix_smtpd_client_connection_rate_limit: 10
# このサービスへの同時接続数の上限。
# postfix_smtpd_client_connection_count_limit: 10
# 一時的なエラーで配信に失敗した場合、バウンスメッセージを配信不能として扱います。
# postfix_bounce_queue_lifetime: 5d
# 特定のPostfixサブシステムや機能のビルド、設定、操作方法を説明するPostfix READMEファイルの場所。
# postfix_readme_directory: /usr/share/doc/postfix
# 特定のPostfixサブシステムや機能のビルド、設定、操作方法を説明するPostfix HTMLファイルの場所。
# postfix_html_directory: /usr/share/doc/postfix
# Postfixがリスンするポートを変更することができます。
# Postfixは`/etc/services`を使用して、サービス名をポート番号にマッピングします。例: `2525`
# したがって、ポート番号または`smtp`のようなサービス名を指定します。
postfix_smtp_listen_port: smtp
postfix_smtp_sasl_auth_enable: false
postfix_smtp_sasl_password_map: ""
postfix_smtp_sasl_security_options: ""
postfix_smtp_tls_wrappermode: false
postfix_smtp_sasl_password_map_content: ""
要件
- requirements.txtにリストされたpipパッケージ。
使用されるロールの状態
次のロールを使用してシステムを準備します。別の方法でシステムを準備することもできます。
要件 | GitHub | バージョン |
---|---|---|
buluma.bootstrap | ||
buluma.core_dependencies |
コンテキスト
このロールは、多くの互換性のあるロールの一部です。さらなる情報は、これらのロールのドキュメントを確認してください。
関連するロールの概要:
互換性
このロールは、以下のコンテナイメージでテストされています。コンテナイメージの詳細:
コンテナ | タグ |
---|---|
Amazon | Candidate |
EL | 9, 8 |
Debian | all |
Fedora | all |
Ubuntu | all |
Kali | all |
必要なAnsibleの最小バージョンは2.12で、テストが行われました:
- 前のバージョン。
- 現在のバージョン。
- 開発バージョン。
問題が見つかった場合は、GitHubに登録してください。