大网数据广告活动
服务器运维问答

Force applications to use TLS 1.2 for certain domains

· 52CE 我爱测

I have a Debian Buster server that is unable to establish an HTTPS/SSL connection to several servers unless I force a TLS 1.2 connection using the openssl s_client -tls1_2 command. The errors from various clients are: openssl s_c…

问题原文

原帖链接 · carlin.scott · CC BY-SA 4.0

I have a Debian Buster server that is unable to establish an HTTPS/SSL connection to several servers unless I force a TLS 1.2 connection using the openssl s_client -tls1_2 command.

The errors from various clients are:

  • openssl s_client - "SSL handshake has read 0 bytes"
  • wget - "GnuTLS: The TLS connection was non-properly terminated."
  • curl - "OpenSSL SSL_connect: SSL_ERROR_SYSCALL"
  • dotnet nuget restore - "Received an unexpected EOF or 0 bytes from the transport stream."

openssl.cnf already has MinProtocol = TLSv1.2 by default.

The impacted servers are:

  • api.nuget.org
  • packages.microsoft.com
  • production.cloudflare.docker.com

How do I force my server to use TLS 1.2 when connecting to these domains?

已采纳解答

原帖链接 · carlin.scott · CC BY-SA 4.0

For applications that use OpenSSL, you can set the MinProtocol and MaxProtocol version to TLSv1.2 to force all connections to use TLSv1.2. I know of no way to set this per domain. This is not advisable because some servers only support TLSv1.3, so connections to them will fail.

  1. Open openssl.cnf: vi /etc/ssl/openssl.cnf
  2. Scroll to the bottom: Shift-G
  3. Insert a new line: Shift-O
  4. Add MaxProtocol = TLSv1.2

For applications that use GnuTLS, for example apt, you can disable other versions of TLS in the system-wide GnuTLS configuration file, probably /etc/gnutls/config:

[overrides]
disabled-version = tls1.0
disabled-version = tls1.1
disabled-version = tls1.3

See Disabling algorithms and protocols.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2020-12-22)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。