参考:https://blog.scottlowe.org/2018/08/20/troubleshooting-tls-certificates/

我最近正在写一篇博客文章,内容涉及使用TLS证书进行加密和身份验证,但遇到了错误。我检查了所有“常见的嫌疑犯”,包括AWS安全组,主机级防火墙规则(通过iptables)以及应用程序配置本身,但仍然无法使其正常工作。当我终于找到错误时,我认为如果其他人发现它有用时,可能值得分享我使用的命令。

该错误本身表现出来,因为我能够在回送地址上成功连接到应用程序(使用TLS),但无法成功分配给网络适配器的IP地址。使用ss -lnt,我验证了该应用程序正在侦听所有IP地址(而不仅仅是回送),并且如前所述,我还验证了AWS安全组和主机级防火墙没有起作用。这使我相信我的TLS配置有问题。

由于应用程序的错误消息非常模糊(甚至与远程TLS无关),所以我决定尝试使用curl来验证TLS是否正常工作。首先,我运行以下命令:

curl --cacert /path/to/CA/certificate https://127.0.0.1 -v

经过一些输出后,curl报告此错误:

curl: (35) gnutls_handshake() failed: certificate is bad

最初,我认为这是证书确实有问题,但是我很快意识到这是一个预期的错误-启用了TLS身份验证,并且我没有提供curl正确的参数。因此,这次我使用正确的参数再次尝试:

curl --cacert /path/to/CA/certificate \
--cert /path/to/client/certificate \
--key /path/to/client/certificate/key \
https://127.0.0.1 -v

这次连接成功,并且curl命令的输出显示TLS加密和身份验证就位且成功。

【curl】certificate is bad 问题解决的更多相关文章

  1. PHP Curl Accept-Encoding: gzip乱码问题解决

    在使用php curl对接hugegraph的过程中,发现向gremlin发送结果返回乱码,截图如下: 发现返回乱码的乱码请求中有Accept-Encoding: gzip,即返回的内容采用了gzip ...

  2. docker 1.10.3 里php出现 curl 56错误码问题解决

    http://www.cnblogs.com/fengwei/p/5899018.html

  3. php中curl返回false的解决办法

    本文介绍一下自己在使用curl中遇到的问题解决办法.希望可以帮助到大家. 原文地址:代码汇个人博客 http://www.codehui.net/info/37.html 首先来看一个封装的curl函 ...

  4. 使用CURL出现certificate verify failed错误的解决方法

    今天使用CURL访问微信平台接口时遇到一个错误,返回错误代码如下: ? 1 2 SSL certificate problem, verify that the CA cert is OK. Deta ...

  5. cURL error 60: SSL certificate problem...

    php在curl的时候报错 cURL error 60: SSL certificate problem: unable to get local issuer certificate (see ht ...

  6. curl: (60) SSL certificate problem: unable to get local issuer certificate 错误

    今天同事做微信管理的项目,请求接口返回如下错误SSL certificate problem: unable to get local issuer certificate. 此问题的出现是由于没有配 ...

  7. curl: (60) SSL certificate problem: unable to get local issuer certificate

    国内私募机构九鼎控股打造APP,来就送 20元现金领取地址:http://jdb.jiudingcapital.com/phone.html 内部邀请码:C8E245J (不写邀请码,没有现金送) 国 ...

  8. ...cURL error 60: SSL certificate problem: unable to get local issuer certificate...

    问题描述: 在做PHP爬虫的时候, 安装了 guzzle 和 dom-crawler 之后, 调用的时候出现问题, 如下 报错内容:  Fatal error: Uncaught GuzzleHttp ...

  9. PHP curl出现SSL certificate problem: self signed certificate in certificate chain

    使用PHP curl请求https的时候出现错误“SSL certificate problem: self signed certificate in certificate chain”,这种情况 ...

随机推荐

  1. ArrayList 与LinkedList 的区别及分别的优缺点

    ArrayList,与LinkedList都是属于实现了List接口的类.首先从名字前缀开始看  ,Array表示数组,Link表示链表. 所以ArrayList底层是基于动态数组的.而LinkedL ...

  2. NumPy的Linalg线性代数库探究

    1.矩阵的行列式 from numpy import * A=mat([[1,2,4,5,7],[9,12,11,8,2],[6,4,3,2,1],[9,1,3,4,5],[0,2,3,4,1]]) ...

  3. 机房断电,导致xfs文件系统损坏

    记一次机房断电,导致xfs文件系统损坏处理方法 挂载时报以下错误: mount: mount /dev/sdb on /dev/sdb failed: Structure needs cleaning ...

  4. 转储Active Directory数据库

    获取Windows域控所有用户hash: 参考:3gstudent 方法1: 复制ntds.dit: 使用NinjaCopy,https://github.com/3gstudent/NinjaCop ...

  5. [codewars] - int32 to IPv4 二进制十进制 ip地址转换

    原题 https://www.codewars.com/kata/int32-to-ipv4/train/java Take the following IPv4 address: 128.32.10 ...

  6. 开源项目 03 DocX

    using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.T ...

  7. 62、Spark Streaming:容错机制以及事务语义

    一. 容错机制 1.背景 要理解Spark Streaming提供的容错机制,先回忆一下Spark RDD的基础容错语义: 1.RDD,Ressilient Distributed Dataset,是 ...

  8. 获取页面scroll高度

    记录一下获取 scroll 高度的方法 经实际测试: document.body.scrollTop 在 chrome 下会返回0. 所以 document.documentElement.scrol ...

  9. GoCN每日新闻(2019-10-19)

    GoCN每日新闻(2019-10-19) Go 1.13中的错误处理 https://tonybai.com/2019/10/18/errors-handling-in-go-1-13 golang核 ...

  10. Echarts 入门操作

    Echarts具有丰富的图表,可以说是数据可视化的神器: 1.下载Echarts 到官网或者点击以下文字[下载Echarts]即可下载: ①官网下载地址:https://echarts.baidu.c ...