解决:x509: cannot validate certificate for IP 报错

简介: 问题今天调用上传接口上传文件时,遇到了一个 x509 类型报错,具体报错信息如下:2021-10-15 17:46:13.145 ERROR oss/upload.go:210 upload process Failed {"error": "Post "https://192.168.215.139:9443/store/file/upload\": x509: cannot validate certificate for 192.168.215.139 because it doesn't contain any IP SANs"}panic: send on closed cha

目录

  • 问题
  • 解决

问题

今天调用上传接口上传文件时,遇到了一个 x509 类型报错,具体报错信息如下:

2021-10-15 17:46:13.145 ERROR oss/upload.go:210 upload process Failed {"error": "Post "https://192.168.215.139:9443/store/file/upload\": x509: cannot validate certificate for 192.168.215.139 because it doesn't contain any IP SANs"}

panic: send on closed channel

解决

网上也找了很多其他方法,看似很正确,实际上没有解决自己遇到的问题,于是自己找到了一种解决方法。

首先分析问题的大致原因是认证机制出了问题。

自己回想起之前也遇到一个 x509 的报错,但是具体的错误提示不一样,于是自己怀疑他们是不是属于一类错误呢?反正也没有什么好方法,那就死马当成活马医吧!

具体命令如下,步骤一:

sudo apt-get update

输出结果:

root@al-bj-backstage-01:~# sudo apt-get update
Hit:1 http://mirrors.cloud.aliyuncs.com/ubuntu bionic InRelease
Get:2 http://mirrors.cloud.aliyuncs.com/ubuntu bionic-updates InRelease [88.7 kB]
Get:3 http://mirrors.cloud.aliyuncs.com/ubuntu bionic-backports InRelease [74.6 kB]
Get:4 http://mirrors.cloud.aliyuncs.com/ubuntu bionic-security InRelease [88.7 kB]
Get:5 http://mirrors.cloud.aliyuncs.com/ubuntu bionic-updates/main Sources [517 kB]
Get:6 http://mirrors.cloud.aliyuncs.com/ubuntu bionic-updates/main i386 Packages [1360 kB]
Get:7 http://mirrors.cloud.aliyuncs.com/ubuntu bionic-updates/main amd64 Packages [2251 kB]
Get:8 http://mirrors.cloud.aliyuncs.com/ubuntu bionic-security/main Sources [258 kB]
Get:9 http://mirrors.cloud.aliyuncs.com/ubuntu bionic-security/main amd64 Packages [1906 kB]
Get:10 http://mirrors.cloud.aliyuncs.com/ubuntu bionic-security/main i386 Packages [1055 kB]
Fetched 7600 kB in 2s (4971 kB/s)
Reading package lists... Done

步骤二:

sudo apt-get install ca-certificates -y

输出结果:

root@al-bj-backstage-01:~# sudo apt-get install ca-certificates -y
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages will be upgraded:
  ca-certificates
1 upgraded, 0 newly installed, 0 to remove and 59 not upgraded.
Need to get 145 kB of archives.
After this operation, 2,048 B disk space will be freed.
Get:1 http://mirrors.cloud.aliyuncs.com/ubuntu bionic-updates/main amd64 ca-certificates all 20210119~18.04.2 [145 kB]
Fetched 145 kB in 0s (1,866 kB/s)        
Preconfiguring packages ...
(Reading database ... 117632 files and directories currently installed.)
Preparing to unpack .../ca-certificates_20210119~18.04.2_all.deb ...
Unpacking ca-certificates (20210119~18.04.2) over (20210119~18.04.1) ...
Setting up ca-certificates (20210119~18.04.2) ...
Updating certificates in /etc/ssl/certs...
0 added, 1 removed; done.
Processing triggers for man-db (2.8.3-2ubuntu0.1) ...
Processing triggers for ca-certificates (20210119~18.04.2) ...
Updating certificates in /etc/ssl/certs...
0 added, 0 removed; done.
Running hooks in /etc/ca-certificates/update.d...
done.

重启上传服务,再次调用上传接口,报错消失,问题解决了,赞!


作者简介:😄大家好,我是 Data-Mining(liuzhen007),是一位音视频技术爱好者,前后就职于传统广电巨头和音视频互联网公司,具有丰富的音视频直播和点播相关经验,对 WebRTC、FFmpeg 和 Electron 有非常深入的了解,😄公众号:玩转音视频。同时也是 CSDN 博客专家、华为云社区云享专家、签约作者,欢迎关注我分享更多干货!😄

目录
相关文章
|
安全 Java
安装burp2022 --illegal-access=permit
安装burp2022 --illegal-access=permit
145 0
|
12天前
|
存储 网络安全
Curl error (60): SSL peer certificate or SSH remote key was not OK for https://update.cs2c.com.cn/NS/V10/V10SP2/os/adv/lic/base/x86_64/repodata/repomd.xml [SSL: no alternative certificate subject name matches target host name 'update.cs2c.com.cn']
【10月更文挑战第30天】在尝试从麒麟软件仓库(ks10-adv-os)下载元数据时,遇到 SSL 证书验证问题。错误提示为:`Curl error (60): SSL peer certificate or SSH remote key was not OK`。可能原因包括证书不被信任、证书与域名不匹配或网络问题。解决方法包括检查网络连接、导入 SSL 证书、禁用 SSL 证书验证(不推荐)、联系仓库管理员、检查系统时间和尝试其他镜像。
33 1
|
网络安全 开发工具 git
Unable to negotiate with xx.xxx.xxxx port 22: no matching host key type found. Their offer: ssh-rsa(解决的两种方式)
Unable to negotiate with xx.xxx.xxxx port 22: no matching host key type found. Their offer: ssh-rsa(解决的两种方式)
3745 0
Unable to negotiate with xx.xxx.xxxx port 22: no matching host key type found. Their offer: ssh-rsa(解决的两种方式)
|
2月前
|
网络安全
出现“Host key verification failed”错误--解决
遇到“Host key verification failed”错误,通常是因为远程主机密钥发生变化,与本地保存的信息不符。这种情况可能是远程主机系统更改或重装等原因导致的。解决方法是根据提示使用`ssh-keygen -f "/root/.ssh/known_hosts" -R "[10.61.0.152]:29022"`命令移除旧的密钥信息,然后重新尝试连接。
466 5
|
6月前
|
Unix 网络安全 数据安全/隐私保护
putty Faual Error:No supported authentication methods available (server sent: publickey)
putty Faual Error:No supported authentication methods available (server sent: publickey)
1259 0
|
6月前
|
缓存 网络安全 开发工具
Git服务器报错:host key for (ip地址) has changed and you have requested strict checking
Git服务器报错:host key for (ip地址) has changed and you have requested strict checking
531 0
|
6月前
|
安全 网络安全
Peer's certificate issuer has been marked as not trusted by the user. 是什么原因导致的
"Peer's certificate issuer has been marked as not trusted by the user" 是一个SSL/TLS错误消息,通常出现在与安全连接的服务器进行握手时。这个错误消息表示用户将证书颁发机构(Certificate Authority,CA)标记为不受信任。 这种情况可能有以下几个原因: 1. 证书过期:证书有一个有效期限,如果证书已经过期,浏览器会将其标记为不受信任。 2. 证书颁发机构不受信任:浏览器内置了一些受信任的证书颁发机构列表,如果服务器使用的证书颁发机构不在该列表中,浏览器会将其标记为不受信任。 3. 自签名证书:如
1443 0
|
6月前
|
缓存 数据安全/隐私保护 Windows
ECDSA host key for ... has changed and you have requested strict checking.Host key verification fail
ECDSA host key for ... has changed and you have requested strict checking.Host key verification fail
服务器重启后 Host key verification failed
服务器重启后 Host key verification failed
144 0
服务器重启后 Host key verification failed