Joh*_*mBF 4 debian smtp postfix tls starttls
我想在端口 25 上启用 STARTTLS,但由于未知原因,它只能在端口 465 上工作。
大师.cf:
smtp inet n - - - - smtpd
-o syslog_name=postfix/smtp
-o smtpd_tls_wrappermode=yes
-o smtpd_sasl_auth_enable=no
-o smtpd_client_restrictions=permit_sasl_authenticated,reject
-o milter_macro_daemon_name=ORIGINATING
#smtp inet n - - - 1 postscreen
#smtpd pass - - - - - smtpd
#dnsblog unix - - - - 0 dnsblog
#tlsproxy unix - - - - 0 tlsproxy
#submission inet n - - - - smtpd
# -o syslog_name=postfix/submission
# -o smtpd_tls_security_level=encrypt
# -o smtpd_sasl_auth_enable=yes
# -o smtpd_client_restrictions=permit_sasl_authenticated,reject
# -o milter_macro_daemon_name=ORIGINATING
#smtps inet n - - - - smtpd
# -o syslog_name=postfix/smtps
# -o smtpd_tls_wrappermode=yes
# -o smtpd_sasl_auth_enable=no
# -o smtpd_client_restrictions=permit_sasl_authenticated,reject
# -o milter_macro_daemon_name=ORIGINATING
Run Code Online (Sandbox Code Playgroud)
主要.cf:
smtp_tls_loglevel = 1
smtp_tls_note_starttls_offer = yes
smtp_tls_security_level = may
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
smtp_use_tls = yes
smtpd_banner = $myhostname ESMTP $mail_name (Debian/GNU)
smtpd_client_restrictions = permit_mynetworks, reject_unknown_client
smtpd_helo_required = yes
smtpd_helo_restrictions = permit_mynetworks, reject_invalid_hostname, reject_non_fqdn_hostname
smtpd_recipient_limit = 25
smtpd_tls_CAfile = /root/chain.pem
smtpd_tls_auth_only = no
smtpd_tls_cert_file = /root/cert.pem
smtpd_tls_key_file = /root/key.pem
smtpd_tls_loglevel = 1
smtpd_tls_received_header = yes
smtpd_tls_security_level = may
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtpd_tls_session_cache_timeout = 3600s
smtpd_use_tls = yes
tls_random_prng_update_period = 3600s
tls_random_source = dev:/dev/urandom
Run Code Online (Sandbox Code Playgroud)
现在,当我尝试检查证书时出现openssl s_client -connect hostname:25此错误:
CONNECTED(00000003)
write:errno=104
no peer certificate available
No client certificate CA names sent
SSL handshake has read 0 bytes and written 308 bytes
Run Code Online (Sandbox Code Playgroud)
在端口 465 上一切正常,因此证书和 CA 链是正确的。
日志说:
postfix/smtp/smtpd[2623]: SSL_accept error
postfix/smtp/smtpd[2623]: warning: TLS library problem: 2623:error:140760FC:SSL routines:SSL23_GET_CLIENT_HELLO:unknown protocol:s23_srvr.c:649:
Run Code Online (Sandbox Code Playgroud)
非常感谢帮助!
seb*_*bix 10
SMTPS 是指基于 TLS 的 SMTP,就像 HTTPS。所以首先建立一个 TLS 连接(没有回退),然后启动 STMP。正如没有人期望在 HTTP 端口 80 上使用 HTTPS 一样,您也不应该期望任何连接到您的 STMP 服务的人发送 TLS 请求。因此,如果您强制使用 TLS,那么在端口 25 上与您的服务器的所有连接都可能会失败!
STARTTLS 使加密成为可选。首先,建立一个正常的、未加密的 SMTP 连接,然后服务器宣布它可以升级到 STARTTLS(使用所谓的 STMP 扩展)。如果服务器也支持 STARTTLS(并且已启用使用),则客户端请求升级到 TLS。
SMTPS(基于 TLS 的 SMTP)在 Postfix 中通过 启用smtpd_tls_wrappermode=yes,您为 smtp 服务设置它,因此在端口 25 上。如上所述,不推荐这样做。
我想引用的部分Bettercrypto在这个问题上两者的纸应用密码硬化master.cf和main.cf。您也可以参考它,因为您的某些设置可能main.cf会妨碍正确设置 TLS 使用。
main.cf:
# enable opportunistic TLS support in the SMTP server and client
smtpd_tls_security_level = may
smtp_tls_security_level = may
# if you have authentication enabled, only offer it after STARTTLS
smtpd_tls_auth_only = yes
Run Code Online (Sandbox Code Playgroud)
master.cf:
smtp inet n - - - - smtpd
submission inet n - - - - smtpd
-o smtpd_tls_security_level=encrypt
Run Code Online (Sandbox Code Playgroud)
我们没有在端口 25 上为 TLS 设置任何新的东西,因为main.cf我们只需要其中的默认值。
| 归档时间: |
|
| 查看次数: |
11735 次 |
| 最近记录: |