Exemplo n.º 1
0
 def renewServerContext( self ):
   BaseTransport.renewServerContext( self )
   result = gSocketInfoFactory.renewServerContext( self.oSocketInfo )
   if not result[ 'OK' ]:
     return result
   self.oSocketInfo = result[ 'Value' ]
   self.oSocket = self.oSocketInfo.getSSLSocket()
   return S_OK()
Exemplo n.º 2
0
 def renewServerContext(self):
     BaseTransport.renewServerContext(self)
     result = gSocketInfoFactory.renewServerContext(self.oSocketInfo)
     if not result['OK']:
         return result
     self.oSocketInfo = result['Value']
     self.oSocket = self.oSocketInfo.getSSLSocket()
     return S_OK()
Exemplo n.º 3
0
    def __init__(self, *args, **kwargs):
        """ Create an SSLTransport object, parameters are the same
        as for other transports. If ctx is specified (as an instance of
        SSL.Context) then use that rather than creating a new context.

        kwargs can contain all the parameters defined in BaseClient,
        in particular timeout
    """
        # The thread init of M2Crypto is not really thread safe.
        # So we put it a second time
        M2Threading.init()
        self.remoteAddress = None
        self.peerCredentials = {}

        # The timeout used here is different from what it was in pyGSI.
        # It is to be understood here as the timeout for socket operations
        # involved in the RPC call, but NOT the establishment of the connection,
        # for which there is a different timeout.
        #
        # The timeout management of pyGSI was a bit off.
        # This is proven by that type of trace (look at the timestamp):
        #
        # 2020-07-16 09:48:55 UTC dirac-proxy-init [140013698656064] DEBUG: Connection timeout set to:  1
        # 2020-07-16 09:58:55 UTC dirac-proxy-init [140013698656064] WARN: Issue getting socket:
        #

        self.__timeout = kwargs.get(SSLTransport.KW_TIMEOUT,
                                    DEFAULT_RPC_TIMEOUT)

        self.__locked = False  # We don't support locking, so this is always false.

        # If not specified in the arguments (never is in DIRAC code...)
        # and we are setting up a server listing connection, set the accepted
        # ssl methods and ciphers
        if kwargs.get('bServerMode'):
            if 'sslMethods' not in kwargs:
                kwargs['sslMethods'] = os.environ.get(
                    'DIRAC_M2CRYPTO_SSL_METHODS')
            if 'sslCiphers' not in kwargs:
                kwargs['sslCiphers'] = os.environ.get(
                    'DIRAC_M2CRYPTO_SSL_CIPHERS')

        self.__ctx = kwargs.pop('ctx', None)
        if not self.__ctx:
            self.__ctx = getM2SSLContext(**kwargs)

        # Note that kwargs is already kept in BaseTransport
        # as self.extraArgsDict, but at least I am sure that
        # self.__kwargs will never be modified
        self.__kwargs = kwargs

        BaseTransport.__init__(self, *args, **kwargs)
Exemplo n.º 4
0
    def __init__(self, *args, **kwargs):
        """ Create an SSLTransport object, parameters are the same
        as for other transports. If ctx is specified (as an instance of
        SSL.Context) then use that rather than creating a new context.
    """
        self.remoteAddress = None
        self.peerCredentials = {}
        self.__timeout = 1
        self.__locked = False  # We don't support locking, so this is always false.

        self.__ctx = kwargs.pop('ctx', None)
        if not self.__ctx:
            self.__ctx = getM2SSLContext(**kwargs)

        self.__kwargs = kwargs
        BaseTransport.__init__(self, *args, **kwargs)
Exemplo n.º 5
0
 def __init__( self, *args, **kwargs ):
   self.__writesDone = 0
   self.__locked = False
   BaseTransport.__init__( self, *args, **kwargs )
Exemplo n.º 6
0
 def __init__(self, *args, **kwargs):
     self.__writesDone = 0
     self.__locked = False
     BaseTransport.__init__(self, *args, **kwargs)