개발/리눅스

openSSL 설정

림쌍월 2022. 4. 8. 17:58

# EC2 OpenSSL 적용 
기본Path : /usr/local/ssl/key_store


1. 설치
yum install openssl -y

2.설치 확인
openssl version

3.개인키생성 (pwd : 1234)
*** openssl genrsa -des3 -out keyName.key 2048
ex) openssl genrsa -des3 -out xxxxx.key 2048

4.인증 요청서(CSR) 생성 
*** openssl req -new -key keyName.key -out csrName.csr
ex) openssl req -new -key xxxxx.key      -out xxxxx.csr    // 위에서 생성한 비번 입력

5.인증서(CRT) 생성
*** openssl x509 -req -days 365 -in csrName.csr -signkey keyName.key -out crtName.crt
ex) openssl x509 -req -days 365 -in xxxxx.csr      -signkey xxxxx.key      -out xxxxx.crt

6.톰캣에서 사용할 수 있는 키스토어 파일 생성
*** openssl pkcs12 -export -in crtName.crt -inkey keyName.key -out keyName.p12 -name tomcat
ex) openssl pkcs12 -export -in xxxxx.crt      -inkey xxxxx.key      -out xxxxx.p12 -name tomcat

TOMCAT server.xml 수정   ( p12 파일 사용 )
<

Connector protocol="org.apache.coyote.http11.Http11NioProtocol"
port="8443" SSLEnabled="true" maxThreads="200"
scheme="https" secure="true"
keystoreFile="/usr/local/tomcat/ssl_keystore/xxxxx.p12"
keystorePass="1234"
keystoreType="pkcs12" 
clientAuth="false"
sslProtocol="TLS" 

/>