간단하게 ssl csr파일 생성하기

 

보통 인증서를 발급해주는 업체에, 인증서 신청을 할 경우, 도메인에 대한 csr 파일을 요구하는 경우가 있습니다.
그럴경우, 서버에서 생성해주어야 하는데, 그 순서는 key 파일 생성, 생성된 key파일로 csr생성하는 순서입니다.
그리고, 최종적으로 인증업체에 넘겨준, csr로 생성된 crt(발급된 인증서) 파일을 적용하면 됩니다.

 

[첫번째  key 값 생성하기]

#자신이 원하는 디렉토리에 아래와 같은 형식으로 key 값을 생성.

key값 생성의 예 - openssl genrsa -des3 -out DOMAINNAME.key 1024

Generating RSA private key, 1024 bit long modulus
......................................++++++
..................++++++
e is 65537 (0x10001)
Enter pass phrase for DOMAINNAME.key:  #자신이 원하는 key값의 패스워드를 입력.

#생성된 key값의 상태를 확인할수있다.
key값 확인 - openssl rsa -noout -text -in DOMAINNAME.key


[두번째 csr 생성하기]

csr 생성의 예 - openssl req -new -key DOMAINNAME.key -out DOMAINNAME.csr

Enter pass phrase for DOMAINNAME.key:  # 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) GB:KR # 나라를 나타내는 2문자의 ISO약어.
State or Province Name (full name) Berkshire:Seoul # 조직이 있는 시도.
Locality Name (eg, city) Newbury:Gangnam-gu # 조직이 있는 구동.
Organization Name (eg, company) My Company Ltd:BlueWeb Co., Ltd. # 조직의 법률상의 정식명칭.
Organizational Unit Name (eg, section) :system # 조직의 부서명.
Common Name (eg, your name or your server's hostname) :blueweb.co.kr # 발급받을 정확한 FQDN의 도메인.
Email Address :bluedomain@blueweb.co.kr

Please enter the following 'extra' attributes
to be sent with your certificate request
A challenge password : # 엔터로 다음로 넘어간다, 생략 가능
An optional company name : # 엔터로 다음로 넘어간다, 생략 가능

# 생성한 csr 확인.
csr 확인 - openssl req -noout -text -in DOMAINNAME.csr

[아래와 같이 나오면 csr 생성 성공.

Certificate Request:
    Data:
        Version: 0 (0x0)
        Subject: C=KR, ST=Seoul, L=Gangnam-gu, O=BlueWeb Co., Ltd., OU=system, 
        Subject Public Key Info:
            Public Key Algorithm: rsaEncryption
            RSA Public Key: (1024 bit)
                Modulus (1024 bit):
                    00:ab:65:f6:a3:ec:91:f9:09:1c:a0:95:09:d2:f7:
                    9f:77:3d:35:19:00:82:f7:bb:da:9b:72:11:5d:87:
                    ee:ee:f5:23:f7:9d:30:94:0d:05:75:af:a9:21:fc:
                    18:24:c5:41:c5:a4:1c:4f:2d:ce:c8:e5:ed:86:70:
                    fc:47:7f:6e:41:37:ec:c3:4f:80:dc:99:98:fd:58:
                    c9:58:56:89:33:c8:03:e7:28:54:98:66:76:b3:ee:
                    7f:24:15:bc:91:8e:77:e8:06:04:fa:d3:7e:98:b2:
                    51:81:05:44:81:c3:76:84:2c:85:06:7d:e2:b1:9a:
                    52:79:cb:14:f7:cb:86:4c:59
                Exponent: 65537 (0x10001)
        Attributes:
            a0:00
    Signature Algorithm: md5WithRSAEncryption
        9f:be:d6:ee:4f:02:79:56:48:42:b0:79:be:98:24:dc:3b:85:
        37:95:75:9f:c9:4a:a7:03:10:96:84:c1:4b:ef:60:f5:3e:fe:
        e4:f1:d5:37:16:c8:77:0f:56:fd:99:71:e7:da:7c:c8:15:e7:
        00:51:90:81:67:e4:46:78:61:04:ca:24:0c:ee:fb:bd:46:04:
        09:85:c0:18:73:d4:27:c1:d2:7f:c2:8b:2a:38:f5:bc:00:25:
        d3:dd:ad:3f:8f:b2:39:ff:53:26:a3:3a:a1:f6:5e:9f:4d:28:
        7d:85:e3:ef:cc:c3:ce:80:ad:e6:43:91:cb:92:f8:1c:94:f3:
        df:8e

                     

[세번째 crt 생성하기]

마지막으로 crt를 발급하기이나, crt 파일은 보통 인증업체에서 발급해주므로
발급받은 인증서를 서버에 적용해주면 된다.
crt 생성의 예 - openssl req -new -x509 -days 365 -DOMAINNAME.key -out DOMAINNAME.crt

'배워서 남주자 > Linux 명령' 카테고리의 다른 글

[명령어] 기타 잡동사니  (0) 2020.05.10
[split] TAR 분할 압축  (0) 2020.05.10
CentOS7 - 네트워크 명령  (0) 2020.05.10
CentOS7 - 사용자  (0) 2020.05.10
YUM - (yellowdog updater modified)  (0) 2020.05.10

+ Recent posts