openssl genrsa -out self-ssl.key
openssl req -new -key self-ssl.key -out self-ssl.csr -config csr.conf
openssl x509 -req -days 365 -in self-ssl.csr -signkey self-ssl.key -out self-ssl.crt -extensions req_ext -extfile csr.conf
Sign from Root CA:
openssl x509 -req -days 365 -extensions req_ext -extfile csr.conf -CA RootCA.crt -CAkey RootCA.key -CAcreateserial -in self-ssl.csr -out self-ssl.crt
[req]
default_bits = 2048
distinguished_name = dn
prompt = no
[dn]
C="TW"
ST="Taiwan"
L="Taipei"
O="YIDAS"
OU="Service"
emailAddress="[email protected]"
CN="yourdomain.com"
[req_ext]
subjectAltName = @alt_names
[alt_names]
DNS.0 = *.yourdomain.com
DNS.1 = *.dev.yourdomain.com
[req] is for CSR with distinguished_name setting, while [req_ext] is called for
-extensionswith creating crt with SAN(subjectAltName) setting.
openssl req -in self-ssl.csr -text -noout
openssl x509 -in self-ssl.crt -text -noout
Thanks a ton really helpful.