summaryrefslogtreecommitdiff
path: root/cpp/demo/IceGrid/secure/makecerts.py
diff options
context:
space:
mode:
authorMatthew Newhook <matthew@zeroc.com>2008-04-24 16:45:08 +0800
committerMatthew Newhook <matthew@zeroc.com>2008-04-24 16:45:08 +0800
commit493e68fbdcb885533b4343eaaa21dea027e2c55f (patch)
treee18b7bd63ae30a57d05e22d903ef84f00d9acbfb /cpp/demo/IceGrid/secure/makecerts.py
parentbug 3012 - Python converter demo fixes (diff)
downloadice-493e68fbdcb885533b4343eaaa21dea027e2c55f.tar.bz2
ice-493e68fbdcb885533b4343eaaa21dea027e2c55f.tar.xz
ice-493e68fbdcb885533b4343eaaa21dea027e2c55f.zip
Squashed commit of the following:
commit 7c8786e9196dea0bd634a3b5fef9612a8416806a Author: Matthew Newhook <matthew@zeroc.com> Date: Thu Apr 24 16:13:45 2008 +0800 remove old junk. commit bc11400164ea4d8158d385179d798b1abc216a2e Author: Matthew Newhook <matthew@zeroc.com> Date: Thu Apr 24 14:09:07 2008 +0800 - iceca and associated ImportKey.class are now copied into bin and lib respectively. - iceca did not correctly support the --verbose flag with the import command. - iceca request has been simplified. The command now takes the name of the file to generate, the common name, and an optional email address. - Updated the IceGrid/secure demo for the iceca changes.
Diffstat (limited to 'cpp/demo/IceGrid/secure/makecerts.py')
-rwxr-xr-xcpp/demo/IceGrid/secure/makecerts.py39
1 files changed, 14 insertions, 25 deletions
diff --git a/cpp/demo/IceGrid/secure/makecerts.py b/cpp/demo/IceGrid/secure/makecerts.py
index f7c13c4ecac..b88df6d3430 100755
--- a/cpp/demo/IceGrid/secure/makecerts.py
+++ b/cpp/demo/IceGrid/secure/makecerts.py
@@ -20,27 +20,13 @@ def iceca(args):
if os.system(cmd):
sys.exit(1)
-def createCertificate(type, filename = None):
-
- if not filename:
- filename = type
+def createCertificate(filename, cn):
print "======= Creating " + filename + " certificate ======="
- # Generate the certificate in a temporary directory
- os.mkdir("tmpcerts")
- os.chdir("tmpcerts")
- iceca("request --" + type + nopassword)
- iceca("sign --in " + type + "_req.pem --out " + type + "_cert.pem")
- os.chdir("..")
-
- # Move and rename the generated certificate
- os.rename(os.path.join("tmpcerts", type + "_key.pem"), filename + "_key.pem")
- os.rename(os.path.join("tmpcerts", type + "_cert.pem"), filename + "_cert.pem")
-
- # Remove the temporary directory
- os.remove(os.path.join("tmpcerts", type + "_req.pem"))
- os.rmdir("tmpcerts")
+ iceca("request --no-password --overwrite %s \"%s\"" % (filename, cn))
+ iceca("sign --in %s_req.pem --out %s_cert.pem" % (filename, filename))
+ os.remove("%s_req.pem" % filename)
print
print
@@ -52,7 +38,6 @@ if not os.path.exists("certs") or os.path.basename(cwd) != "secure":
sys.exit(1)
os.environ["ICE_CA_HOME"] = os.path.abspath("certs")
-nopassword = " --no-password"
os.chdir("certs")
@@ -60,18 +45,22 @@ os.chdir("certs")
# First, create the certificate authority.
#
print "======= Creating Certificate Authority ======="
-iceca("init --overwrite" + nopassword)
+iceca("init --overwrite --no-password")
print
print
-createCertificate("registry")
-createCertificate("node")
-createCertificate("server", "glacier2")
-createCertificate("server")
-createCertificate("server", "admin")
+createCertificate("registry", "IceGrid Registry")
+createCertificate("node", "IceGrid Node")
+createCertificate("glacier2", "Glacier2")
+createCertificate("server", "Server")
+createCertificate("admin", "Admin")
print "======= Creating Java Key Store ======="
+try:
+ os.remove("certs.jks")
+except OSError:
+ pass
iceca("import --java admin admin_cert.pem admin_key.pem certs.jks")
os.chdir("..")