此篇文档为通用的,不止适用于腾讯云,其他云也适用。这2个参数非常实用,今天我就给大家讲透。
要验证curl参数--tlsv1.x首先需要升级curl版本
我升级到最新版主要是为了验证这2个参数
比如支持tls1.0/1.1/1.2的Server,客户端分别以--sslv3、--tlsv1.0、--tlsv1.1、--tlsv1.2这些参数去请求,最终的结果都是以--tlsv1.2去建联,这就是我说的“在≥的关系里面desc降序匹配”
比如说服务端最大支持到tlsv1.2,客户端限定最大按tlsv1.3来,那最终肯定就是以tlsv1.2建联了;如果服务端不变,我指定客户端以--tls-max 1.1请求,那最终肯定是以tlsv1.1建联了
https://www.freebsd.org/cgi/man.cgi?curl(1)
其实Windows里也有curl命令,curl for windows- Download。
Windows IIS Web服务器,https的tls版本控制有个好用的软件IIS Crypto,能让你很方便地选择服务端支持哪些版本的tls协议。
该软件官网在国外,内地可能访问不了:https://www.nartac.com/Products/IISCrypto
现在已经是3.0版本了
我在2008R2上用的2.0版本
如上图,我把2008R2的IIS https限定到了tlsv1.1,如果用--tlsv1.2去测试,会报SSL_ERROR_UNSUPPORTED_VERSION,即服务端认识1.2但是不支持,如果用--tlsv1.3去测试,服务端不认识1.3直接就reset了。如果是2012R2/2016/2019的系统,系统就认识1.3了,由于我限定死了只支持1.1,所以在2012R2/2016/2019上用--tlsv1.3测试时,报SSL_ERROR_UNSUPPORTED_VERSION而不是PR_CONNECT_RESET_ERROR(言下之意,认识、但不支持)
为了方便大家测试,我把命令贴上,网站我接了cdn,不用 "--resolve domain:443:节点IP或源站IP" 来指定服务端IP的话,那https服务端就是腾讯云CDN OC节点NWS(NGINX Web Server),用ssllabs.com或myssl.com测试能看出腾讯云的NWS支持tls1.0/1.1/1.2,但是不同的客户端测试下来,好像只有tls1.2和1.0建联,为什么没有1.1呢?
对那些不支持tlsv1.1和tlsv1.2的客户端,最高只能支持到tlsv1.0,因此只能是tlsv1.0了
对那些支持tlsv1.1和tlsv1.2的客户端,优先以tlsv1.2建联
最高支持到tlsv1.1的客户端没怎么见过,能想到的就是以--tls-max 1.1去指定
综上,你在ssllabs.com或myssl.com的测试结果里看不到tls1.1的客户端。
curl --sslv2 -ksvo /dev/null "https://test.sanqinyinshi.cn/"
curl --sslv3 -ksvo /dev/null "https://test.sanqinyinshi.cn/"
curl --tlsv1.0 -ksvo /dev/null "https://test.sanqinyinshi.cn/"
curl --tlsv1.1 -ksvo /dev/null "https://test.sanqinyinshi.cn/"
curl --tlsv1.2 -ksvo /dev/null "https://test.sanqinyinshi.cn/"
curl --tlsv1.3 -ksvo /dev/null "https://test.sanqinyinshi.cn/"
curl --sslv2 -ksvo /dev/null "https://test.sanqinyinshi.cn/" --resolve test.sanqinyinshi.cn:443:139.199.198.215
curl --sslv3 -ksvo /dev/null "https://test.sanqinyinshi.cn/" --resolve test.sanqinyinshi.cn:443:139.199.198.215
curl --tlsv1.0 -ksvo /dev/null "https://test.sanqinyinshi.cn/" --resolve test.sanqinyinshi.cn:443:139.199.198.215
curl --tlsv1.1 -ksvo /dev/null "https://test.sanqinyinshi.cn/" --resolve test.sanqinyinshi.cn:443:139.199.198.215
curl --tlsv1.2 -ksvo /dev/null "https://test.sanqinyinshi.cn/" --resolve test.sanqinyinshi.cn:443:139.199.198.215
curl --tlsv1.3 -ksvo /dev/null "https://test.sanqinyinshi.cn/" --resolve test.sanqinyinshi.cn:443:139.199.198.215
curl --tls-max 1.0 -ksvo /dev/null "https://test.sanqinyinshi.cn/" --resolve test.sanqinyinshi.cn:443:139.199.198.215
curl --tls-max 1.1 -ksvo /dev/null "https://test.sanqinyinshi.cn/" --resolve test.sanqinyinshi.cn:443:139.199.198.215
curl --tls-max 1.2 -ksvo /dev/null "https://test.sanqinyinshi.cn/" --resolve test.sanqinyinshi.cn:443:139.199.198.215
curl --tls-max 1.3 -ksvo /dev/null "https://test.sanqinyinshi.cn/" --resolve test.sanqinyinshi.cn:443:139.199.198.215
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。