<< CA root 인증서 생성 >>
# openssl 로 root ca 의 개인키와 인증서 생성
**. CA가 사용할 RSA key pair(public, private key) 생성 (2048bit 개인키 생성)
openssl genrsa -aes256 -out rootCA.key 2048
**. CSR(Certificate Signing Request) 생성을 위한 rootCA_openssl.cfg 로 저장
rootCA_openssl.cfg
—————————————————————————————————
[ req ]
default_bits = 2048
default_md = sha1
default_keyfile = rootCA.key
distinguished_name = req_distinguished_name
extensions = v3_ca
req_extensions = v3_ca
[ v3_ca ]
basicConstraints = critical, CA:TRUE, pathlen:0
subjectKeyIdentifier = hash
##authorityKeyIdentifier = keyid:always, issuer:always
keyUsage = keyCertSign, cRLSign
nsCertType = sslCA, emailCA, objCA
[req_distinguished_name ]
countryName = Country Name (2 letter code)
countryName_default = KR
countryName_min = 2
countryName_max = 2
# 회사명 입력
organizationName = Organization Name (eg, system)
organizationName_default = totoli Inc.
# 부서 입력
#organizationalUnitName = Organizational Unit Name (eg, section)
#organizationalUnitName_default = totoli
# SSL 서비스할 domain 명 입력
commonName = Common Name (eg, your name or your server’s hostname)
commonName_default = totoli’s Self Signed CA
commonName_max = 64
—————————————————————————————————
**. 인증서 요청 생성
openssl req -new -key rootCA.key -out rootCA.csr -config rootCA_openssl.cfg
**. 10년짜리 self-signed 인증서 생성
openssl x509 -req -days 3650 -extensions v3_ca -set_serial 1 -in rootCA.csr -signkey rootCA.key -out rootCA.crt -extfile rootCA_openssl.cfg
**. 제대로 생성되었는지 확인
openssl x509 -text -in rootCA.crt
<< Host 인증서 생성 >>
# root ca 서명키로 host SSL 인증서를 발급
**. SSL 호스트에서 사용할 RSA key pair(public, private key) 생성
openssl genrsa -aes256 -out totoli.key 2048
**. 암호가 걸려있으면 httpd 구동때마다 pass phrase(암호) 를 입력해야 함으로 암호를 제거
copy totoli.key totoli.key.enc
openssl rsa -in totoli.key.enc -out totoli.key
**. CSR(Certificate Signing Request) 생성을 위한 host_openssl.cfg 로 저장
host_openssl.cfg
—————————————————————————————————
[ req ]
default_bits = 2048
default_md = sha1
default_keyfile = 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 의 도메인 이름을 적어준다.
## 멀티 도메인일 경우 *.totoli.com 처럼 쓸 수 있다.
DNS.1 = totoli.us.to
DNS.2 = *.totoli.us.to
## DNS.3 = subdomain.totoli.us.to
[req_distinguished_name ]
countryName = Country Name (2 letter code)
countryName_default = KR
countryName_min = 2
countryName_max = 2
# 회사명 입력
organizationName = Organization Name (eg, system)
organizationName_default = totoli Inc.
# 부서 입력
organizationalUnitName = Organizational Unit Name (eg, section)
organizationalUnitName_default = Media Division
# SSL 서비스할 domain 명 입력
commonName = Common Name (eg, your name or your server’s hostname)
commonName_default = totoli.us.to
commonName_max = 64
—————————————————————————————————
**. SSL 인증서 요청 CSR 생성
openssl req -new -key totoli.key -out totoli.csr -config host_openssl.cfg
**. 5년짜리 totoli.us.to 용 SSL 인증서 발급 (서명시 ROOT CA 개인키로 서명)
openssl x509 -req -days 1825 -extensions v3_user -in totoli.csr -CA rootCA.crt -CAcreateserial -CAkey rootCA.key -out totoli.crt -extfile host_openssl.cfg
**. 제대로 생성되었는지 확인
openssl x509 -text -in totoli.crt
<< Cleent에 RootCA 등록 >>
**. rootCA.crt 파일을 client PC로 복사 후 CA 인증서를 해당 Client에 신용할 수 있는 인증서로 등록 해야 함. (귀찮으면 돈주고 신용할 수 있는 인증서를 사던가 ㅋㅋ)