Beispiel #1
0
                # XXX: for VOMS_DIR use same approach as arcproxy
                vomsdir = os.getenv("X509_VOMS_DIR")
                if not vomsdir:
                    vomsdir = gc3libs.Default.VOMS_DIR
                arc.parseVOMSAC(cert, cadir, vomsdir, voms_trust_dn, voms_attributes, True, True)
                if voms_attributes.size() > 0:
                    # XXX: for the moment, check only the first entry
                    voms_attribute = voms_attributes[0]
                    if hasattr(voms_attribute,'voname'):
                        # XXX: Assume this is enough ?
                        gc3libs.log.info("Found valid voms proxy of VOname '%s'" % voms_attribute.voname)
                        return True
                else:
                    # No attributes found
                    gc3libs.log.error("No voms attributes found. Is it a grid-proxy ?")
                    return False
            except Exception, ex:
                gc3libs.log.error("Exception in ARC1 libraries: %s %s" % (ex.__class__,ex.message))
                return False

Auth.register('grid-proxy', GridAuth)
Auth.register('voms-proxy', GridAuth)


## main: run tests

if "__main__" == __name__:
    import doctest
    doctest.testmod(name="arc",
                    optionflags=doctest.NORMALIZE_WHITESPACE)
Beispiel #2
0
            if 'ec2_secret_key' not in auth:
                auth['ec2_secret_key'] = os.getenv('EC2_SECRET_KEY')
                assert auth['ec2_secret_key'], \
                    "Configuration error. Missing mandatory " \
                    "`ec2_secret_key` key"

        except AssertionError as x:
            raise gc3libs.exceptions.ConfigurationError(
                'Erroneous configuration parameter: %s' % str(x))

        # Strip quotes from ec2_*_key in case someone put it in the
        # configuration file
        auth['ec2_secret_key'] = auth['ec2_secret_key'].strip('"').strip("'")
        auth['ec2_access_key'] = auth['ec2_access_key'].strip('"').strip("'")

    def check(self):
        return True

    def enable(self):
        return True


Auth.register('ec2', EC2Auth)

# main: run tests

if "__main__" == __name__:
    import doctest
    doctest.testmod(name="ec2",
                    optionflags=doctest.NORMALIZE_WHITESPACE)
Beispiel #3
0
        except (ValueError, TypeError) as err:
            raise gc3libs.exceptions.ConfigurationError(
                "Invalid `port` setting in SSH auth section.")
        try:
            if timeout is not None:
                self.timeout = float(timeout)
            else:
                self.timeout = None
        except (ValueError, TypeError) as err:
            raise gc3libs.exceptions.ConfigurationError(
                "Invalid `timeout` setting in SSH auth section.")

        # everything else is just stored as-is
        self.__dict__.update(extra)

    def check(self):
        return True

    def enable(self):
        return True

Auth.register('ssh', SshAuth)


# main: run tests

if "__main__" == __name__:
    import doctest
    doctest.testmod(name="ssh",
                    optionflags=doctest.NORMALIZE_WHITESPACE)
Beispiel #4
0
                if key not in auth:
                    auth[key] = os.getenv(var)
                    assert auth[key], \
                        "Configuration error. Missing mandatory "\
                        "`%s` key" % key
                    # Strip quotes from os_* in case someone put
                    # it in the configuration file
                    auth[key] = auth[key].strip('"').strip("'")
        except AssertionError as x:
            raise gc3libs.exceptions.ConfigurationError(
                'Erroneous configuration parameter: %s' % str(x))

        self.__dict__.update(auth)

    def check(self):
        gc3libs.log.debug('Checking auth: OpenStackAuth')
        return True

    def enable(self):
        return True


Auth.register('openstack', OpenStackAuth)

# main: run tests

if "__main__" == __name__:
    import doctest
    doctest.testmod(name="openstack",
                    optionflags=doctest.NORMALIZE_WHITESPACE)
Beispiel #5
0
                    "`ec2_access_key` key"
            if 'ec2_secret_key' not in auth:
                auth['ec2_secret_key'] = os.getenv('EC2_SECRET_KEY')
                assert auth['ec2_secret_key'], \
                    "Configuration error. Missing mandatory " \
                    "`ec2_secret_key` key"

        except AssertionError as x:
            raise gc3libs.exceptions.ConfigurationError(
                'Erroneous configuration parameter: %s' % str(x))

        # Strip quotes from ec2_*_key in case someone put it in the
        # configuration file
        auth['ec2_secret_key'] = auth['ec2_secret_key'].strip('"').strip("'")
        auth['ec2_access_key'] = auth['ec2_access_key'].strip('"').strip("'")

    def check(self):
        return True

    def enable(self):
        return True


Auth.register('ec2', EC2Auth)

# main: run tests

if "__main__" == __name__:
    import doctest
    doctest.testmod(name="ec2", optionflags=doctest.NORMALIZE_WHITESPACE)
Beispiel #6
0
        except (ValueError, TypeError) as err:
            raise gc3libs.exceptions.ConfigurationError(
                "Invalid `port` setting in SSH auth section.")
        try:
            if timeout is not None:
                self.timeout = float(timeout)
            else:
                self.timeout = None
        except (ValueError, TypeError) as err:
            raise gc3libs.exceptions.ConfigurationError(
                "Invalid `timeout` setting in SSH auth section.")

        # everything else is just stored as-is
        self.__dict__.update(extra)

    def check(self):
        return True

    def enable(self):
        return True

Auth.register('ssh', SshAuth)


# main: run tests

if "__main__" == __name__:
    import doctest
    doctest.testmod(name="ssh",
                    optionflags=doctest.NORMALIZE_WHITESPACE)