Skip to content

Instantly share code, notes, and snippets.

@skyitachi
Created March 27, 2018 17:20
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 skyitachi/1b4d74e81ba2a709507bdabbceb0d663 to your computer and use it in GitHub Desktop.
Save skyitachi/1b4d74e81ba2a709507bdabbceb0d663 to your computer and use it in GitHub Desktop.
create self-signed ssl certificates without passwords

server

echo "Generating an SSL private key to sign your certificate..."
openssl genrsa -des3 -out myssl.key 1024

echo "Generating a Certificate Signing Request..."
openssl req -new -key myssl.key -out myssl.csr

echo "Removing passphrase from key (for nginx)..."
cp myssl.key myssl.key.org
openssl rsa -in myssl.key.org -out myssl.key
rm myssl.key.org

echo "Generating certificate..."
openssl x509 -req -days 365 -in myssl.csr -signkey myssl.key -out myssl.crt

client

openssl genrsa -des3 -out client.key 1024

openssl req -new -key client.key -out client.csr

cp client.key client.key.org
openssl rsa -in client.key.org -out client.key
rm client.key.org

openssl x509 -req -days 365 -in client.csr -CA server.crt -CAkey server.key -set_serial 01 -out client.crt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment