
저는 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
SSL/TLS 인증서 및 키는 다른 모든 도메인이 통과하는 메일 서버 도메인/IP용이므로 보안 메일 서버는 이를 사용하는 모든 도메인을 포함하므로 전용 IP는 아무런 의미가 없습니다. 최상의 결과와 최대의 보안을 위해 사용 가능한 구성 옵션을 사용하십시오. smtpd_tls_security_level=encrypt를 사용하려는 경우 일부 메일 서버는 TLS 전용 연결을 허용하지 않기 때문에 연결을 허용하지 않는다는 점을 인식하세요. 암호화를 고집한다면 메일 로그를 확인하고 이런 이유로 거부하는 호스트가 있는지 확인하세요. /etc/postfix/tls_policy를 생성하고 거기에 호스트를 추가하고 메일이 전달되도록 지정할 수 있습니다. 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.