Peer certificate cannot be authenticated with given CA certificates CentOS 8

Topic: curl: (60) Peer certificate cannot be authenticated with known CA certificates  (Read 12898 times)

0 Members and 1 Guest are viewing this topic.

Today I got this message

curl: (60) Peer certificate cannot be authenticated with known CA certificates
More details here: //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 isn't 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 you'd like to turn off curl's verification of the certificate, use
 the -k (or --insecure) option.

I have COMODO SSL cert installed, and everything was ok, until this morning.
How do I fix this, without turning off curl's verification.

Logged

try this
yum update ca-certificates

if that doesn't help then
yum reinstall ca-certificates

Logged

curl 은 기본적으로 https 사이트의 SSL 인증서를 검증한다. 인증 기관의 인증서 목록이 없거나 모르는 기관에서 발급한 인증서일 경우 다음과 같은 인증서 검증 에러를 발생시키고 동작을 중지하게 된다.

cURL error 60: SSL certificate problem: unable to get local issuer certificate (see //curl.haxx.se/libcurl/c/libcurl-errors.html)

BASH

해결방법은 3가지가 있다.

1. 인증서 검증 안 함

검증을 하지 않는 옵션인 -k(--insecure) 옵션을 주고 curl 을 구동하면 된다.

curl -k -L google.com

BASH

curl --insecure -L google.com

BASH

2. 인증기관 목록 추가하기

2번째 방법은 curl 의 신뢰하는 인증 기관 목록(CA List; Certificate Authority List)에 접속하려는 사이트의 인증서를 발급한 기관을 추가하는 방법이다.

1.  먼저 curl 을 -v 옵션을 주고 실행해서 CA List 파일이 어디에 있는지 위치를 확인한다.

RHEL/CentOS 는 아래와 같이 /etc/pki/tls/certs/ca-bundle.crt 에서 CA 목록을 로딩함

lesstif@localhost:~> curl -v //google.com   * About to connect() to google.com port 443 (#0) * Trying 74.125.128.139... connected * Connected to google.com (74.125.128.139) port 443 (#0) * Initializing NSS with certpath: sql:/etc/pki/nssdb * CAfile: /etc/pki/tls/certs/ca-bundle.crt CApath: none

BASH

Ubuntu 는 /etc/ssl/certs/ca-certificates.crt 또는  /etc/ssl/certs 디렉터리에서 CA 목록 로딩

Windows 에서 curl.exe 를 사용시 다음 순서대로 ca-bundle.crt 를 찾음

  1. application's directory
  2. current working directory
  3. Windows System directory (e.g. C:\windows\system32)
  4. Windows Directory (e.g. C:\windows)
  5. all directories along %PATH%

2. 서버 인증서 및 CA List 를  BASE64 로 저장한 내용을 위에서 확인한 ca-bundle.crt 파일에 추가해 준다. 자세한 방법은 https 연결시 서버의 SSL 인증서 추출하기 (curl 또는 web browser 사용) 를 참고한다.

3. 런타임에 옵션으로 CA List 파일을 지정하려면 curl 실행시 --cacert  옵션으로 CA  List를 지정할 수 있다.

curl -v --cacert myca-bundle.crt //google.com

BASH

3. CA 인증서 파일 갱신

새로운 인증 기관이 생겼는데 OS 에 포함된 curl 에는 반영이 안 되서 발생할 수 있다. curl 홈페이지에서는 주기적으로 최신 인증 기관 목록을 갱신햇 배포하므로 CA 인증서 목록을 다운받아서 기존 파일에 덮어써도 된다.

1. wget 또는 curl  명령을 사용해서 //curl.haxx.se/ca/cacert.pem 에서 인증서를 다운받는다. 

wget 사용

wget --no-check-certificate //curl.haxx.se/ca/cacert.pem

BASH

curl 사용

curl -k -O //curl.haxx.se/ca/cacert.pem

CODE

2. curl -v 옵션으로 CA 인증서 목록 파일의 위치를 확인한 후에 예전 파일은 백업하고 다운받은 인증서 파일을 덮어쓴다.

curl 사용

sudo cp cacert.pem  /etc/ssl/certs/ca-certificates.crt 

CODE

PHP 에서 curl 사용시

Guzzle - cURL error 60: SSL certificate problem: unable to get local issuer certificate 문제 해결 을 참고

같이 보기

  • java keytool 사용법 - Keystore 생성, 키쌍 생성, 인증서 등록 및 관리
  • Guzzle - cURL error 60: SSL certificate problem: unable to get local issuer certificate 문제 해결
  • git 에서 https repository 연결시 SSL 인증서 오류 해결법
  • Java 에서 ValidatorException 등 인증서 관련 에러 해결 - keystore에 SSL/TLS 인증서를 import 하기
  • SSL Intermediate 인증서 모음(github gist)

How do I fix peer certificate Cannot be authenticated with given CA certificates?

It can be caused by the fact that the certificate is self-signed. To avoid the error, disable the verification from the GitHub side by clicking the Disable SSL verification button for the corresponding webhook.

How do I fix curl Error 60?

Solution:.
Save the cacert. pem file anywhere on your system. Example: Since you're modifying both php. ... .
Open your php.ini file. If your php.ini file doesn't have the curl.cainfo line, just add it to the end of the file, then add the file path where you saved your cacert.pem file: ... .
Restart your server..

How do I add a certificate to ETC PKI TLS certs CA bundle CRT?

Linux (CentOs 6).
Install the ca-certificates package: yum install ca-certificates..
Enable the dynamic CA configuration feature: update-ca-trust force-enable..
Add it as a new file to /etc/pki/ca-trust/source/anchors/: cp foo.crt /etc/pki/ca-trust/source/anchors/.
Use command: update-ca-trust extract..

Toplist

Neuester Beitrag

Stichworte