Issue Personal Certificate with openssl

主要參考這篇內容,調整一下讓自己好重複使用:

#!/bin/bash
ROOT_KEY=rootca.key
ROOT_CSR=rooca.csr
ROOT_CRT=rootca.crt
P_KEY=tonylin.key
P_CSR=tonylin.csr
P_CRT=tonylin.crt
 
openssl genrsa -des3 -out $ROOT_KEY 2048 
openssl req -new -key rootca.key -out $ROOT_CSR
openssl x509 -req -days 7305 -sha1 -extfile /etc/ssl/openssl.cnf -extensions v3_ca \
 -signkey $ROOT_KEY -in $ROOT_CSR -out $ROOT_CRT
openssl genrsa -out $P_KEY 2048
openssl req -new -key $P_KEY -out $P_CSR
openssl x509 -req -days 3650 -sha1 -extfile /etc/ssl/openssl.cnf -extensions v3_req -CA $ROOT_CRT -CAkey $ROOT_KEY \
 -CAserial rootca.srl -CAcreateserial -in $P_CSR -out $P_CRT
該填的內容可以自行看那篇教學,我不贅述。

AD預設建出來的certificate是使用Subject Alternative Name去替代Subject。