Generate self-signed SSL cert

#!/usr/bin/env python


A self-signed certificate generator.


import os


commands = [

"openssl genrsa -des3 -out %s.key 1024" % _name,

"openssl req -new -key %s.key -out %s.csr" % (_name,_name),

"cp %s.key" % (_name,_name),

"openssl rsa -in -out %s.key" % (_name,_name),

"openssl x509 -req -in %s.csr -signkey %s.key -out %s.crt" % (_name,_name,_name)


for c in commands:


#credit to where the information comes from.

#When you run this code, where it asks for Common Name or YourName, enter the name of the host eg - or .

#See for creating one certificate to protect multiple hosts.