Skip to content

OpenSSL:X509

신뢰할수 있는 루트 인증서 등록 하는 법

## Mac OS X Add:
$ sudo security add-trusted-cert -d -r trustRoot -k /Library/Keychains/System.keychain ~/new-root-certificate.crt
## Mac OS X Remove:
$ sudo security delete-certificate -c "<name of existing certificate>"

## Windows Add:
$ certutil -addstore -f "ROOT" new-root-certificate.crt
## Windows Remove:
$ certutil -delstore "ROOT" serial-number-hex

## Linux (Ubuntu, Debian) Add:
## 1. Copy your CA to dir /usr/local/share/ca-certificates/
## 2. Update the CA store:
$ sudo update-ca-certificates
## Linux (Ubuntu, Debian) Remove:
## 1. Remove your CA.
## 2. Update the CA store:
$ sudo update-ca-certificates –fresh
## Restart Kerio Connect to reload the certificates in the 32-bit versions or Debian 7.

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

인증기관 인증서 포함하여 제대로 인증해보자

Linux/Unix 계열에서

sudo apt-get install ca-certificates

인증서를 신뢰하는 루트 CA 인증서로 추가한다. 디렉토리 위치는:

  • /etc/ssl/certs
  • /usr/local/share/ca-certificates/

인증서 업데이트:

sudo update-ca-certificates

특정 도메인의 HTTPS(443) 접속이 가능하다면

openssl로 인증서 다운로드:

echo | openssl s_client -connect example.com:443 2>/dev/null | openssl x509 > example.crt

## 만약 DER 포맷으로 필요할 경우:
echo | openssl s_client -connect example.com:443 2>/dev/null | openssl x509 -outform DER > example.crt

GNUTLS (gnutls-cli) 로 인증서 다운로드

gnutls-cli --print-cert www.example.com < /dev/null > example.crt

macOS 에서 등록 방법

WARNING

ChatGPT 질문 결과이다. 진위여부는 다시 확인해야 한다.

시스템 루트 인증 기관 스토어에 저장:

다운로드한 SSL/TLS 인증서를 시스템 루트 인증 기관 스토어에 추가하려면 다음과 같이 터미널을 사용하여 security 명령을 실행할 수 있습니다.

sudo security add-trusted-cert -d -r trustRoot -k "/Library/Keychains/System.keychain" example.crt

개인 사용자 인증서 스토어에 저장:

개인 사용자 인증서 스토어에 SSL/TLS 인증서를 추가하려면 다음과 같이 터미널을 사용하여 security 명령을 실행합니다.

sudo security add-trusted-cert -d -r trustRoot -k "/Library/Keychains/System.keychain" example.crt

Troubleshooting

certificate signed by unknown authority

도구 설치:

sudo apt-get install ca-certificates

/etc/ssl/certs에 없는 인증서를 복사한다.

인증서 업데이트:

sudo update-ca-certificates

See also

Favorite site