add cert generator scripts, arrange scripts dir

This commit is contained in:
2019-01-12 20:28:45 +02:00
parent 6607a41c55
commit b0321589af
7 changed files with 104 additions and 0 deletions

22
scripts/certs/client/gen.sh Executable file
View File

@@ -0,0 +1,22 @@
#!/bin/bash
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
cd "$DIR"
rm -f client.key
rm -f client.crt
rm -f client.csr
rm -f client.p12
if [ -z "$1" ]; then
read -s pass
else
pass=$1
fi
subj="/C=BG/ST=Bulgaria/L=Sofia/O=S.M.I.I.R.K.Y./CN=localhost"
openssl genrsa -out client.key 4096
openssl req -new -key client.key -subj $subj -out client.csr
openssl x509 -req -days 365 -in client.csr -CA ../ca.crt -CAkey ../ca.key -set_serial 01 -out client.crt -passin pass:$pass
openssl pkcs12 -export -clcerts -in client.crt -inkey client.key -out client.p12 -password pass:$pass
openssl pkcs12 -in client.p12 -out client.pem -nodes -clcerts -password pass:$pass