Exemplo n.º 1
0
    def generateChecker(self, argstring=""):
        scp = load_settings('cas', syspath='/etc/cas')
        settings = export_settings_to_dict(scp)
        ldap_settings = settings.get('LDAP', {})
        if argstring.strip() != "":
            argdict = dict((x.split('=') for x in argstring.split(':')))
            ldap_settings.update(argdict)
        missing = txcas.utils.get_missing_args(LDAPSimpleBindChecker.__init__,
                                               ldap_settings, ['self'])
        if len(missing) > 0:
            sys.stderr.write("[ERROR][LDAPSimpleBindChecker] "
                             "Missing the following settings: %s" %
                             ', '.join(missing))
            sys.stderr.write('\n')
            sys.exit(1)

        txcas.utils.filter_args(LDAPSimpleBindChecker.__init__, ldap_settings,
                                ['self'])
        buf = ["[CONFIG][LDAPSimpleBindChecker] Settings:"]
        for k in sorted(ldap_settings.keys()):
            if k != "bindpw":
                v = ldap_settings[k]
            else:
                v = "*******"
            buf.append(" - %s: %s" % (k, v))
        sys.stderr.write('\n'.join(buf))
        sys.stderr.write('\n')
        return LDAPSimpleBindChecker(**ldap_settings)
Exemplo n.º 2
0
    def generateChecker(self, argstring=""):
        scp = load_settings('cas', syspath='/etc/cas')
        settings = export_settings_to_dict(scp)
        ldap_settings = settings.get('LDAP', {})    
        if argstring.strip() != "":
            argdict = dict((x.split('=') for x in argstring.split(':')))
            ldap_settings.update(argdict)
        missing = txcas.utils.get_missing_args(
                    LDAPSimpleBindChecker.__init__, ldap_settings, ['self'])
        if len(missing) > 0:
            sys.stderr.write(
                "[ERROR][LDAPSimpleBindChecker] "
                "Missing the following settings: %s" % ', '.join(missing))
            sys.stderr.write('\n') 
            sys.exit(1)

        txcas.utils.filter_args(LDAPSimpleBindChecker.__init__, ldap_settings, ['self'])
        buf = ["[CONFIG][LDAPSimpleBindChecker] Settings:"]
        for k in sorted(ldap_settings.keys()):
            if k != "bindpw":
                v = ldap_settings[k]
            else:
                v = "*******"
            buf.append(" - %s: %s" % (k, v))
        sys.stderr.write('\n'.join(buf)) 
        sys.stderr.write('\n') 
        return LDAPSimpleBindChecker(**ldap_settings)
Exemplo n.º 3
0
 def generateTicketStore(self, argstring=""):
     scp = load_settings('cas', syspath='/etc/cas')
     settings = export_settings_to_dict(scp)
     ts_props = settings.get('CAS', {})
     ts_settings = settings.get('CouchDB', {})
     settings_xlate = {
         'host': 'couch_host',
         'port': 'couch_port',
         'db': 'couch_db',
         'user': '******',
         'passwd': 'couch_passwd',
         'https': 'use_https',
         'debug': '_debug',
     }
     temp = {}
     for k, v in ts_settings.iteritems():
         k = settings_xlate.get(k, k)
         temp[k] = v
     ts_settings = temp
     del temp
     if argstring.strip() != "":
         argdict = dict((x.split('=') for x in argstring.split(':')))
         ts_settings.update(argdict)
     missing = get_missing_args(CouchDBTicketStore.__init__, ts_settings,
                                ['self'])
     if len(missing) > 0:
         sys.stderr.write("[ERROR][CouchDBTicketStore] "
                          "Missing the following settings: %s" %
                          ', '.join(missing))
         sys.stderr.write('\n')
         sys.exit(1)
     props = ('lt_lifespan', 'st_lifespan', 'pt_lifespan', 'tgt_lifespan',
              'pgt_lifespan', 'ticket_size', '_debug')
     ts_props = dict(
         (prop, int(ts_props[prop])) for prop in props if prop in ts_props)
     filter_args(CouchDBTicketStore.__init__, ts_settings, ['self'])
     if 'couch_port' in ts_settings:
         ts_settings['couch_port'] = int(ts_settings['couch_port'])
     if 'use_https' in ts_settings:
         ts_settings['use_https'] = get_bool(ts_settings['use_https'])
     if 'verify_cert' in ts_settings:
         ts_settings['verify_cert'] = get_bool(ts_settings['verify_cert'])
     if '_debug' in ts_settings:
         ts_settings['_debug'] = get_bool(ts_settings['_debug'])
     obj = CouchDBTicketStore(**ts_settings)
     for prop, value in ts_props.iteritems():
         setattr(obj, prop, value)
     buf = ["[CONFIG][CouchDBTicketStore] Settings:"]
     d = dict(ts_settings)
     d.update(ts_props)
     for k in sorted(d.keys()):
         v = d[k]
         if k == 'couch_passwd':
             v = '*******'
         buf.append(" - %s: %s" % (k, v))
     sys.stderr.write('\n'.join(buf))
     sys.stderr.write('\n')
     return obj
