Skip to content

Instantly share code, notes, and snippets.

@protometa
Created June 1, 2017 17:00
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 protometa/323f731d3a30a85af5fc2faa9900281a to your computer and use it in GitHub Desktop.
Save protometa/323f731d3a30a85af5fc2faa9900281a to your computer and use it in GitHub Desktop.
#!/bin/bash
# make dummy certs
mkdir ssl/
cd ssl/
# CA key
openssl genrsa -passout pass:1111 -des3 -out ca.key 4096
# CA cert
openssl req -passin pass:1111 -new -x509 -days 365 -key ca.key -out ca.crt -subj '/C=US/ST=Oregon/L=Portland/O=Test/OU=CertAuthority/CN=localhost'
# server key
openssl genrsa -passout pass:1111 -des3 -out server.key 4096
# server signing request
openssl req -passin pass:1111 -new -key server.key -out server.csr -subj '/C=US/ST=Oregon/L=Portland/O=Test/OU=Server/CN=localhost'
# server cert
openssl x509 -req -passin pass:1111 -days 365 -in server.csr -CA ca.crt -CAkey ca.key -set_serial 01 -out server.crt
# rm server key password
openssl rsa -passin pass:1111 -in server.key -out server.key
# client key
openssl genrsa -passout pass:1111 -des3 -out client.key 4096
# client signing request
openssl req -passin pass:1111 -new -key client.key -out client.csr -subj '/C=US/ST=Oregon/L=Portland/O=Test/OU=Client/CN=localhost'
# client cert
openssl x509 -passin pass:1111 -req -days 365 -in client.csr -CA ca.crt -CAkey ca.key -set_serial 01 -out client.crt
# rm client key password
openssl rsa -passin pass:1111 -in client.key -out client.key
# cleanup signing requests
rm *.csr
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment