Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

executable file 32 lines (22 sloc) 0.792 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
#!/usr/bin/python
import os
import sys

if os.getuid() != 0:
    print "E_ROOT: You must be root to use this utility.\n"
    sys.exit(1)

print "WARNING: For NameCheap, the 'common name' field must be the domain name you would like to activate."

SSL_DIR = "/etc/ssl/"

def usage():
    app_name = sys.argv[0]
    print """%s usage:
%s domain_name

domain_name The domain name to generate a key and CSR for
""" % (app_name, app_name)
    sys.exit(0)

if len(sys.argv) < 2:
usage()

domain_name = sys.argv[1].strip()

os.system("openssl genrsa -out " + SSL_DIR + domain_name + ".key 2048")
os.system("openssl req -new -key " + SSL_DIR + domain_name + ".key -out " + SSL_DIR + domain_name + ".csr")
os.system("cat " + SSL_DIR + domain_name + ".csr")

print "\n\nCSR generation complete"
Something went wrong with that request. Please try again.