프론트엔드 : “재성님 통신이 안되는데요..?” 🙄
나 (백엔드) : “네 ..?”
프론트엔드 : “PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target”라고 하네요??
나 (백엔드) : “Postman API는 잘 되는데..” 😥

“Openssl 통신에 등록되어 있지 않은 SSL 도메인과 통신을 할거냐?”

✔ OpenSSL을 윈도우에서 확인해보자.
Win32/Win64 OpenSSL Installer for Windows - Shining Light Productions
Minimum system requirements: Windows XP or later 32MB RAM 200MHz CPU 30MB hard drive space Recommended system requirements: Windows XP or later 128MB RAM 500MHz CPU 300MB hard drive space September 9, 2021 - OpenSSL 3.0 is available. Users should currently
slproweb.com

나는 참고로 Win64 OpenSSL MSI를 다운받았다.
설치를 마지막에, Donation은 미안하지만 무시했다.. 😢
cd C:\Program Files\OpenSSL-Win64\bin
openssl.exe openssl s_client -connect 도메인 주소:443
CONNECTED(000001C8)
depth=0 C = KR, ST = {지역명}, O = "{인증서 기관명칭}. ,Ltd.", CN = *.도메인
verify error:num=20:unable to get local issuer certificate
verify return:1
depth=0 C = KR, ST = {지역명}, O = "{인증서 기관명칭}. ,Ltd.", CN = *.도메인
verify error:num=21:unable to get local issuer certificate
verify return:1
depth=0 C = KR, ST = {지역명}, O = "{인증서 기관명칭}. ,Ltd.", CN = *.도메인
verify return:1
---
Certificate chain
... 생략 ...
---
Server certificate
-----BEGIN CERTIFICATE-----
... 생략 ...
-----END CERTIFICATE-----
... 생략 ...
---
No client certificate CA names sent
Peer signing digest: SHA256
Peer signature type: RSA-PSS
Server Temp Key: X25519, 253 bits
---
SSL handshake has read 2438 bytes and written 421 bytes
Verification error: unable to verify the first certificate
---
... 생략 ...
SSL-Session:
Protocol : TLSv1.2
... 생략 ...
Start Time: 1662351809
Timeout : 7200 (sec)
Verify return code: 21 (unable to verify the first certificate)
Extended master secret: yes
---
closed
CONNECTED(000001C8)
depth=0 C = KR, ST = {지역명}, O = "{인증서 기관명칭}. ,Ltd.", CN = *.도메인
verify error:num=20:unable to get local issuer certificate
verify return:1
depth=0 C = KR, ST = {지역명}, O = "{인증서 기관명칭}. ,Ltd.", CN = *.도메인
verify error:num=21:unable to get local issuer certificate
verify return:1
depth=0 C = KR, ST = {지역명}, O = "{인증서 기관명칭}. ,Ltd.", CN = *.도메인
verify return:1
아마 와일드카드 인증서는 인증이 되었지만, ROOT 인증서가 없어서 발생하는 문제로 보인다.
와일드카드 인증서도 ROOT 인증서와 체인들이 필요할테니 말이다.
unable to get local issuer certificate
✔ SSL 인증서를 다시 만들어주자 (PEM-formatted SSL Certificate)
# cat 개인키_파일 + 서버인증서 + 루트_체인인증서 > 엮어서 파일 덮어쓰기
cat domain.com_privateKey_nopass.pem star_domain_com_cert.pem Chain_RootCA_Bundle.crt > ./star_domain_com.pem
-----END RSA----------BEGIN RSA------ (이런 부분은 직접 개행해줍니다)
....
-----END RSA-----
중간체인2 인증서 → 중간체인1 인증서 → ROOT 인증서
# Linux or UNIX-like Operating Systems:
cat ComodoRSADomainValidationSecureServerCA.crt ComodoRSAAddTrustCA.crt AddTrustExternalCARoot.crt > yourDomain.ca-bundle
# Windows or DOS:
copy ComodoRSADomainValidationSecureServerCA.crt + ComodoRSAAddTrustCA.crt + AddTrustExternalCARoot.crt yourDomain.ca-bundle
cat ChainCA2.crt ChainCA1.crt RootCA.crt > domain.ca-bundle (혹은 domain.crt)
What is CA bundle? Creating my own bundle file
Our site uses cookies We use cookies to provide our services and analyze site usage in accordance with our Privacy Policy. By choosing "Accept", you agree to the storage of all types of cookies used on the site. If you do not wish to use optional cookies,
cleantalk.org
✔ 서버 재기동 및 확인
cd C:\Program Files\OpenSSL-Win64\bin
openssl.exe openssl s_client -connect 도메인 주소:443
CONNECTED(000001CC)
depth=3 C = GB, ST = Greater Manchester, L = Salford, O = Comodo CA Limited, CN = AAA Certificate Services
verify error:num=19:self-signed certificate in certificate chain
verify return:1
depth=3 C = GB, ST = Greater Manchester, L = Salford, O = Comodo CA Limited, CN = AAA Certificate Services
verify return:1
depth=2 C = US, ST = New Jersey, L = Jersey City, O = The USERTRUST Network, CN = USERTrust RSA Certification Authority
verify return:1
depth=1 C = GB, ST = Greater Manchester, L = Salford, O = Sectigo Limited, CN = Sectigo RSA Organization Validation Secure Server CA
verify return:1
depth=0 C = KR, ST = {지역명}, O = "{인증서 기관명칭}. ,Ltd.", CN = *.도메인
verify return:1
---
Certificate chain
... 인증서 체인 부분입니다 ...
... 생략합니다 ...
---
✔ 마치면서
✔ 참고
What is CA bundle? Creating my own bundle file
Our site uses cookies We use cookies to provide our services and analyze site usage in accordance with our Privacy Policy. By choosing "Accept", you agree to the storage of all types of cookies used on the site. If you do not wish to use optional cookies,
cleantalk.org
how does an SSL certificate chain bundle arranged?
I have 4 certificate files like this: 1.certum_certificate.crt 2.certum_certificate.pem 3.Intermediate_CA2.cer 4.Intermediate_CA.cer 5.Root_CA.cer I put these files content by this order in a bundle
stackoverflow.com
'AWS, Infra > linux' 카테고리의 다른 글
우분투에서 서버 로그 확인하는 방법 (0) | 2023.12.16 |
---|---|
[AWS] Apache - Tomcat 연동하기 (mod_jk) (0) | 2023.03.12 |
[AWS] 리눅스에서 라우팅 테이블을 날려버린 경우 (VPC 사용) (0) | 2022.05.07 |
[AWS] Centos7 서비스 등록하기 (Reboot시 서비스 자동 시작) (0) | 2022.04.30 |
댓글