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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
|
#!/usr/bin/env python
# **********************************************************************
#
# Copyright (c) 2003-2008 ZeroC, Inc. All rights reserved.
#
# This copy of Ice is licensed to you under the terms described in the
# ICE_LICENSE file included in this distribution.
#
# **********************************************************************
import os, sys, shutil, glob
def iceca(args):
if(os.environ.has_key("ICE_HOME")):
cmd = os.path.join(os.environ["ICE_HOME"], "bin", "iceca") + " " + args
else:
cmd = "iceca " + args
if os.system(cmd):
sys.exit(1)
def createCertificate(filename, cn):
print "======= Creating " + filename + " certificate ======="
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
cwd = os.getcwd()
if not os.path.exists("certs") or os.path.basename(cwd) != "secure":
print "You must run this script from the secure demo directory"
sys.exit(1)
os.environ["ICE_CA_HOME"] = os.path.abspath("certs")
os.chdir("certs")
#
# First, create the certificate authority.
#
print "======= Creating Certificate Authority ======="
iceca("init --overwrite --no-password")
print
print
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("..")
|