linux系统导入证书

Posted effortsing

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了linux系统导入证书相关的知识,希望对你有一定的参考价值。

https://blog.csdn.net/fy573060627/article/details/52872740

1.linux 访问 https 证书问题

[[email protected]-node2 ~]# curl https://192.168.0.200:8443
curl: (60) Peers Certificate issuer is not recognized.
More details here: http://curl.haxx.se/docs/sslcerts.html

curl performs SSL certificate verification by default, using a "bundle"
 of Certificate Authority (CA) public keys (CA certs). If the default
 bundle file isnt adequate, you can specify an alternate file
 using the --cacert option.
If this HTTPS server uses a certificate signed by a CA represented in
 the bundle, the certificate verification probably failed due to a
 problem with the certificate (it might be expired, or the name might
 not match the domain name in the URL).
If youd like to turn off curls verification of the certificate, use
 the -k (or --insecure) option.




2.现有 证书twca.cer 需要添加到 linux 证书信任列表

转换格式 .cer 到 .pem
openssl x509 -inform der -in twca.cer  -out twca.pem
 
#追加到信任列表
cat twca.pem >> /etc/pki/tls/certs/ca-bundle.crt

[[email protected]-node2 k8s]# cd /etc/kubernetes/cert/
[[email protected]-node2 cert]# ls
ca-config.json  kube-controller-manager-key.pem         kubelet-client-current.pem  kubernetes-key.pem      metrics-server.pem
ca-key.pem      kube-controller-manager.pem             kubelet.crt                 kubernetes.pem
ca.pem          kubelet-client-2018-09-11-11-01-24.pem  kubelet.key                 metrics-server-key.pem
[[email protected]-node2 cert]# cat ca.pem >> /etc/pki/tls/certs/ca-bundle.crt
[[email protected]-node2 cert]# cat ca-key.pem >> /etc/pki/tls/certs/ca-bundle.crt




3.添加后访问就不会出现上面错误,


[[email protected]-node2 cert]# curl https://192.168.0.200:8443
{
  "kind": "Status",
  "apiVersion": "v1",
  "metadata": {
    
  },
  "status": "Failure",
  "message": "Unauthorized",
  "reason": "Unauthorized",
  "code": 401
}[[email protected]-node2 cert]# 

 

以上是关于linux系统导入证书的主要内容,如果未能解决你的问题,请参考以下文章

Linux下导入SSL证书(配置用于Apache)

Android 逆向Linux 文件权限 ( Linux 权限简介 | 系统权限 | 用户权限 | 匿名用户权限 | 读 | 写 | 执行 | 更改组 | 更改用户 | 粘滞 )(代码片段

证书私钥不能导出pfx格式,只能cer等格式

java将SSL证书导入系统密钥库

将代码签名证书导入浏览器

win7联想oem证书导入问题