Last active
February 12, 2020 11:07
-
-
Save paullaffitte/15d7c08809aee928fdcca8bafb63e22d to your computer and use it in GitHub Desktop.
Generate client ssl certificate
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env bash | |
if [ $# -ne 1 ]; then | |
echo "please choose a name for the certificate" | |
exit 1 | |
fi | |
openssl genrsa -out "$1.key" 4096 | |
openssl req -new -key "$1.key" -out "$1.req" | |
openssl x509 -req -in "$1.req" -CA rootCA.pem -CAkey rootCA.key -set_serial 101 -extensions client -days 500 -outform PEM -out "$1.cer" | |
openssl pkcs12 -export -inkey "$1.key" -in "$1.cer" -out "$1.p12" | |
rm "$1.key" "$1.cer" "$1.req" | |
ls "$1.p12" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment