Skip to content

Instantly share code, notes, and snippets.

@adamanthil
Created February 25, 2016 01:14
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 adamanthil/93c59d97ba04476dbcc5 to your computer and use it in GitHub Desktop.
Save adamanthil/93c59d97ba04476dbcc5 to your computer and use it in GitHub Desktop.
Series of shell commands to create a self-signed SSL cert for use in a dev environment.
# Create self signed cert
# Reference: http://www.akadia.com/services/ssh_test_certificate.html
# Create key (will prompt for a passphrase. This password will be removed later for convenience)
openssl genrsa -des3 -out server.key 2048
# Generate CSR
openssl req -new -key server.key -out server.csr
# Remove key passphrase
cp server.key server.key.org
openssl rsa -in server.key.org -out server.key
# Generate self-signed certificate (valid for 10 years)
openssl x509 -req -days 3650 -in server.csr -signkey server.key -out server.crt
# If a chain file is needed, the original cert can be used as the chain in this case.
# Copy certificate to use as chain file
cp server.crt bundle.crt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment