解决:x509: cannot validate certificate for IP 报错
Posted Data-Mining
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了解决: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 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.
重启上传服务,再次调用上传接口,报错消失,问题解决了,赞!
以上是关于解决:x509: cannot validate certificate for IP 报错的主要内容,如果未能解决你的问题,请参考以下文章
带你解决 docker 拉取镜像报错:x509: certificate has expired or is not yet valid
x509: certificate has expired or is not yet valid: current time 问题解决
docker报错: x509: certificate has expired or is not yet valid
Error: Cannot find a valid baseurl for repo 解决方法
x509 certificate has expired or is not yet valid
成功解决Failed to execute stage ‘Setup validation’: Cannot locate gluster packages