23 lines
688 B
Bash
Executable File
23 lines
688 B
Bash
Executable File
#!/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 -rs 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
|
|
|