SSL Cert. - daniel-hong-sicis/streaming GitHub Wiki
[Linux] SSL (μκ° μλͺ )μ¬μ€ μΈμ¦μ μμ±νκΈ°
from [https://sh-safer.tistory.com/89]
1λ¨κ³. κ°μΈν€ μμ±
μΈμ¦ κΈ°κ΄ κ°μΈν€λ₯Ό λ§λλ λ¨κ³μΈλ°μ
μ¬μ€ μΈμ¦μ(μκ° μλͺ μΈμ¦μ)λ μΈμ¦ κΈ°κ΄μ΄ μκΈ° λλ¬Έμ μ€μ€λ‘ μλͺ νμ¬ μΈμ¦μλ₯Ό λ§λλλ€.
[root@k8s-worker-1 make_ssl]# openssl genrsa -des3 -out ssl_1.key 2048 Generating RSA private key, 2048 bit long modulus ....+++ ..........................................................+++ e is 65537 (0x10001) Enter pass phrase for ssl_1.key: Verifying - Enter pass phrase for ssl_1.key:
openssl genrsa -des3 -out ssl_1.key 2048
2λ¨κ³. CSR(Certificate Sinning Request) μμ±
μΈμ¦μ λ°κΈμ νμν λ΄μ©μ λ΄κ³ μλ μμ²μμ λλ€.
1λ¨κ³μμ μμ±ν keyλ₯Ό κ°μ§κ³ μμ²μλ₯Ό μμ±ν©λλ€.
[root@k8s-worker-1 make_ssl]# openssl req -new -key ssl_1.key -out ssl_1.csr Enter pass phrase for ssl_1.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) []:Seoul Locality Name (eg, city) [Default City]:GangNam Organization Name (eg, company) [Default Company Ltd]:sh-safer Organizational Unit Name (eg, section) []:sh-safer Common Name (eg, your name or your server's hostname) []:sh-safer.com Email Address []:[email protected]
Please enter the following 'extra' attributes to be sent with your certificate request A challenge password []: An optional company name []:
3λ¨κ³. κ°μΈν€μμ ν¨μ€μλ μ κ±°
νμ¬ μμ±λ κ°μΈν€λ‘ apacheλ nginxμ μ μ©μ νλ©΄ λ°λͺ¬μ ꡬλν λλ§λ€ key ν¨μ€μλλ₯Ό μ λ ₯ν΄ μ£Όμ΄μΌ ν©λλ€.
λ§€λ² ν¨μ€μλ μ λ ₯νλ κ² λ²κ±°λ‘μ ν¨μ€μλλ₯Ό μ κ±°ν©λλ€.
[root@k8s-worker-1 make_ssl]# openssl rsa -in ssl_1.key -out ssl_1_nopass.key Enter pass phrase for ssl_1.key: writing RSA key
4λ¨κ³. (μκ° μλͺ ) μ¬μ€ μΈμ¦μ μμ±
μμ±ν key λ° csr νμΌλ‘ μΈμ¦μλ₯Ό μμ±ν©λλ€.
[root@k8s-worker-1 make_ssl]# openssl x509 -req -days 365 -in ssl_1.csr -signkey ssl_1_nopass.key -out ssl_1.crt Signature ok subject=/C=KR/ST=Seoul/L=GangNam/O=sh-safer/OU=sh-safer/CN=sh-safer.com/emailAddress=[email protected] Getting Private key
νμΌ κ΅¬μ± νμΈ
[root@k8s-worker-1 make_ssl]# ll ν©κ³ 16 -rw-r--r--. 1 root root 1314 10μ 9 19:37 ssl_1.crt -rw-r--r--. 1 root root 1058 10μ 9 19:33 ssl_1.csr -rw-r--r--. 1 root root 1751 10μ 9 19:19 ssl_1.key -rw-r--r--. 1 root root 1679 10μ 9 19:35 ssl_1_nopass.key
μΆκ°. μΈμ¦μ λ΄μ© νμΈ
key λ΄μ© νμΈ
openssl rsa -text -in [key νμΌλͺ ]
CSR μμ²μ λ΄μ© νμΈ
openssl req -in [scr νμΌλͺ ] -noout -text
μΈμ¦μ λ΄μ© νμΈ
openssl x509 -in [crt νμΌλͺ ] -noout -text