複数のドメインと複数の IP を持つ postfix に tls/ssl を追加する

複数のドメインと複数の IP を持つ postfix に tls/ssl を追加する

私は postfix サーバーで作業しています。このサーバーは複数のドメインの複数の IP を介してメールを送信しています。一部のドメインには専用の IP アドレスがあります。その他は同じ IP 上にあります。

すべて正常に動作しています。

ここで、SSL と TLS を有効にしたいと思います。単一の IP アドレスと単一のドメインを持つ postfix サーバーに対して何をすべきかはわかっています。

cd /etc/postfix
openssl req -nodes -new -x509 -keyout dsfc.key -out dsfc.crt

次に、/etc/postfix/main.cf に以下を追加する必要があります:

smtpd_use_tls = yes
smtpd_tls_key_file = /etc/postfix/dsfc.key
smtpd_tls_cert_file = /etc/postfix/dsfc.crt
smtpd_tls_ask_ccert = yes
smtpd_tls_req_ccert = yes
smtpd_tls_security_level = encrypt
smtpd_tls_auth_only = yes
smtpd_tls_ccert_verifydepth = 1
smtpd_tls_session_cache_database = btree:/var/lib/postfix/smtpd_scache
smtpd_tls_session_cache_timeout = 86400

しかし、私のケースでそれが機能するかどうかはわかりません。ドメインごと、または IP ごとに 1 つの証明書が必要ですか? それとも、1 つの証明書ですべてのドメインに対応できますか?

ありがとう

答え1

SSL/TLS 証明書とキーは、他のすべてのドメインが通過するメール サーバーのドメイン/IP 用です。そのため、セキュア メール サーバーは、それを使用するすべてのドメインをカバーします。専用 IP は重要ではありません。最良の結果と最大限のセキュリティを得るには、使用可能な構成オプションを使用してください。smtpd_tls_security_level=encrypt を使用する予定の場合は、一部のメール サーバーは TLS のみの接続を受け入れないため、接続を受け入れないことに注意してください。暗号化を主張する場合は、メール ログをチェックして、この理由で拒否するホストがあるかどうかを確認します。/etc/postfix/tls_policy を作成し、そこにホストを追加して may を指定すると、メールが配信されます。IE:

smtp_tls_policy_maps = hash:/etc/postfix/tls_policy

そのファイルには以下のようなホストを追加できます

live.co.uk             may
live.com               may
charter.net            may
mx.west.cox.net        may
bigpond.com            may
cox.net                may

はい、TLSが強制されている場合、live.comは拒否します。ファイルの編集後にpostmapを実行することを忘れないでください。

例:

# TLS parameters
# ---------------------------------

# The default snakeoil certificate. Comment if using a purchased
# SSL certificate.
#smtpd_tls_cert_file = /etc/ssl/certs/postfix.pem
#smtpd_tls_key_file = /etc/ssl/private/postfix.pem

# Uncomment if using a custom SSL certificate.
smtpd_tls_cert_file=/path/to/ssl/example.com/cert.pem
smtpd_tls_key_file=/path/to/ssl/example.com/key.pem

# The snakeoil self-signed certificate has no need for a CA file. But
# if you are using your own SSL certificate, then you probably have
# a CA certificate bundle from your provider. The path to that goes here.
smtp_tls_CAfile=/path/to/ssl/example.com/chain.pem
smtpd_tls_CAfile=/path/to/ssl/example.com/chain.pem

# trusted CA path, where your server has the trust store of commercial certs
smtp_tls_CApath = /etc/ssl/certs
smtpd_tls_CApath = /etc/ssl/certs

smtpd_use_tls = yes
smtp_use_tls = yes
#enable ECDH
smtpd_tls_eecdh_grade = strong
#enabled SSL protocols, don't allow SSLv2 and SSLv3
smtpd_tls_protocols= !SSLv2, !SSLv3
smtpd_tls_mandatory_protocols= !SSLv2, !SSLv3
#allowed ciphers for smtpd_tls_security_level=encrypt
smtpd_tls_mandatory_ciphers = high
#allowed ciphers for smtpd_tls_security_level=may
smtpd_tls_ciphers = high
#enforce the server cipher preference
tls_preempt_cipherlist = yes
#disable following ciphers for smtpd_tls_security_level=encrypt
smtpd_tls_mandatory_exclude_ciphers = aNULL, MD5 , DES, ADH, RC4, PSD, SRP, 3DES, eNULL
#disable following ciphers for smtpd_tls_security_level=may
smtpd_tls_exclude_ciphers = aNULL, eNULL, EXPORT, DES, RC4, MD5, PSK, aECDH, EDH-DSS-DES-CBC3-SHA, EDH-RSA-DES-CBC3-SHA, KRB5-DES, CBC3-SHA
#enable TLS logging to see the ciphers for inbound connections
smtpd_tls_loglevel = 1
#enable TLS logging to see the ciphers for outbound connections
smtp_tls_loglevel = 1
smtp_tls_note_starttls_offer = yes
smtpd_tls_received_header = yes
smtpd_tls_session_cache_timeout = 3600s
tls_random_source = dev:/dev/urandom
smtpd_tls_dh1024_param_file = /etc/ssl/certs/dhparam.pem

# Note that forcing use of TLS is going to cause breakage - most mail servers
# don't offer it and so delivery will fail, both incoming and outgoing. This is
# unfortunate given what various governmental agencies are up to these days.
#

# For MTAs that reject based on encrypt TLS setting, lets do 'may' to get the mail delivered
#smtp_tls_policy_maps = hash:/etc/postfix/tls_policy

# AUTH only must be enabled when using smtpd encrypt
smtpd_tls_auth_only = yes
# Enable and force all incoming smtpd connections to use TLS.
#smtpd_tls_security_level = encrypt
# Enable and force all outgoing smtp connections to use TLS.
#smtp_tls_security_level = encrypt
# Enable (but don't force all incoming smtpd connections to use TLS.
smtpd_tls_security_level = may
# Enable (but don't force) all outgoing smtp connections to use TLS.
smtp_tls_security_level = may

# See /usr/share/doc/postfix/TLS_README.gz in the postfix-doc package for
# information on enabling SSL in the smtp client.

関連情報