How to use the pydra.cluster.auth.rsa_auth.load_crypto function in pydra

To help you get started, we’ve selected a few pydra examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github kreneskyp / Pydra / pydra / cluster / node / worker_connection_manager.py View on Github external
def __init__(self):
        self._services = [self.get_worker_service]
        self._listeners = {
                    'NODE_INITIALIZED':self.enable_workers,
                    'WORKER_FINISHED':self.remove_worker
                }

        #locks
        self._lock = Lock() #general lock, use when multiple shared resources are touched

        #load rsa crypto
        self.pub_key, self.priv_key = load_crypto('%s/node.key' % \
                pydra_settings.RUNTIME_FILES_DIR)

        # setup worker security - using this checker just because we need
        # _something_ that returns an avatarID.  Its extremely vulnerable
        # but thats ok because the real authentication takes place after
        # the worker has connected
        self.worker_checker = checkers.InMemoryUsernamePasswordDatabaseDontUse()
github kreneskyp / Pydra / pydra / cluster / master / node_connection_manager.py View on Github external
#locks
        self._lock = Lock() #general lock, use when multiple shared resources are touched

        self._listeners = {
            'MANAGER_INIT':self.connect,
            'NODE_CREATED':self.connect_node,
            'NODE_UPDATED':self.connect_node,
        }

        self._interfaces = [
            self.connect
        ]

        #load rsa crypto
        self.pub_key, self.priv_key = load_crypto('%s/master.key' \
                % pydra_settings.RUNTIME_FILES_DIR)
        self.rsa_client = RSAClient(self.priv_key, self.pub_key, \
                callback=self.init_node)

        #connection management
        self.connecting = True
        self.reconnect_count = 0
        self.attempts = None
        self.reconnect_call_ID = None
        self.host = 'localhost'
github kreneskyp / Pydra / pydra / cluster / controller / amf / interface.py View on Github external
def __init__(self, manager):
        self._services = [self.get_controller_service]

        InterfaceModule.__init__(self, manager)

        #load rsa crypto
        self.pub_key, self.priv_key = load_crypto('%s/master.key' % \
                                        pydra_settings.RUNTIME_FILES_DIR)
        self.priv_key_encrypt = self.priv_key.encrypt

        # setup AMF gateway security.  This just uses a default user/pw
        # the real authentication happens after the AMF client connects
        self.checker = checkers.InMemoryUsernamePasswordDatabaseDontUse()
        self.checker.addUser("controller", "1234")

        # sessions - temporary sessions for all authenticated controllers
        self.sessions = {}
        self.session_cleanup = reactor.callLater(20, self.__clean_sessions)

        # Load crypto - The interface runs on the same server as the Master so
        # it can use the same key.  Theres no way with the AMF interface to
        # restrict access to localhost connections only.
        self.key_size=4096
github kreneskyp / Pydra / pydra / cluster / controller / amf / controller.py View on Github external
def __init__(self, master_host, master_port):
        self.master_host = master_host
        self.master_port = master_port

        # load rsa crypto
        self.pub_key, self.priv_key = load_crypto('./master.key', False)

        print '[Info] Pydra Controller Started'
        self.connect()
github kreneskyp / Pydra / pydra / cluster / worker / worker_connection_manager.py View on Github external
self._listeners = {
            'MANAGER_INIT':self.connect,
            'WORKER_FINISHED':self.disconnect
        }

        self._remotes = [
            ('MASTER', os.getpid)
        ]

        self.reconnect_count = 0
        self.factory = MasterClientFactory(self.reconnect)

        # load crypto for authentication
        # workers use the same keys as their parent Node
        self.pub_key, self.priv_key = load_crypto('%s/node.key' % \
                pydra_settings.RUNTIME_FILES_DIR)
        #self.master_pub_key = load_crypto('./node.key', False, both=False)
        self.rsa_client = RSAClient(self.priv_key)
github kreneskyp / Pydra / pydra / cluster / controller / web / interface.py View on Github external
def _register(self, manager):
        InterfaceModule._register(self, manager)
        self._services = [self.get_controller_service]
        
        #load rsa crypto
        self.pub_key, self.priv_key = load_crypto('%s/master.key' % \
                                        pydra_settings.RUNTIME_FILES_DIR)
        self.priv_key_encrypt = self.priv_key.encrypt

        # setup security.  This just uses a default user/pw
        # the real authentication happens after the AMF client connects
        self.checker = checkers.InMemoryUsernamePasswordDatabaseDontUse()
        self.checker.addUser("controller", "1234")

        # Load crypto - The interface runs on the same server as the Master so
        # it can use the same key.  Theres no way with the AMF interface to
        # restrict access to localhost connections only.
        self.key_size=4096
github kreneskyp / Pydra / pydra / cluster / controller / web / controller.py View on Github external
def __init__(self, host, port=18801, key='./master.key'):
        """
        Initialize WebController
        
        @host - host of interface
        @port - port of interface
        @key - path to key file for authentication [./master.key]
        """
        self.host = host
        self.port = port

        # load rsa crypto
        self.pub_key, self.priv_key = load_crypto(key, False)
        
        cj = cookielib.CookieJar()
        self.opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cj))
github kreneskyp / Pydra / pydra / cluster / node / master_connection_manager.py View on Github external
def _register(self, manager):
        Module._register(self, manager)        
        self.port = pydra_settings.PORT
        self.node_key = None
        #load crypto keys for authentication
        self.pub_key, self.priv_key = load_crypto('%s/node.key' % \
                pydra_settings.RUNTIME_FILES_DIR)
        self.master_pub_key = load_crypto('%s/node.master.key' % \
                pydra_settings.RUNTIME_FILES_DIR, create=False, both=False)
        self.master = None
github kreneskyp / Pydra / pydra / cluster / node / master_connection_manager.py View on Github external
def _register(self, manager):
        Module._register(self, manager)        
        self.port = pydra_settings.PORT
        self.node_key = None
        #load crypto keys for authentication
        self.pub_key, self.priv_key = load_crypto('%s/node.key' % \
                pydra_settings.RUNTIME_FILES_DIR)
        self.master_pub_key = load_crypto('%s/node.master.key' % \
                pydra_settings.RUNTIME_FILES_DIR, create=False, both=False)
        self.master = None
github kreneskyp / Pydra / pydra / cluster / master / worker_connection_manager.py View on Github external
def __init__(self):
        self._services = [self.get_worker_service]
        
        #locks
        self._lock = Lock() #general lock, use when multiple shared resources are touched

        #load rsa crypto
        self.pub_key, self.priv_key = load_crypto('%s/master.key' % pydra_settings.RUNTIME_FILES_DIR)