Skip to content

Instantly share code, notes, and snippets.

@tomoconnor
Created May 30, 2011 19:32
Show Gist options
  • Save tomoconnor/999357 to your computer and use it in GitHub Desktop.
Save tomoconnor/999357 to your computer and use it in GitHub Desktop.
Create A Client Certificate
#!/bin/bash
# How To Create a client certificate
#As Root
cd /etc/ssl/myca
echo "Enter your username/tag!"
read USERNAME
echo "creating a CSR"
openssl req -config openssl.my.cnf -new -nodes -keyout private/${USERNAME}.key -out csr/${USERNAME}.csr -days 365
echo "Sign the CSR, get a Certificate"
openssl ca -config openssl.my.cnf -policy policy_anything -out certs/${USERNAME}.crt -infiles csr/${USERNAME}.csr
echo "Export the Certificate as a format that browsers like"
openssl pkcs12 -export -in certs/${USERNAME}.crt -inkey private/${USERNAME}.key -out certs/${USERNAME}.p12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment