Skip to content

Instantly share code, notes, and snippets.

@azet
Last active August 29, 2015 14:04
Show Gist options
  • Save azet/42608acc52b02eecb6c2 to your computer and use it in GitHub Desktop.
Save azet/42608acc52b02eecb6c2 to your computer and use it in GitHub Desktop.
selfsigned CA / server cert. cheat sheet (people regularly ask me for this)

create your own CA and server certificate

Note that the common name of the server certificate has to match your hostname!

magic oneliner:

openssl req -new -x509 -keyout privkey.pem -out cacert.pem -days 1095 -nodes -newkey rsa:<keysize> -sha256

old:

 openssl genrsa -out ca.key 2048
 openssl req -x509 -new -nodes -key ca.key -days 666 -out ca.pem
 openssl genrsa -out server.key 2048
 openssl req -new -key server.key -out server.csr
 openssl x509 -req -in server.csr -CA ca.pem -CAkey ca.key -CAcreateserial -out server.crt -days 666
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment