Created
March 31, 2020 17:40
-
-
Save spy86/ad61590cec6dd899043e7e1454d244c1 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
#!/bin/bash | |
set -ex | |
mkdir certs && cd certs | |
echo "Creating server keys..." | |
echo 01 > ca.srl | |
openssl genrsa -des3 -out ca-key.pem | |
openssl req -new -x509 -days 3650 -key ca-key.pem -out ca.pem | |
openssl genrsa -des3 -out server-key.pem | |
openssl req -new -key server-key.pem -out server.csr | |
openssl x509 -req -days 365 -in server.csr -CA ca.pem -CAkey ca-key.pem \ | |
-out server-cert.pem | |
echo "Creating client keys..." | |
openssl genrsa -des3 -out client-key.pem | |
openssl req -new -key client-key.pem -out client.csr | |
echo extendedKeyUsage = clientAuth > extfile.cnf | |
openssl x509 -req -days 365 -in client.csr -CA ca.pem -CAkey ca-key.pem \ | |
-out client-cert.pem -extfile extfile.cnf | |
echo "Stripping passwords from keys..." | |
openssl rsa -in server-key.pem -out server-key.pem | |
openssl rsa -in client-key.pem -out client-key.pem |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment