前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >解决Linux netcore https请求使用自签名证书忽略安全检查方法

解决Linux netcore https请求使用自签名证书忽略安全检查方法

作者头像
星哥玩云
发布2022-07-13 14:31:23
8540
发布2022-07-13 14:31:23
举报
文章被收录于专栏:开源部署开源部署

当前系统环境:CentOS 7 x64. dotnet 2.0. 不管是 ServicePointManager.ServerCertificateValidationCallback = (a, b, c, d) => true; 还是: HttpClient httpClient = new HttpClient(new HttpClientHandler() { ServerCertificateCustomValidationCallback = (a, b, c, d) => true });

都会发生错误: 错误信息大致如下: (The handler does not support custom handling of certificates with this combination of libcurl (7.29.0) and its SSL backend ("NSS/3.28.4").) ---> System.PlatformNotSupportedException: The handler does not support custom handling of certificates with this combination of libcurl (7.29.0) and its SSL backend ("NSS/3.28.4").  at System.Net.Http.CurlHandler.SslProvider.SetSslOptionsForUnsupportedBackend(EasyRequest easy, ClientCertificateProvider certProvider)  at System.Net.Http.CurlHandler.SslProvider.SetSslOptions(EasyRequest easy, ClientCertificateOption clientCertOption)

解决方案:

# yum update(可选) # yum install openssl-devel gcc #安装openssl和gcc

# 安装指定版本的curl # wget https://curl.haxx.se/download/curl-7.55.1.tar.gz # tar -zxf curl-7.55.1.tar.gz # cd curl-7.55.1 # ./configure --prefix=/usr/local/curl/ --without-nss --with-ssl=/usr/local/ssl/ # make # make install

#备份原来的curl mv /usr/bin/curl /usr/bin/curl.bak

#将安装的curl 创建软连 ln -s /usr/local/curl/bin/curl /usr/bin/curl #  curl --version #差不多输出下面的内容 #curl 7.55.1 (x86_64-pc-linux-gnu) libcurl/7.55.1 OpenSSL/1.0.2k zlib/1.2.7

#增加lib搜索目录 # vi /etc/ld.so.conf #增加 # /usr/local/curl/lib # cat /etc/ld.so.conf 差不多下面这样子 # include ld.so.conf.d/*.conf /usr/local/curl/lib

# 重新load配置 # ldconfig

本文参与 腾讯云自媒体分享计划,分享自作者个人站点/博客。
如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
相关产品与服务
命令行工具
腾讯云命令行工具 TCCLI 是管理腾讯云资源的统一工具。使用腾讯云命令行工具,您可以快速调用腾讯云 API 来管理您的腾讯云资源。此外,您还可以基于腾讯云的命令行工具来做自动化和脚本处理,以更多样的方式进行组合和重用。
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档