1#!/bin/sh 2 3if [ -z "$1" ] ; then 4 echo "Usage $0 <name>" 5 exit 1 6fi 7 8openssl genrsa -out $1.key 4096 && \ 9printf "\\n\\n\\n\\n\\nlocalhost\\n\\n1234\\n\\n" | \ 10 openssl req -config tmp.cnf -new -key $1.key -out $1.csr && \ 11openssl ca -config tmp.cnf \ 12 -keyfile ca.key \ 13 -cert ca.pem \ 14 -extensions usr_cert \ 15 -days 375 \ 16 -notext \ 17 -md sha256 \ 18 -in $1.csr \ 19 -out $1.pem && \ 20openssl pkcs12 -export -in $1.pem -inkey $1.key -out $1.p12 21 22