Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...


SSL 인증서 발급

위에서 생성한 root ca 서명키로 SSL 인증서를 발급해 보자

키 쌍 생성

1. SSL 호스트에서 사용할 RSA  key pair(public, private key) 생성

Code Block
languagebash
title2048bit 개인키 생성
openssl genrsa -aes256 -out /etc/pki/tls/private/lesstif.com.key 2048


2. Remove Passphrase from key

Info

개인키를 보호하기 위해 Key-Derived Function 으로 개인키 자체가 암호화되어 있다. 인터넷 뱅킹등에 사용되는 개인용 인증서는 당연히 저렇게 보호되어야 하지만 SSL 에 사용하려는 키가 암호가 걸려있으면 httpd 구동때마다 pass phrase 를 입력해야 하므로 암호를 제거한다.

Code Block
languagebash
title개인키 pass phrase 제거
cp  /etc/pki/tls/private/lesstif.com.key  /etc/pki/tls/private/lesstif.com.key.enc
openssl rsa -in  /etc/pki/tls/private/lesstif.com.key.enc -out  /etc/pki/tls/private/lesstif.com.key
Warning
title보안 경고

개인키의 유출 방지를 위해 group 과 other의 permission 을 모두 제거한다.

chmod 600  /etc/pki/tls/private/lesstif.com.key*

CSR 생성

1. CSR(Certificate Signing Request) 생성을 위한 openssl config 파일을 만들고 host_openssl.conf 로 저장(변경 가능) 라는 이름으로 저장한다.

Code Block
languagebash
titlehost_openssl.conf
[ req ]
default_bits            = 2048
default_md              = sha1
default_keyfile         = lesstif-rootca.key
distinguished_name      = req_distinguished_name
extensions             = v3_user
## 인증서 요청시에도 extension 이 들어가면 authorityKeyIdentifier 를 찾지 못해 에러가 나므로 막아둔다.
## req_extensions = v3_user

[ v3_user ]
# Extensions to add to a certificate request
basicConstraints = CA:FALSE
authorityKeyIdentifier = keyid,issuer
subjectKeyIdentifier = hash
keyUsage = nonRepudiation, digitalSignature, keyEncipherment
## SSL 용 확장키 필드
extendedKeyUsage = serverAuth,clientAuth
subjectAltName          = @alt_names
[ alt_names]
## Subject AltName의 DNSName field에 SSL Host 의 도메인 이름을 적어준다.
## 멀티 도메인일 경우 *.lesstif.com 처럼 쓸 수 있다.
DNS.1   = www.lesstif.com
DNS.2   = lesstif.com
DNS.3   = *.lesstif.com

[req_distinguished_name ]
countryName                     = Country Name (2 letter code)
countryName_default             = KR
countryName_min                 = 2
countryName_max                 = 2

# 회사명 입력
organizationName              = Organization Name (eg, company)
organizationName_default      = lesstif Inc.
 
# 부서 입력
organizationalUnitName          = Organizational Unit Name (eg, section)
organizationalUnitName_default  = lesstif SSL Project
 
# SSL 서비스할 domain 명 입력
commonName                      = Common Name (eg, your name or your server's hostname)
commonName_default             = lesstif.com
commonName_max                  = 64


...