Esempio n. 1
0
def testAuthClientAction():
    c = \
"""
[general]
authClientCommand = bash authenticator/wrapper_auth.sh -p %(port)s -h %(host)s -u %(fileNameToStoreRemoteUserName)s
"""
    f = getTempFile(c)
    inputOption = "--config=%s host1:/tmp/file host2:/tmp/file1" % f.name
    conf = ConfigFDTCopy(inputOption.split())
    a = AuthClientAction("some_id", dict(port = "someport", host = "somehost"))
    fileNameToStoreRemoteUserName = "******" + a.id + "--" + getRandomString('a', 'z', 5)
    a._setUp(conf, fileNameToStoreRemoteUserName)
    assert a.options["port"] == "someport"
    c = ("bash authenticator/wrapper_auth.sh -p someport -h somehost "
         "-u %s" % fileNameToStoreRemoteUserName)
    assert a.command == c
Esempio n. 2
0
def testAuthClientAction():
    c = \
        """
[general]
authClientCommand = bash authenticator/wrapper_auth.sh -p %(port)s -h %(host)s -u %(fileNameToStoreRemoteUserName)s
"""
    f = getTempFile(c)
    inputOption = "--config=%s host1:/tmp/file host2:/tmp/file1" % f.name
    conf = ConfigFDTCopy(inputOption.split())
    a = AuthClientAction("some_id", dict(port="someport", host="somehost"))
    fileNameToStoreRemoteUserName = ("/tmp/" + a.id + "--" +
                                     getRandomString('a', 'z', 5))
    a._setUp(conf, fileNameToStoreRemoteUserName)
    assert a.options["port"] == "someport"
    c = ("bash authenticator/wrapper_auth.sh -p someport -h somehost "
         "-u %s" % fileNameToStoreRemoteUserName)
    assert a.command == c
Esempio n. 3
0
    def _runAuthChain(self):
        # 1) contact remote parties in order to obtain port on which
        # AuthService runs, then run AuthClient locally to perform
        # authentication first with the destination, then with source site
        authServiceAction = AuthServiceAction(self.id)

        # inconsistent design - catching exceptions / checking result status?
        result = self.receiver.perform(authServiceAction)

        authServicePortReceiver = result.serverPort
        self.logger.info("Remote AuthService (receiver): %s:%s" %
                         (result.host, authServicePortReceiver))

        result = self.sender.perform(authServiceAction)

        authServicePortSender = result.serverPort
        self.logger.info("Remote AuthService (sender): %s:%s" %
                         (result.host, authServicePortSender))

        # 2) run local AuthClient and authenticate with A, then B
        # set options so that AuthClient know which host:port to contact
        options = dict(host=self.hostDest, port=authServicePortReceiver)
        authClientAction = AuthClientAction(self.id, options)

        # execute locally AuthClient and authenticate with destination
        # remote site
        # (the one which will receive files)
        result, remoteGridUserDest = authClientAction.execute(
            conf=self.conf, logger=self.logger)

        self.logger.debug("Authentication client result: %s, Grid user name "
                          "at destination: %s" % (result, remoteGridUserDest))

        # inconsistent design - catching exceptions / checking result status?
        if result.status != 0:
            raise FDTCopyException("Authentication failed, reason: %s" %
                                   result.msg)

        # if no exception was raised here, first local-"receiver site"
        # authentication was successful

        # run local AuthClient - source remote site (the one which will
        # send files)
        # set options so that AuthClient know which host:port to contact
        options = dict(host=self.hostSrc, port=authServicePortSender)
        authClientAction = AuthClientAction(self.id, options)

        # execute locally AuthClient
        result, remoteGridUserSrc = authClientAction.execute(
            conf=self.conf, logger=self.logger)

        self.logger.debug("Authentication client result: %s, Grid user name "
                          "at source: %s" % (result, remoteGridUserSrc))

        # inconsistent design - catching exceptions / checking result status?
        if result.status != 0:
            raise FDTCopyException("Authentication failed, reason: %s" %
                                   result.msg)

        # if no exception was raised, authentication chain was successful

        # no need to perform clean up - AuthService processes are running only
        # in single instances at remote sites and taken care of by the
        # daemon process

        self.logger.info("Authentication chain was successful.")

        return remoteGridUserSrc, remoteGridUserDest
Esempio n. 4
0
    def _runAuthChain(self):
        # 1) contact remote parties in order to obtain port on which
        # AuthService runs, then run AuthClient locally to perform
        # authentication first with the destination, then with source site
        authServiceAction = AuthServiceAction(self.id)

        # inconsistent design - catching exceptions / checking result status?
        result = self.receiver.perform(authServiceAction)
        
        authServicePortReceiver = result.serverPort
        self.logger.info("Remote AuthService (receiver): %s:%s" %
                         (result.host, authServicePortReceiver))
        
        result = self.sender.perform(authServiceAction)
        
        authServicePortSender = result.serverPort
        self.logger.info("Remote AuthService (sender): %s:%s" %
                         (result.host, authServicePortSender))
                
        # 2) run local AuthClient and authenticate with A, then B
        # set options so that AuthClient know which host:port to contact
        options = dict(host = self.hostDest, port = authServicePortReceiver)        
        authClientAction = AuthClientAction(self.id, options)
        
        # execute locally AuthClient and authenticate with destination remote site
        # (the one which will receive files)
        result, remoteGridUserDest = authClientAction.execute(conf = self.conf, logger = self.logger)
        
        self.logger.debug("Authentication client result: %s, Grid user name "
                          "at destination: %s" % (result, remoteGridUserDest))
        
        # inconsistent design - catching exceptions / checking result status?
        if result.status != 0:
            raise FDTCopyException("Authentication failed, reason: %s" % result.msg)


        # if no exception was raised here, first local-"receiver site"
        # authentication was successful

        # run local AuthClient - source remote site (the one which will send files)
        # set options so that AuthClient know which host:port to contact
        options = dict(host = self.hostSrc, port = authServicePortSender)        
        authClientAction = AuthClientAction(self.id, options)
        
        # execute locally AuthClient
        result, remoteGridUserSrc = authClientAction.execute(conf = self.conf, logger = self.logger)
        
        self.logger.debug("Authentication client result: %s, Grid user name "
                          "at source: %s" % (result, remoteGridUserSrc))
        
        # inconsistent design - catching exceptions / checking result status?
        if result.status != 0:
            raise FDTCopyException("Authentication failed, reason: %s" % result.msg)
        
        # if no exception was raised, authentication chain was successful
        
        # no need to perform clean up - AuthService processes are running only
        # in single instances at remote sites and taken care of by the daemon process
        
        self.logger.info("Authentication chain was successful.")
        
        return remoteGridUserSrc, remoteGridUserDest