random-stuff/basic_configs/ssl/gen.fish

12 lines
500 B
Fish
Raw Normal View History

#!/usr/bin/fish
set dist_name "/C=US/ST=No/L=No/O=self-cert/CN=self-cert"
envsubst <local_cert.cnf.base >local_cert.cnf
openssl req -x509 -nodes -newkey RSA:2048 -keyout self_ca.key -days 999 -out self_ca.crt -subj $dist_name
openssl req -nodes -newkey RSA:2048 -keyout local.key -out local.csr -subj $dist_name
openssl x509 -req -CA self_ca.crt -CAkey self_ca.key -in local.csr -out local.crt -days 999 -CAcreateserial -extfile local_cert.cnf
rm local.csr local_cert.cnf self_ca.key self_ca.srl