gav*_*non 10 ubuntu encryption postfix gmail dovecot
我以为我成功保护了我的 Postfix/Dovecot 电子邮件服务器。我有一个来自 LetsEncrypt 的签名证书,它对我的域有效。
发送和接收工作正常,但由于 Gmail 开始标记不安全的电子邮件,所有从我的服务器发送的邮件都被标记为未加密。
Gmail 用户会看到“此邮件未加密”,如下所示:
在 Postfix 中main.cf,除其他设置外,我有:
# SASL, for SMTP authentication
smtpd_sasl_type = dovecot
smtpd_sasl_auth_enable = yes
smtpd_sasl_security_options = noanonymous
smtpd_sasl_path = private/auth
# TLS, for encryption
smtpd_tls_security_level = may
smtpd_tls_auth_only = no
smtpd_tls_CAfile = /etc/letsencrypt/live/mydomain.com/chain.pem
smtpd_tls_cert_file = /etc/letsencrypt/live/mydomain.com/fullchain.pem
smtpd_tls_key_file = /etc/letsencrypt/live/mydomain.com/privkey.pem
tls_random_source = dev:/dev/urandom
smtpd_client_new_tls_session_rate_limit = 10
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
smtpd_tls_exclude_ciphers =
EXP
EDH-RSA-DES-CBC-SHA
ADH-DES-CBC-SHA
DES-CBC-SHA
SEED-SHA
smtpd_tls_dh512_param_file = ${config_directory}/certs/dh_512.pem
smtpd_tls_dh1024_param_file = ${config_directory}/certs/dh_1024.pem
disable_vrfy_command = yes
smtpd_helo_required = yes
smtpd_delay_reject = yes
Run Code Online (Sandbox Code Playgroud)
在 Postfix 中master.cf,除其他设置外,我有:
smtp inet n - - - - smtpd
-o smtpd_enforce_tls=yes
-o smtpd_use_tls=yes
-o smtpd_tls_security_level=encrypt
submission inet n - - - - smtpd
-o syslog_name=postfix/submission
-o smtpd_tls_security_level=encrypt
-o smtpd_sasl_auth_enable=yes
-o broken_sasl_auth_clients=yes
Run Code Online (Sandbox Code Playgroud)
在 Dovecot 中10-ssl.conf,除其他设置外,我有:
ssl = required
ssl_ca = </etc/letsencrypt/live/mydomain.com/chain.pem
ssl_cert = </etc/letsencrypt/live/mydomain.com/fullchain.pem
ssl_key = </etc/letsencrypt/live/mydomain.com/privkey.pem
Run Code Online (Sandbox Code Playgroud)
Gmail 是否因为不信任 LetsEncrypt 证书而错误地标记了 LetsEncrypt 证书,还是我的电子邮件确实是在未加密的情况下发送的?
gav*_*non 11
我通过将这两行添加到 Postfix 来解决这个问题main.cf:
smtp_tls_security_level = may
smtpd_tls_security_level = may
Run Code Online (Sandbox Code Playgroud)
(我只是smtpd_tls_security_level因为一篇误导性的文章而设置的,该文章说所有smtp_值都被贬值以支持smtpd_。)
您的电子邮件未加密发送。如果您只是想尽最大努力,请将以下内容添加到您的 main.cf
smtp_tls_security_level = may
Run Code Online (Sandbox Code Playgroud)
要对发送到 google 的电子邮件强制执行 TLS 加密,请将其添加到您的 main.cf
# Force TLS for outgoing server connection
smtp_tls_policy_maps = hash:/etc/postfix/tls_policy
smtp_tls_CApath = /etc/postfix/rootcas/
Run Code Online (Sandbox Code Playgroud)
将 /etc/postfix/rootcas/ 替换为您信任的根 CA 的位置,并在 /etc/postfix/tls_policy 文件中添加
#/C=US/O=Equifax/OU=Equifax Secure Certificate Authority
gmail.com secure ciphers=high
google.com secure ciphers=high
googlemail.com secure ciphers=high
Run Code Online (Sandbox Code Playgroud)
这将强制发送到 gmail.com.、google.com 和 googlemail.com 的电子邮件被加密发送并验证 SMTP 服务器
如果您不想进行身份验证而只是加密(这对于具有伪造证书的站点来说是必需的),请使用
gmail.com encrypt ciphers=high
google.com encrypt ciphers=high
googlemail.com encrypt ciphers=high
Run Code Online (Sandbox Code Playgroud)
在重新启动 postfix 之前执行
postmap /etc/postfix/tls_policy
Run Code Online (Sandbox Code Playgroud)
小智 5
考虑与 SMTP 相关的客户端/服务器关系,这些设置是有意义的:
2.1. 基本结构
SMTP 设计可以描述为:
+----------+ +----------+
+------+ | | | |
| User |<-->| | SMTP | |
+------+ | Client- |Commands/Replies| Server- |
+------+ | SMTP |<-------------->| SMTP | +------+
| File |<-->| | and Mail | |<-->| File |
|System| | | | | |System|
+------+ +----------+ +----------+ +------+
SMTP client SMTP server
Run Code Online (Sandbox Code Playgroud)
(源代码:rfc5321.txt)
因此:
“smtp_tls_security_level”用于 Postfix SMTP 客户端。请参阅:http : //www.postfix.org/postconf.5.html#smtp_tls_security_level
“smtp d _tls_security_level”用于 Postfix SMTP 服务器,请参见:http : //www.postfix.org/postconf.5.html#smtpd_tls_security_level
当 postfix 将邮件传输到 gmail 时,smtp_tls_security_level设置是关联的设置。
当 postfix通过 smtp接收邮件时,smtp d _tls_security_level设置是相关的。
| 归档时间: |
|
| 查看次数: |
3919 次 |
| 最近记录: |