|
@@ -3,18 +3,17 @@
|
|
|
from certs import gencerts
|
|
|
import os,sys,getopt
|
|
|
|
|
|
-## def gencerts(c,st,l,o,ou,cn,crldp,passphrase):
|
|
|
-
|
|
|
def main(argv):
|
|
|
- c=u'UK'
|
|
|
+ c=u'GB'
|
|
|
st=u'England'
|
|
|
l=u'Manchester'
|
|
|
- o=u'Jisc'
|
|
|
- ou=u'Govroam'
|
|
|
- cn=u'something.somewhere.com'
|
|
|
- crldp=u'http://something.somewhere.com/crldp'
|
|
|
+ o=u'WorkPlace'
|
|
|
+ ou=u'WorkUnit'
|
|
|
+ cn=u'Placeholder'
|
|
|
+ crldp=u'http://placeholder/crldp'
|
|
|
passphrase=b'something'
|
|
|
-
|
|
|
+ directory=u'/tmp'
|
|
|
+
|
|
|
try:
|
|
|
opts, args = getopt.getopt(argv,"c:s:l:o:u:n:r:p:d:")
|
|
|
except getopt.GetoptError:
|
|
@@ -36,17 +35,13 @@ def main(argv):
|
|
|
if opt == '-r':
|
|
|
crldp=unicode(arg, "utf-8")
|
|
|
if opt == '-p':
|
|
|
- password=unicode(arg, "utf-8")
|
|
|
+ passphrase=arg
|
|
|
if opt == '-d':
|
|
|
directory=unicode(arg, "utf-8")
|
|
|
|
|
|
if not os.path.exists(directory):
|
|
|
os.makedirs(directory)
|
|
|
|
|
|
-## return csrsubject,output_cert(cacert),output_key_encrypted(cakey,passphrase),output_key_
|
|
|
-## encrypted(csrkey,passphrase),output_cert(servercert),output_cert(csrcert),output_cert(crlc
|
|
|
-## ert)
|
|
|
-
|
|
|
csrsubject, cacert, cakey_enc, csrkey_enc, servercert, csrcert, crlcert = gencerts(c,st,l,o,ou,cn,crldp,passphrase)
|
|
|
|
|
|
with open (directory + '/rootca.pem','w') as f:
|
|
@@ -57,16 +52,12 @@ def main(argv):
|
|
|
f.write(cakey_enc)
|
|
|
f.close
|
|
|
|
|
|
- with open (directory + '/csrkey.pem','w') as f:
|
|
|
- f.write(csrkey_enc)
|
|
|
- f.close
|
|
|
-
|
|
|
with open (directory + '/server-cert.pem','w') as f:
|
|
|
f.write(servercert)
|
|
|
f.close
|
|
|
|
|
|
with open (directory + '/server-key.pem','w') as f:
|
|
|
- f.write(csrcert)
|
|
|
+ f.write(csrkey_enc)
|
|
|
f.close
|
|
|
|
|
|
with open (directory + '/list.crl','w') as f:
|