Changeset 4fc2250
- Timestamp:
- Sep 5, 2008 4:08:19 PM (16 years ago)
- Branches:
- axis_example, compt_changes, info-ops, master, version-1.30, version-2.00, version-3.01, version-3.02
- Children:
- 987aaa1
- Parents:
- bcbf543
- Location:
- fedd
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
fedd/fedd_create_experiment.py
rbcbf543 r4fc2250 1236 1236 print >>self.trace_file, "Experiment started" 1237 1237 1238 # Generate an ID for the experiment (slice) and a certificate that the 1239 # allocator can use to prove they own it. We'll ship it back through 1240 # the encrypted connection. 1241 (expid, expcert) = generate_fedid("test", dir=tmpdir, 1242 trace=self.trace_file) 1243 1244 if self.trace_file: 1245 print >>self.trace_file, "removing %s" % tmpdir 1246 1247 # Walk up tmpdir, deleting as we go 1248 for path, dirs, files in os.walk(tmpdir, topdown=False): 1249 for f in files: 1250 os.remove(os.path.join(path, f)) 1251 for d in dirs: 1252 os.rmdir(os.path.join(path, d)) 1253 os.rmdir(tmpdir) 1254 1238 1255 return { 'emulab' : [ tbparams[tb]['emulab'] \ 1239 1256 for tb in tbparams.keys() \ 1240 1257 if tbparams[tb].has_key('emulab') ],\ 1241 1258 'experiment': vtopo,\ 1242 'vis' : vis } 1259 'vis' : vis, 1260 'experimentID' : { 'fedid': expid },\ 1261 'experimentAccess': { 'X509' : expcert },\ 1262 } 1243 1263 1244 1264 if __name__ == '__main__': -
fedd/fedd_types.xsd
rbcbf543 r4fc2250 319 319 maxOccurs="1"/> 320 320 <xsd:element name="vis" type="tns:visType" minOccurs="0" 321 maxOccurs="1"/> 322 <xsd:element name="experimentID" type="tns:IDType"/> 323 <xsd:element name="experimentAccess" type="tns:accessType" minOccurs="0" 321 324 maxOccurs="1"/> 322 325 </xsd:sequence> -
fedd/fedd_util.py
rbcbf543 r4fc2250 1 1 #!/usr/local/bin/python 2 2 3 import sys 3 import os, sys 4 import subprocess 5 import tempfile 4 6 5 7 from M2Crypto import SSL, X509, EVP … … 225 227 else: 226 228 return element 229 230 def generate_fedid(subj, bits=2048, trace=None, dir=None): 231 """ 232 Create a new certificate and derive a fedid from it. 233 234 The fedid and the certificte are returned as a tuple. 235 """ 236 237 keypath = None 238 certpath = None 239 try: 240 try: 241 kd, keypath = tempfile.mkstemp(dir=dir, prefix="key", 242 suffix=".pem") 243 cd, certpath = tempfile.mkstemp(dir=dir, prefix="cert", 244 suffix=".pem") 245 246 cmd = ["openssl", "req", "-text", "-newkey", "rsa:%d" % bits, 247 "-keyout", keypath, "-nodes", "-subj", "/CN=%s" % subj, 248 "-x509", "-days", "30", "-out", certpath] 249 250 if trace: 251 print >>trace, "calling %s" % " ".join(cmd) 252 call_out = trace 253 else: 254 call_out = open("/dev/null", "w") 255 256 rv = subprocess.call(cmd, stdout=call_out, stderr=call_out) 257 if rv == 0: 258 cert = "" 259 for p in (certpath, keypath): 260 f = open(p) 261 for line in f: 262 cert += line 263 264 fid = fedid(file=certpath) 265 return (fid, cert) 266 else: 267 return None 268 except IOError, e: 269 raise e 270 finally: 271 if keypath: os.remove(keypath) 272 if certpath: os.remove(certpath)
Note: See TracChangeset
for help on using the changeset viewer.