Skip to content

Instantly share code, notes, and snippets.

@Haruroid
Last active August 6, 2020 13:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Haruroid/03f3606a82eb491bb22251924b98b383 to your computer and use it in GitHub Desktop.
Save Haruroid/03f3606a82eb491bb22251924b98b383 to your computer and use it in GitHub Desktop.
instant script for building CA of client authentication
#!/bin/bash
openssl genrsa -des3 -out ca.key 4096
openssl req -new -x509 -days 3650 -key ca.key -out ca.crt -subj "/C=CN/ST=Shenzhen/L=ComeCity/O=CA/OU=common/CN=/emailAddress="
#!/bin/bash
if [ $# != 1 ]; then
echo "newuser.sh [user]"
exit 1
fi
openssl genrsa -out $1.key 4096
openssl req -new -key $1.key -out $1.csr -subj "/C=CN/ST=Shenzhen/L=ComeCity/O=Client/OU=common/CN=/emailAddress="
openssl x509 -req -days 3650 -in $1.csr -CA ca.crt -CAkey ca.key -set_serial 01 -out $1.crt
openssl pkcs12 -export -out $1.pfx -inkey $1.key -in $1.crt -certfile ca.crt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment