Changeset 67fa1cf for fedd/federation
- Timestamp:
- May 30, 2013 3:53:29 PM (12 years ago)
- Branches:
- master
- Children:
- 1f9c361, b213b53
- Parents:
- e8f2d4c
- Location:
- fedd/federation
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
fedd/federation/authorizer.py
re8f2d4c r67fa1cf 15 15 16 16 import ABAC 17 import Creddy18 17 import pickle 19 18 … … 258 257 259 258 for dir in certs or []: 260 self. context.load_directory(dir)259 self.resilient_load_directory(dir) 261 260 262 261 if load: … … 266 265 self.creddy_id = None 267 266 try: 268 self.creddy_id = Creddy.ID(self.me)267 self.creddy_id = ABAC.ID(self.me) 269 268 except: 270 269 raise abac_authorizer.bad_cert_error('Cannot load cert %s' \ … … 277 276 raise abac_authorized_bad_cert_error('Cannot load key %s' \ 278 277 % self.key) 278 279 def resilient_load_directory(self, dirname): 280 ''' 281 ABAC.Context.load_directory has foolish arbitrary filename 282 distinctions. This tries to load the contents of dirname into the 283 authorizer's context first as IDs and then any that fail as attributes. 284 ''' 285 files = os.listdir(dirname) 286 attrs = [] 287 for f in files: 288 p = os.path.join(dirname, f) 289 if not os.path.isfile(p): continue 290 if self.context.load_id_file(p) != ABAC.ABAC_CERT_SUCCESS: 291 attrs.append(p) 292 for p in attrs: 293 self.context.load_attribute_file(p) 279 294 280 295 … … 318 333 if data_list is None: data_list = [] 319 334 for fn in file_list: 320 # Try to parse file as a CreddyID, so we can import PEM files335 # Try to parse file as a ABAC ID, so we can import PEM files 321 336 try: 322 cid = Creddy.ID(fn)337 cid = ABAC.ID(fn) 323 338 data_list.append(cid.cert_chunk()) 324 339 continue … … 379 394 # This will simplify when we have libcreddy 380 395 try: 381 attrcert = Creddy.Attribute(self.creddy_id,396 attrcert = ABAC.Attribute(self.creddy_id, 382 397 self.clean_attr(attr), 3600 * 24 * 365 * 10) 383 398 attrcert.principal("%s" % name) … … 575 590 attr = c.attribute_cert() 576 591 # NB: file naming conventions matter here. The trailing_ID and 577 # _attr are required by ABAC.COntext.load_directory() 592 # _attr are required by ABAC.Context.load_directory(). We use 593 # resilient_load_directory now, but no sense pulling these out 594 # now. 578 595 if id and id not in seenid: 579 f = open("%s/certs/ID_%05d_ID. der" % (dir, ii), "w")596 f = open("%s/certs/ID_%05d_ID.xml" % (dir, ii), "w") 580 597 f.write(id) 581 598 f.close() … … 583 600 seenid.add(id) 584 601 if attr and attr not in seenattr: 585 f = open("%s/certs/attr_%05d_attr. der" % (dir, ai), "w")602 f = open("%s/certs/attr_%05d_attr.xml" % (dir, ai), "w") 586 603 f.write(attr) 587 604 f.close() … … 620 637 if self.key: 621 638 self.init_libcreddy_id() 622 self. context.load_directory("%s/certs" % dir)639 self.resilient_load_directory("%s/certs" % dir) 623 640 self.save_dir = dir 624 641 except EnvironmentError, e: -
fedd/federation/proof.py
re8f2d4c r67fa1cf 3 3 4 4 import ABAC 5 import Creddy6 5 import sys 7 6 import os, os.path … … 43 42 f.close() 44 43 45 cid = Creddy.ID(der_name)44 cid = ABAC.ID(der_name) 46 45 47 46 tf = open(pem_name, 'w')
Note: See TracChangeset
for help on using the changeset viewer.