简体   繁体   English

仅允许TLS 1.0后,仍可以进行TLS 1.2握手

[英]TLS 1.2 handshake still possible after only allowing TLS 1.0

A customer of mine turned off TLS 1.0 at the OS-level. 我的一个客户在操作系统级别关闭了TLS 1.0。 After that the connection to our product didn't work anymore. 之后,与我们产品的连接不再起作用。 The customer does not have the latest version which uses .NET 4.6.1. 客户没有使用.NET 4.6.1的最新版本。

As we don't specify the protocol used, we are relying on the default value. 由于我们未指定所使用的协议,因此我们依赖默认值。 According to https://support.microsoft.com/en-us/help/3069494/cannot-connect-to-a-server-by-using-the-servicepointmanager-or-sslstre .NET 4.6 enables TLS 1.2 by default, which would be perfect and what we want. 根据https://support.microsoft.com/zh-CN/help/3069494/cannot-connect-to-a-server-by-using-the-servicepointmanager-or-sslstre的规定, .NET 4.6默认启用TLS 1.2,这将是完美的,也是我们想要的。

I wanted to play around with some configurations, for a better understanding. 我想尝试一些配置,以更好地理解。 I specified to only allow TLS 1.0 at the code-level with: 我指定了仅在代码级使用以下代码的TLS 1.0:

ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls;

To test the handshake I used openssl. 为了测试握手,我使用了openssl。 It works perfectly with TLS 1.0, as it should. 它应该与TLS 1.0完美配合。 But to my astonishment the handshake also works with TLS 1.2. 但令我惊讶的是,握手也适用于TLS 1.2。

$ openssl s_client -connect localhost:30050 -tls1_2
<..snip..>
SSL-Session:
    Protocol  : TLSv1.2
    <..snip..>

Are there some .NET or TLS rules I am overseeing? 我要监管一些.NET或TLS规则吗? To my understanding TLS 1.2 should not be possible, when specifying TLS 1.0 as the only protocol. 据我了解,当将TLS 1.0指定为唯一协议时,TLS 1.2应该是不可能的。

mjwills in the comments asked, if the SecurityProtocol -Property impacts inbound or outbound connections. mjwills将在评论中询问SecurityProtocol -Property是否会影响入站或出站连接。

After some research I found the post How do I disable SSL fallback and use only TLS for outbound connections in .NET? 经过一番研究后,我发现了如何禁用SSL后备并且仅将TLS用于.NET中的出站连接? (Poodle mitigation) which had a comment that would answer the question: (缓解狮子狗) ,其中有一条评论可以回答这个问题:

You only need to set System.Net.ServicePointManager.SecurityProtocol if you are initiating outbound connections from .NET code , eg connecting to a web service or API from custom code running on your server. 如果要从.NET代码启动出站连接 ,例如,从服务器上运行的自定义代码连接到Web服务或API,则只需设置 System.Net.ServicePointManager.SecurityProtocol。 If you are only running a simple web site, and you are only accepting incoming connections from browsers, then the registry fix is enough. 如果您仅运行一个简单的网站,并且仅接受来自浏览器的传入连接,则注册表修复程序就足够了。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM