前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >curl --tlsv1.x和--tls-max 1.x 参数详解

curl --tlsv1.x和--tls-max 1.x 参数详解

原创
作者头像
Windows技术交流
修改2020-04-26 15:38:44
11.6K1
修改2020-04-26 15:38:44
举报
文章被收录于专栏:Windows技术交流Windows技术交流

此篇文档为通用的,不止适用于腾讯云,其他云也适用。这2个参数非常实用,今天我就给大家讲透。

要验证curl参数--tlsv1.x首先需要升级curl版本

我升级到最新版主要是为了验证这2个参数

--tlsv1.x 这个参数并不是说客户端按你指定的tls版本去跟服务端匹配,不是==的关系,是在≥的关系里面desc降序匹配

比如支持tls1.0/1.1/1.2的Server,客户端分别以--sslv3、--tlsv1.0、--tlsv1.1、--tlsv1.2这些参数去请求,最终的结果都是以--tlsv1.2去建联,这就是我说的“在≥的关系里面desc降序匹配”

--tls-max 1.x这个参数则是限定死了,最大按哪个来

比如说服务端最大支持到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 删除。

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • --tlsv1.x 这个参数并不是说客户端按你指定的tls版本去跟服务端匹配,不是==的关系,是在≥的关系里面desc降序匹配
  • --tls-max 1.x这个参数则是限定死了,最大按哪个来
相关产品与服务
云服务器
云服务器(Cloud Virtual Machine,CVM)提供安全可靠的弹性计算服务。 您可以实时扩展或缩减计算资源,适应变化的业务需求,并只需按实际使用的资源计费。使用 CVM 可以极大降低您的软硬件采购成本,简化 IT 运维工作。
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档