파닥이

[spring] SSL 설정 정리 본문

IT/Spring

[spring] SSL 설정 정리

알라이또 2019. 5. 13. 17:45
반응형

HTTPS와 SSL인증서 설명

 

참고한 블로그 : https://hamait.tistory.com/330

 

 

requires the APR/native library which is not available 에러시

tcnative-1.dll 다운로드 한후 tcnative-1.dll 를 tomcat 디렉토리 bin 폴더안에 넣어준다.

Tomcat SSL 적용시 https로 자동 리다이렉트 설정하기 https://offbyone.tistory.com/262

 

회사 공유용으로 작성한 내용

1. config파일 변경
- openssl.cnf 파일 변경하면됨.
- IP.Address 의 값을 Server IP로 변경

2. CA가 사용할 RSA  key 쌍private key 만들기
> openssl genrsa -aes256 -out [키 파일명] 2048

3. 인증서 요청 파일 만들기
> openssl req -new -key [키 파일] -out [req 파일명] -config [config 파일]
- 키 암호 입력 후 입력할 내용은 config에 정의 해두었으므로 enter만 입력하면 됨

4. 10년짜리 self-signed 인증서 만들기
> openssl x509 -req -days 3650 -sha256 -extensions v3_ca -set_serial 1 -in [req파일명] -signkey [키 파일] -out [인증서 이름] -extfile [config 파일]

5. 인증서와 웹서버용 개인키를 이용해서 Tomcat용 keystore를 생성합니다.
> openssl pkcs12 -export -in [인증서] -inkey [키 파일] -out [pfx 파일명] -name "인증서 객체 구분을 위한 임의의 이름" 
- 인증서 파일을 바로 keystore에 import해도 무방하나 pkcs12파일을 변환 하는것이 더 간단하므로 pkcs12 형태로 변환)

> keytool -v -importkeystore -srckeystore [pfx 파일] -srcstoretype PKCS12 -destkeystore [keystore 파일명] -deststoretype JKS


6. server.xml 파일 변경
- 추가 <Connector SSLEnabled="true" keystoreFile="[keystore파일 경로]" keystorePass="[최초 키를 만들 때 지정한 암호]" port="[ssl PORT 지정]" scheme="https" secure="true" sslProtocol="TLS"/>

7. 브라우저에서 인증서 등록 
- 인증서관리에서 '신뢰할수 있는 루트 인증기관' 탭에서 '가져오기'를 실행하여 우리가 만든 인증서 (확장자 CRT 파일) 등록

 

 

첨부파일

openssl-0.9.8k_X64.zip
1.42MB
tomcat-native-1.2.21-openssl-1.0.2q-win32-bin.zip
2.43MB

Comments