openssl

개요

TLS 인증을 위해 키를 만들고 인증서를 발급하는데 사용되는 도구이다.
거의 가장 오래 된 도구라고 해도 무방하고, 다양한 기능을 제공한다.
그러나 명령어 방식이 조금 노후화돼있어서 사용이 조금 귀찮은 점도 무시할 수는 없는 점 중 하나이다.
대체제로 많은 툴들이 개발됐는데, cfssl등이 있다.
그러나 세밀한 설정을 할 때는 여전히 이거 만한 게 없다.

사용법

# rsa 방식으로 2048 비트의 개인키 생성
openssl genrsa -out webhook.key 2048
# 해당 키를 까보고 싶으면 이렇게 하면 정보를 볼 수 있다.
openssl rsa -in webhook.key -text -noout
# 굳이 공개키를 직접 꺼내보고 싶다면
openssl rsa -in webhook.key -pubout -out webhook.pub

# CSR 발행, CN은 꼭 넣어줘야 한다.
openssl req -new -key webhook.key -out webhook.csr
# CSR 내용 확인
openssl req -in webhook.csr -text -noout

# 인증서 발급
openssl x509 -req -in webhook.csr -CA ca.crt -CAkey ca.key -out webhook.crt 
# 인증서 내용 보기
openssl x509 -in webhook.crt -noout -text
# 제대로 서명됐는지 검증
openssl verify -CAfile ca.crt webhook.crt

관련 문서

이름 noteType created
TLS downgrade attack knowledge 2024-06-20
openssl knowledge 2025-01-18
cfssl knowledge 2025-01-23
PKI knowledge 2025-03-10
Cert Manager knowledge 2025-03-15
TLS knowledge 2025-04-16
Istio PeerAuthentication knowledge 2025-05-04
SPIFFE knowledge 2025-05-04
6W - PKI 구조, CSR 리소스를 통한 api 서버 조회 published 2025-03-15
5W - 이스티오 mTLS와 SPIFFE published 2025-05-11
7W - 이스티오 메시 스케일링 published 2025-06-09
E-api 서버 감사 topic/explain 2025-01-21
E-이스티오 메시 스케일링 topic/explain 2025-06-08

참고