extract the CA cert for a particular server

Ignore Peer SSL certificate verification 

libcurl performs peer SSL certificate verification by default. This is done by using a CA certificate store that the SSL library can use to make sure the peer‘s server certificate is valid.

If you communicate with HTTPS, FTPS or other TLS-using servers using certificates that are signed by CAs present in the store, you can be sure that the remote server really is the one it claims to be.

If the remote server uses a self-signed certificate, if you don‘t install a CA cert store, if the server uses a certificate signed by a CA that isn‘t included in the store you use or if the remote host is an impostor impersonating your favorite site, and you want to transfer files from this server, do one of the following:

  1. Tell libcurl to not verify the peer. With libcurl you disable this with curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, FALSE);

    With the curl command line tool, you disable this with -k/--insecure.

  2. Get a CA certificate that can verify the remote server and use the proper option to point out this CA cert for verification when connecting. For libcurl hackers: curl_easy_setopt(curl, CURLOPT_CAPATH, capath);

    With the curl command line tool: --cacert [file]

Get cert:

openssl s_client -connect xxxxx.com:443 |tee logfile

type "QUIT", followed by the "ENTER" key

The certificate will have "BEGIN CERTIFICATE" and "END CERTIFICATE" markers.

  • -----BEGIN CERTIFICATE-----

    fiQffffpAsiHZ0qZm+ixhTxgkasCKeff5CavSWAvqD7SnpHQ==f

    -----END CERTIFICATE-----

If you want to see the data in the certificate, you can do: "openssl x509 -inform PEM -in certfile -text -out certdata" where certfile is the cert you extracted from logfile. Look in certdata.

If you want to trust the certificate, you can add it to your CA certificate store or use it stand-alone as described. Just remember that the security is no better than the way you obtained the certificate.

时间: 2024-08-08 23:57:10

extract the CA cert for a particular server的相关文章

git Problem with the SSL CA cert (path? access rights?)

问题: [[email protected] opt]# git clone https://github.com/docker/docker.git 正克隆到 'docker'...fatal: unable to access 'https://github.com/docker/docker.git/': Problem with the SSL CA cert (path? access rights?) 解决方法: 1,查看是否存在ca-bundle.crt, [[email prot

PHP Problem with the SSL CA cert (path? access rights?)

开发遇到问题,直接使用系统的curl命令正常,使用php的curl模块报错 错误:PHP Problem with the SSL CA cert (path? access rights?) 解决方法: 1.安装 yum reinstall openssl ca-certificates -y 2.重启php

error: SSL certificate problem, verify that the CA cert is OK

error: SSL certificate problem, verify that the CA cert is OK. Details:error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed while accessing https://github.com**** 解决办法 git config --global http.sslVerify false error: SSL c

解决PHP curl https时error 77(Problem with reading the SSL CA cert (path? access rights?))

服务器环境为CentOS,php-fpm,使用curl一个https站时失败,打开curl_error,捕获错误:Problem with reading the SSL CA cert (path? access rights?) 解决方案:1. sudo yum install ca-certificates (无论有没有,安装确认一下) 2. 重启php-fpm,这步比较重要,更改底层的东西时一定要重启一下 3. curl时设置:curl_setopt($ch, CURLOPT_SSL_V

在python使用SSL(HTTPS)

在python上使用SSL有许多场景,我主要关注的是使用python访问HTTPS资源,以及使用python提供HTTPS服务.(HTTPS是SSL在WEB上的应用之一) 一.使用python访问HTTPS网站 这应该算是最简单也是最常见的场景了.我们使用python做为客户端去访问公网上的网站,而这个网站为了传输安全(避免被劫持或者窃听)使用了HTTPS服务,传输过程内容都经过了SSL加密.下面来看下具体的python代码,这里使用的是python2.7.11,用的是python自带的urll

kubernetes高级之动态准入控制

系列目录 动态准入控制器文档介绍了如何使用标准的,插件式的准入控制器.但是,但是由于以下原因,插件式的准入控制器在一些场景下并不灵活: 它们需要编译到kube-apiserver里 它们仅在apiserver启动的时候可以配置 准入钩子(Admission Webhooks 从1.9版本开始)解决了这些问题,它允许准入控制器独立于核心代码编译并且可以在运行时配置. 什么是准入钩子 准入钩子是一种http回调,它接收准入请求然后做一些处理.你可以定义两种类型的准入钩子:验证钩子和变换钩子.对于验证

Web Server CA证书签名步骤和自签名测试,支持多域名

Web Server支持HTTPS访问需要两个文件,私钥和证书.私钥和证书都放在服务器上,私钥用来加密数据,证书传递给客户端.自己签名的证书在传递给浏览器的时,因为证书不被信任,所以会弹出连接不安全,一般点高级->继续浏览,还是可以访问网页.如果我们的证书被根证书厂商签名过的话,就不会弹出不安全的提示,浏览器地址栏一般还有绿色小锁标志.以下来说一下怎么一步步生成证书. 1. 使用openssl生成私钥文件server.key,以下的步骤都是在Ubuntu上的使用openssl操作的,需要注意一下

openssl创建CA、申请证书及其给web服务颁发证书

一.创建私有的CA   1)查看openssl的配置文件:/etc/pki/tls/openssl.cnf   2)创建所需的文件 touch /etc/pki/CA/index.txt   echo 01 >/etc/pki/CA/serial 3)CA自签证书生成私钥 cd /etc/pki/CA (umask 066;openssl genrsa -out /etc/pki/CA/private/cakey.pem 2048) 4)生成自签名证书 openssl req -new -x50

使用 openssl 命令行构建 CA \b及证书(一)

使用 openssl 命令行构建 CA \b及证书 这是一篇快速指南,使用 OpenSSL 来生成 CA (证书授权中心certificate authority).中级 CAintermediate CA和末端证书end certificate.包括 OCSP.CRL 和 CA颁发者Issuer信息.具体颁发和失效日期. 我们将设置我们自己的根 CAroot CA,然后使用根 CA 生成一个示例的中级 CA,并使用中级 CA 签发最终用户证书. 为根 CA 创建一个目录,并进入: mkdir