Exemplo n.º 4
0
 def generateTicketStore(self, argstring=""):
     scp = load_settings('cas', syspath='/etc/cas')
     settings = export_settings_to_dict(scp)
     ts_props = settings.get('CAS', {})
     ts_settings = settings.get('CouchDB', {})
     settings_xlate = {
             'host': 'couch_host',
             'port': 'couch_port',
             'db': 'couch_db',
             'user': '******',
             'passwd': 'couch_passwd',
             'https': 'use_https',
             'debug': '_debug',
         }
     temp = {}
     for k, v in ts_settings.iteritems():
         k = settings_xlate.get(k, k)
         temp[k] = v
     ts_settings = temp
     del temp
     if argstring.strip() != "":
         argdict = dict((x.split('=') for x in argstring.split(':')))
         ts_settings.update(argdict)
     missing = get_missing_args(
                 CouchDBTicketStore.__init__, ts_settings, ['self'])
     if len(missing) > 0:
         sys.stderr.write(
             "[ERROR][CouchDBTicketStore] "
             "Missing the following settings: %s" % ', '.join(missing))
         sys.stderr.write('\n')
         sys.exit(1)
     props = (
             'lt_lifespan', 'st_lifespan', 'pt_lifespan', 
             'tgt_lifespan', 'pgt_lifespan', 'ticket_size', '_debug')
     ts_props = dict((prop, int(ts_props[prop])) for prop in props if prop in ts_props)
     filter_args(CouchDBTicketStore.__init__, ts_settings, ['self'])
     if 'couch_port' in ts_settings:
         ts_settings['couch_port'] = int(ts_settings['couch_port'])
     if 'use_https' in ts_settings:
         ts_settings['use_https'] = get_bool(ts_settings['use_https'])
     if 'verify_cert' in ts_settings:
         ts_settings['verify_cert'] = get_bool(ts_settings['verify_cert'])
     if '_debug' in ts_settings:
         ts_settings['_debug'] = get_bool(ts_settings['_debug'])
     obj = CouchDBTicketStore(**ts_settings)
     for prop, value in ts_props.iteritems():
         setattr(obj, prop, value)
     buf = ["[CONFIG][CouchDBTicketStore] Settings:"]
     d = dict(ts_settings)
     d.update(ts_props)
     for k in sorted(d.keys()):
         v = d[k]
         if k == 'couch_passwd':
             v = '*******'
         buf.append(" - %s: %s" % (k, v))
     sys.stderr.write('\n'.join(buf))
     sys.stderr.write('\n')
     return obj
Exemplo n.º 5
0
 def generateRealm(self, argstring=""):
     scp = load_settings('cas', syspath='/etc/cas')
     settings = export_settings_to_dict(scp)
     ldap_settings = settings.get('LDAP', {})
     temp = settings.get("LDAPRealm", {})
     ldap_settings.update(temp)
     del temp
     if argstring.strip() != "":
         argdict = dict((x.split('=') for x in argstring.split(':')))
         ldap_settings.update(argdict)
     missing = txcas.utils.get_missing_args(LDAPRealm.__init__,
                                            ldap_settings, ['self'])
     if len(missing) > 0:
         sys.stderr.write("[ERROR][LDAPRealm] "
                          "Missing the following settings: %s" %
                          ', '.join(missing))
         sys.stderr.write('\n')
         sys.exit(1)
     if 'attribs' in ldap_settings:
         attribs = ldap_settings['attribs']
         attribs = attribs.split(',')
         ldap_settings['attribs'] = attribs
     if 'aliases' in ldap_settings:
         aliases = ldap_settings['aliases']
         aliases = aliases.split(',')
         ldap_settings['aliases'] = aliases
     if 'service_based_attribs' in ldap_settings:
         ldap_settings['service_based_attribs'] = get_bool(
             ldap_settings['service_based_attribs'])
     if 'start_tls' in ldap_settings:
         ldap_settings['start_tls'] = get_bool(ldap_settings['start_tls'])
     txcas.utils.filter_args(LDAPRealm.__init__, ldap_settings, ['self'])
     buf = ["[CONFIG][LDAPRealm] Settings:"]
     for k in sorted(ldap_settings.keys()):
         if k != "bindpw":
             v = ldap_settings[k]
         else:
             v = "*******"
         buf.append(" - %s: %s" % (k, v))
     sys.stderr.write('\n'.join(buf))
     sys.stderr.write('\n')
     return LDAPRealm(**ldap_settings)
Exemplo n.º 6
0
 def generateRealm(self, argstring=""):
     scp = load_settings("cas", syspath="/etc/cas")
     settings = export_settings_to_dict(scp)
     ldap_settings = settings.get("LDAP", {})
     temp = settings.get("LDAPRealm", {})
     ldap_settings.update(temp)
     del temp
     if argstring.strip() != "":
         argdict = dict((x.split("=") for x in argstring.split(":")))
         ldap_settings.update(argdict)
     missing = txcas.utils.get_missing_args(LDAPRealm.__init__, ldap_settings, ["self"])
     if len(missing) > 0:
         sys.stderr.write("[ERROR][LDAPRealm] " "Missing the following settings: %s" % ", ".join(missing))
         sys.stderr.write("\n")
         sys.exit(1)
     if "attribs" in ldap_settings:
         attribs = ldap_settings["attribs"]
         attribs = attribs.split(",")
         ldap_settings["attribs"] = attribs
     if "aliases" in ldap_settings:
         aliases = ldap_settings["aliases"]
         aliases = aliases.split(",")
         ldap_settings["aliases"] = aliases
     if "service_based_attribs" in ldap_settings:
         ldap_settings["service_based_attribs"] = get_bool(ldap_settings["service_based_attribs"])
     if "start_tls" in ldap_settings:
         ldap_settings["start_tls"] = get_bool(ldap_settings["start_tls"])
     txcas.utils.filter_args(LDAPRealm.__init__, ldap_settings, ["self"])
     buf = ["[CONFIG][LDAPRealm] Settings:"]
     for k in sorted(ldap_settings.keys()):
         if k != "bindpw":
             v = ldap_settings[k]
         else:
             v = "*******"
         buf.append(" - %s: %s" % (k, v))
     sys.stderr.write("\n".join(buf))
     sys.stderr.write("\n")
     return LDAPRealm(**ldap_settings)