인증서를 사용하는 주요 이유는 보안과 신뢰성 향상인데, SSL/TLS 인증서는 웹사이트와 사용자 간의 데이터 전송을 암호화하여 민감한 정보를 보호할 수 있기 때문입니다. 인증서를 사용하지 않으면 사용자 브라우저에서 신뢰할 수 없는 표시가 나타나서 신뢰도를 떨어뜨릴 수 있기 때문에 SSL 인증서를 설치하기도 합니다.
인증서 발급
root CA 인증서 발급 (self-signed)
OpenSSL은 편리한대로 윈도우, 리눅스에서 수행합니다. 저는 리눅스에서 진행
pass phrase 를 입력하지 않으면 에러 발생함 [root@AM tmp]# openssl genrsa -des3 -out THISWAY.key 2048 Enter PEM pass phrase: (비번입력, ex,, password) Verifying - Enter PEM pass phrase: (비번입력, ex,, password) [root@AM tmp]# ------------------------------------- private key 를 이용해서 다음과 같이 pem 파일로 생성 (root CA 인증서 발급) [root@AM tmp]# openssl req -x509 -new -nodes -key THISWAY.key -sha256 -days 14600 -out THISWAY.pem Enter pass phrase for THISWAY.key: You are about to be asked to enter information that will be incorporated into your certificate request. What you are about to enter is what is called a Distinguished Name or a DN. There are quite a few fields but you can leave some blank For some fields there will be a default value, If you enter '.', the field will be left blank. ----- Country Name (2 letter code) [XX]:KR State or Province Name (full name) []:Saha Locality Name (eg, city) [Default City]:Busan Organization Name (eg, company) [Default Company Ltd]:Thisway LTD Organizational Unit Name (eg, section) []: Common Name (eg, your name or your server's hostname) []:ds.local Email Address []:buddy053@gmail.com [root@AM tmp]# |
root Ca (pem) 인증서를 crt 형태로 변경
[root@AM tmp]# openssl x509 -outform der -in THISWAY.pem -out THISWAY.crt |
인증서 설치 (사용자 PC)
- crt 파일을 배포하여 설치 (신뢰할 수 있는 루트 인증기관)
CA 서명된 서버 인증서 발급
서버 인증서 생성
- 개인키 생성
-
[root@AM tmp]# openssl genrsa -out issue.thisway.com.key 2048
-
- 서버 csr 생성
-
[root@AM tmp]# openssl req -new -key issue.thisway.com.key -out issue.thisway.com.csr You are about to be asked to enter information that will be incorporated into your certificate request. What you are about to enter is what is called a Distinguished Name or a DN. There are quite a few fields but you can leave some blank For some fields there will be a default value, If you enter '.', the field will be left blank. ----- Country Name (2 letter code) [XX]:KR State or Province Name (full name) []:Seoul Locality Name (eg, city) [Default City]:Seoul Organization Name (eg, company) [Default Company Ltd]:Thisway LTD Organizational Unit Name (eg, section) []:thisway Common Name (eg, your name or your server's hostname) []:issue.thisway.com Email Address []:thisway@gmail.com Please enter the following 'extra' attributes to be sent with your certificate request A challenge password []: (비번입력, password) An optional company name []: (빈값) [root@AM tmp]#
-
- 설정파일 생성
-
[root@AM tmp]# vi issue.thisway.com.ext --- 내용 authorityKeyIdentifier=keyid,issuer basicConstraints=CA:FALSE keyUsage = digitalSignature, nonRepudiation, keyEncipherment, dataEncipherment subjectAltName = @alt_names [alt_names] DNS.1 = issue.thisway.com
-
- 인증서 발급 (한줄 입력, 길어서 다음줄에 입력하려면 '\' 추가하면 다음줄 입력가능)
-
[root@AM tmp]# openssl x509 -req -in issue.thisway.com.csr -CA THISWAY.pem -CAkey THISWAY.key -CAcreateserial -out issue.thisway.com.crt -days 14600 -sha256 -extfile issue.thisway.com.ext Certificate request self-signature ok subject=C = KR, ST = Saha, L = Busan, O = thisway LTD, OU = buddy, CN = issue.thisway.com, emailAddress = buddy053@gmail.com Enter pass phrase for DSQACA.key: [root@AM tmp]#
-