Changeset 62f3dd9
- Timestamp:
- Dec 10, 2010 9:00:16 AM (14 years ago)
- Branches:
- axis_example, compt_changes, info-ops, master
- Children:
- 913dc7a
- Parents:
- fbee30a
- git-author:
- Ted Faber <faber@…> (12/09/10 11:41:45)
- git-committer:
- Ted Faber <faber@…> (12/10/10 09:00:16)
- Location:
- fedd
- Files:
-
- 17 edited
Legend:
- Unmodified
- Added
- Removed
-
fedd/access_to_abac.py
rfbee30a r62f3dd9 12 12 from federation.fedid import fedid 13 13 from federation.authorizer import abac_authorizer 14 from federation.util import abac_split_cert, abac_pem_type 14 from federation.util import abac_split_cert, abac_pem_type, file_expanding_opts 15 15 16 16 … … 224 224 225 225 226 class access_opts( OptionParser):226 class access_opts(file_expanding_opts): 227 227 ''' 228 228 Parse the options for this program. Most are straightforward, but the … … 247 247 248 248 def __init__(self): 249 OptionParser.__init__(self, usage='%prog [opts] file [...]')249 file_expanding_opts.__init__(self, usage='%prog [opts] file [...]') 250 250 self.add_option('--cert', dest='cert', default=None, 251 type='str', action='callback', callback=self.expand_file, 251 252 help='my fedid as an X.509 certificate') 252 253 self.add_option('--key', dest='key', default=None, 254 type='str', action='callback', callback=self.expand_file, 253 255 help='key for the certificate') 254 256 self.add_option('--dir', dest='dir', default=None, 257 type='str', action='callback', callback=self.expand_file, 255 258 help='Output directory for credentials') 256 259 self.add_option('--type', action='callback', nargs=1, type='str', … … 263 266 default=False, 264 267 help='Do not print credential to local attribute map') 265 self.add_option('--create -creds', action='store_true',268 self.add_option('--create_creds', action='store_true', 266 269 dest='create_creds', default=False, 267 270 help='create credentials for rules. Requires ' + \ 268 271 '--cert, --key, and --dir to be given.') 269 272 self.add_option('--file', dest='file', default=None, 273 type='str', action='callback', callback=self.expand_file, 270 274 help='Access DB to parse. If this is present, ' + \ 271 275 'omit the positional filename') 272 276 self.add_option('--mapfile', dest='map', default=None, 277 type='str', action='callback', callback=self.expand_file, 273 278 help='File for the attribute to local authorization data') 274 279 self.add_option('--no-delegate', action='store_false', dest='delegate', -
fedd/cert_to_fedid.py
rfbee30a r62f3dd9 3 3 import sys, os 4 4 import subprocess, tempfile 5 import os.path 5 6 6 7 from string import join 7 from optparse import OptionParser 8 from federation.util import abac_pem_type, abac_split_cert 8 from federation.util import abac_pem_type, abac_split_cert, file_expanding_opts 9 9 10 class Parser( OptionParser):10 class Parser(file_expanding_opts): 11 11 def __init__(self): 12 OptionParser.__init__(self, usage='%prog [options]')12 file_expanding_opts.__init__(self, usage='%prog [options]') 13 13 self.add_option('--out', dest='out', help='destination file', 14 action='callback', callback=self.expand_file, type='str', 14 15 default='./cert.pem') 15 16 self.add_option('--debug', dest='debug', action='store_true', -
fedd/confirm_sshkey.py
rfbee30a r62f3dd9 3 3 import os, sys 4 4 import MySQLdb 5 from optparse import OptionParser5 from federation.util import file_expanding_opts 6 6 7 7 8 class opt_parser( OptionParser):8 class opt_parser(file_expanding_opts): 9 9 def __init__(self): 10 10 OptionParser.__init__(self, usage="%prog [opts] (--help for details)", … … 12 12 self.add_option('-u', '--user', dest='user', action='store', 13 13 default=None, help="User to confirm key of") 14 self.add_option('-f', '--keyfile', dest='keyfile', action='store', 14 self.add_option('-f', '--keyfile', dest='keyfile', 15 action='callback', callback=self.expand_file, type='str', 15 16 default=None, help="file containing pubkey to confirm") 16 self.add_option('-k', '--key', dest='key', 17 default=None, action='store',17 self.add_option('-k', '--key', dest='key', default=None, 18 action='callback', callback=self.expand_file, type='str', 18 19 help='Key on the command line') 19 20 self.add_option('-q', '--quiet', dest='verbose', action='store_false', -
fedd/creddy_split.py
rfbee30a r62f3dd9 5 5 import os 6 6 7 from optparse import OptionParser 8 from federation.util import abac_split_cert, abac_pem_type 7 from federation.util import abac_split_cert, abac_pem_type, file_expanding_opts 9 8 10 9 # Options 11 class Parser( OptionParser):10 class Parser(file_expanding_opts): 12 11 def __init__(self): 13 OptionParser.__init__(self, usage="%prog [options] file.pem")12 file_expanding_opts.__init__(self, usage="%prog [options] file.pem") 14 13 self.add_option('--cert', dest='cert', default='./cert.pem', 14 action='callback', callback=self.expand_file, type='str', 15 15 help='File to extract certificate into, default: [%default]') 16 16 self.add_option('--key', dest='key', default='./key.pem', 17 action='callback', callback=self.expand_file, type='str', 17 18 help='File to extract key into, default: [%default]') 18 19 self.add_option('--force', action='store_true', dest='force', -
fedd/fedd.py
rfbee30a r62f3dd9 7 7 from federation import config_parser 8 8 from federation.server import server, xmlrpc_handler, soap_handler 9 from federation.util import fedd_ssl_context 9 from federation.util import fedd_ssl_context, file_expanding_opts 10 10 from federation.deter_impl import new_feddservice 11 11 … … 18 18 import logging 19 19 import M2Crypto 20 21 class fedd_opts(OptionParser): 20 import os.path 21 22 class fedd_opts(file_expanding_opts): 22 23 """Encapsulate option processing in this class, rather than in main""" 24 23 25 def __init__(self): 24 OptionParser.__init__(self, usage="%prog [opts] (--help for details)", 26 file_expanding_opts.__init__(self, 27 usage="%prog [opts] (--help for details)", 25 28 version="0.1") 26 29 … … 29 32 self.add_option("-d", "--debug", action="count", dest="debug", 30 33 help="Set debug. Repeat for more information") 31 self.add_option("-f", "--configfile", action="store", 34 self.add_option("-f", "--configfile", action="callback", 35 callback=self.expand_file, type='str', 32 36 default="/usr/local/etc/fedd.conf", 33 dest="configfile", help="Configuration file (required)")37 dest="configfile", help="Configuration file") 34 38 self.add_option("-l", "--logfile", action="store", dest="logfile", 35 39 help="File to send log messages to") -
fedd/fedd_create.py
rfbee30a r62f3dd9 26 26 client_opts.__init__(self) 27 27 self.add_option("--experiment_cert", dest="out_certfile", 28 action="callback", callback=self.expand_file, 28 29 type="string", help="output certificate file") 29 30 self.add_option("--experiment_name", dest="exp_name", 30 31 type="string", help="Suggested experiment name") 31 self.add_option("--file", dest="file", 32 self.add_option("--file", dest="file", action="callback", 33 callback=self.expand_file, type="str", 32 34 help="experiment description file") 33 35 self.add_option("--project", action="store", dest="project", -
fedd/fedd_ftopo.py
rfbee30a r62f3dd9 12 12 client_opts.__init__(self) 13 13 self.add_option("--experiment_cert", dest="exp_certfile", 14 type="string", help="experiment certificate file") 14 action='callback', callback=self.expand_file, type='str', 15 help="experiment certificate file") 15 16 self.add_option("--experiment_name", dest="exp_name", 16 17 type="string", help="human readable experiment name") -
fedd/fedd_image.py
rfbee30a r62f3dd9 17 17 client_opts.__init__(self) 18 18 self.add_option("--experiment_cert", dest="exp_certfile", 19 type="string", help="experiment certificate file") 19 action='callback', callback=self.expand_file, type='str', 20 help="experiment certificate file") 20 21 self.add_option("--experiment_name", dest="exp_name", 21 22 type="string", help="human readable experiment name") 22 self.add_option("--output", dest="outfile", type="string", 23 self.add_option("--output", dest="outfile", 24 action='callback', callback=self.expand_file, type='str', 23 25 help="output image file") 24 26 self.add_option("--format", dest="format", type="choice", … … 38 40 help="Size of output in pixels (diagrams are square") 39 41 self.add_option("--file", dest="file", 42 action='callback', callback=self.expand_file, type='str', 40 43 help="experiment description file") 41 44 self.add_option("--group", dest="group", action="append", default=[], -
fedd/fedd_info.py
rfbee30a r62f3dd9 11 11 client_opts.__init__(self) 12 12 self.add_option("--experiment_cert", dest="exp_certfile", 13 type="string", help="experiment certificate file") 13 action='callback', callback=self.expand_file, type='str', 14 help="experiment certificate file") 14 15 self.add_option("--experiment_name", dest="exp_name", 15 16 type="string", help="human readable experiment name") -
fedd/fedd_new.py
rfbee30a r62f3dd9 14 14 client_opts.__init__(self) 15 15 self.add_option("--experiment_cert", dest="out_certfile", 16 type="string", help="output certificate file") 16 action='callback', callback=self.expand_file, type='str', 17 help="output certificate file") 17 18 self.add_option("--experiment_name", dest="exp_name", 18 19 type="string", help="Suggested experiment name") -
fedd/fedd_ns2topdl.py
rfbee30a r62f3dd9 12 12 client_opts.__init__(self) 13 13 self.add_option("--file", dest="file", 14 action='callback', callback=self.expand_file, type='str', 14 15 help="experiment description file") 15 16 self.add_option("--output", dest="outfile", type="string", -
fedd/fedd_spewlog.py
rfbee30a r62f3dd9 12 12 client_opts.__init__(self) 13 13 self.add_option("--experiment_cert", dest="exp_certfile", 14 type="string", help="experiment name certificate file") 14 action='callback', callback=self.expand_file, type='str', 15 help="experiment name certificate file") 15 16 self.add_option("--experiment_name", dest="exp_name", 16 17 type="string", help="human readable experiment name") 17 18 self.add_option("--logfile", dest="logfile", default=None, 19 action='callback', callback=self.expand_file, type='str', 18 20 help="File to write log to") 19 21 self.add_option('--update_time', dest='update', type='int', default=10, -
fedd/fedd_terminate.py
rfbee30a r62f3dd9 12 12 client_opts.__init__(self) 13 13 self.add_option("--experiment_cert", dest="exp_certfile", 14 type="string", help="experiment certificate file") 14 action='callback', callback=self.expand_file, type='str', 15 help="experiment certificate file") 15 16 self.add_option("--experiment_name", dest="exp_name", 16 17 type="string", help="human readable experiment name") … … 19 20 help="Force termination if experiment is in strange state") 20 21 self.add_option("--logfile", dest="logfile", default=None, 22 action='callback', callback=self.expand_file, type='str', 21 23 help="File to write log to") 22 24 self.add_option("--print_log", dest="print_log", default=False, -
fedd/fedd_to_abac.py
rfbee30a r62f3dd9 9 9 10 10 from string import join 11 from optparse import OptionParser12 11 13 from federation.util import abac_pem_type, abac_split_cert 12 from federation.util import abac_pem_type, abac_split_cert, file_expanding_opts 14 13 15 class Parser( OptionParser):14 class Parser(file_expanding_opts): 16 15 def __init__(self): 17 OptionParser.__init__(self)16 file_expanding_opts.__init__(self) 18 17 self.add_option('--cert', dest='cert', default=None, 18 action='callback', callback=self.expand_file, type='str', 19 19 help='my fedid as an X.509 certificate') 20 20 self.add_option('--key', dest='key', default=None, 21 action='callback', callback=self.expand_file, type='str', 21 22 help='key for the certificate') 22 23 self.add_option('--dir', dest='dir', default=None, 24 action='callback', callback=self.expand_file, type='str', 23 25 help='Output directory for credentials') 24 26 self.add_option('--make-dir', action='store_true', dest='make_dir', -
fedd/federation/client_lib.py
rfbee30a r62f3dd9 10 10 11 11 from fedid import fedid 12 from util import fedd_ssl_context 12 from util import fedd_ssl_context, file_expanding_opts 13 13 from remote_service import service_caller 14 14 from service_error import service_error … … 17 17 18 18 19 class client_opts( OptionParser):19 class client_opts(file_expanding_opts): 20 20 """ 21 21 Standatd set of options that all clients talking to fedd can probably use. 22 22 Client code usually specializes this. 23 23 """ 24 24 25 def __init__(self): 25 OptionParser.__init__(self, usage="%prog [opts] (--help for details)", 26 file_expanding_opts.__init__(self, 27 usage="%prog [opts] (--help for details)", 26 28 version="0.1") 27 29 28 self.add_option("--cert", action="store", dest="cert", 30 self.add_option("--cert", action="callback", dest="cert", 31 callback=self.expand_file, 29 32 type="string", help="my certificate file") 30 self.add_option("--abac", action="store", dest="abac_dir", 31 type="string", help="Directory with abac certs") 33 self.add_option("--abac", action="callback", dest="abac_dir", 34 callback=self.expand_file, 35 type="string", default=os.path.expanduser('~/.abac'), 36 help="Directory with abac certs") 37 self.add_option('--no_abac', action='store_const', const=None, 38 dest='abac_dir', help='Do not use abac authorization') 32 39 self.add_option( "--debug", action="count", dest="debug", 33 40 default=0, help="Set debug. Repeat for more information") … … 35 42 dest="serialize_only", default=False, 36 43 help="Print the SOAP request that would be sent and exit") 37 self.add_option("--trusted", action="store", dest="trusted", 44 self.add_option("--trusted", action="callback", dest="trusted", 45 callback=self.expand_file, 38 46 type="string", help="Trusted certificates (required)") 39 47 self.add_option("--url", action="store", dest="url", … … 98 106 ''' 99 107 rv = [ ] 100 if dir :108 if dir and os.path.isdir(dir): 101 109 for fn in ["%s/%s" % (dir, p) for p in os.listdir(dir) \ 102 110 if os.path.isfile("%s/%s" % (dir,p))]: -
fedd/federation/util.py
rfbee30a r62f3dd9 8 8 9 9 import httplib 10 11 from optparse import OptionParser 10 12 11 13 from socket import sslerror … … 95 97 self.set_allow_unknown_ca(True) 96 98 self.set_verify(SSL.verify_peer, 10, callback=callb) 99 100 class file_expanding_opts(OptionParser): 101 def expand_file(self, option, opt_str, v, p): 102 """ 103 Store the given value to the given destination after expanding home 104 directories. 105 """ 106 setattr(p.values, option.dest, os.path.expanduser(v)) 107 108 def __init__(self, usage=None, version=None): 109 OptionParser.__init__(self) 110 97 111 98 112 def read_simple_accessdb(fn, auth, mask=[]): -
fedd/init_abac_authorizer.py
rfbee30a r62f3dd9 5 5 6 6 from optparse import OptionParser 7 from federation.authorizer import abac_authorizer 7 from federation.authorizer import abac_authorizer, file_expanding_opts 8 8 9 9 class Parser(OptionParser): 10 10 def __init__(self): 11 11 OptionParser.__init__(self, usage='%prog [options]') 12 self.add_option('--cert', dest='cert', help='Identity certificate') 13 self.add_option('--key', dest='key', help='Identity key') 12 self.add_option('--cert', dest='cert', 13 action='callback', callback=self.expand_file, type='str', 14 help='Identity certificate') 15 self.add_option('--key', dest='key', 16 action='callback', callback=self.expand_file, type='str', 17 help='Identity key') 14 18 self.add_option('--policy', dest='policy', 19 action='callback', callback=self.expand_file, type='str', 15 20 help='ABAC policy certificates') 16 self.add_option('--dir', dest='out_dir', help='directory to save into') 21 self.add_option('--dir', dest='out_dir', 22 action='callback', callback=self.expand_file, type='str', 23 help='directory to save into') 17 24 18 25 parser = Parser()
Note: See TracChangeset
for help on using the changeset viewer.