這是本文件的舊版!


Issue Personal Certificate

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

#!/bin/bash
ROOT_KEY=rootca.key
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 rootca.req
openssl x509 -req -days 7305 -sha1 -extfile /etc/ssl/openssl.cnf -extensions v3_ca \
 -signkey $ROOT_KEY -in rootca.req -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