[转帖]TLS 版本问题
轉帖 From?
https://www.cnblogs.com/xjnotxj/p/7252043.html
一、環境:
CentOS 6.8
nginx 1.6.0
php 7.0.10
二、背景
最近開發一個小程序,而小程序對后臺接口服務器的要求是:
1、請求域名在request合法域名中
2、基于 https 協議
3、TLS 版本 1.2+
1、2 兩條都滿足了,但是第三條亟待解決,導致小程序調用接口時報錯:
三、正文
(1)為什么要滿足 TLS 版本 1.2+ ?
2017年1月1日起,蘋果強制所有 app 滿足 HTTPS,即 iOS9 推出的 App Transport Security (ATS) 特性。
訪問?https://www.qcloud.com/product/ssl#userDefined10?,
輸入域名,檢查您的 iOS app 是否滿足 ATS 特性:
報錯了,提示不支持 TLS1.2。
(2)如何滿足 TLS 版本 1.2+ ?
1、openSSL 版本 1.0.1+
查看 openSSL 版本:
openssl version -a2、nginx 版本為 0.7.65,0.8.19 及更高版本
查看 nginx 版本:
nginx -V結果是,我的版本都符合要求。
(3)nginx 配置 TLS1.2
本人申請的是騰訊云的安全證書,官方有提供 nginx 如何配置的文檔:
https://www.qcloud.com/document/product/400/6973#1.nginx-.E8.AF.81.E4.B9.A6.E9.85.8D.E7.BD.AE
配置?nginx.conf?支持 TLS1.2 的方法如下(看?ssl_protocols?參數):
server {listen 443;server_name www.domain.com; #填寫綁定證書的域名 ssl on; ssl_certificate 1_www.domain.com_bundle.crt; ssl_certificate_key 2_www.domain.com.key; ssl_session_timeout 5m; ssl_protocols TLSv1 TLSv1.1 TLSv1.2; #按照這個協議配置 ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:HIGH:!aNULL:!MD5:!RC4:!DHE;#按照這個套件配置 ssl_prefer_server_ciphers on; location / { root html; #站點目錄 index index.html index.htm; } }四、遇到的問題
按照上文一切都做完之后,發現還是不行。
折騰好久之后。
發現,原來是 nginx 之前有配另一個 https 的 server,關于
ssl_protocols?的參數值為:
里面根本沒有包含 TLSv1.2!從而影響了我們這個 server!
所以把改成:
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;再測試:
完美。
以及啟用的方法 更高級別安全性的方法 The DEFAULT System.Net.ServicePointManager.SecurityProtocol in both .NET 4.0/4.5 is:SecurityProtocolType.Ssl3 | SecurityProtocolType.Tls..NET 4.0 supports up to TLS 1.0 while .NET 4.5 supports up to TLS 1.2However, an application targeting .NET 4.0 can still support up to TLS 1.2 if .NET 4.5 is installed in the same environment. .NET 4.5 installs on top of .NET 4.0, replacing System.dll.I've verified this by observing the correct security protocol set in traffic with fiddler4 and by manually setting the enumerated values in a .NET 4.0 project: ServicePointManager.SecurityProtocol = (SecurityProtocolType)192 |(SecurityProtocolType)768 | (SecurityProtocolType)3072;?
轉載于:https://www.cnblogs.com/jinanxiaolaohu/p/9677762.html
總結
以上是生活随笔為你收集整理的[转帖]TLS 版本问题的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 网络编程第三讲UDP编写
- 下一篇: kotlin 学习笔记(1)