mcvirt.rpc package

Submodules

mcvirt.rpc.certificate_generator module

Provides class to generate and manage SSL certificates

class mcvirt.rpc.certificate_generator.CertificateGenerator(server=None, remote=False)[source]

Bases: mcvirt.rpc.pyro_object.PyroObject

Class for providing SSL socket wrappers for Pyro. Since the MCVirt isn’t available for 2/3 of the time that this is used (NS and CLI), all methods are static and paths are calculated manually. @TODO Fix this in future - create MCVirt config class.

OPENSSL = '/usr/bin/openssl'
add_public_key(key)[source]

Add the public key for a remote node

ca_key_file

Return/generate the CA prviate key.

ca_pub_file

Return/generate the CA pub file

check_certificates(check_client=True)[source]

Ensure that the required certificates are available to start the daemon and connect to the local host

client_csr

Return the client CSR

client_key_file

Obtain the private key for the client key

client_pub_file

Return/generate the client public file, used for connecting to the libvirt daemon

generate_csr()[source]

Generate a certificate request for the remote server

get_ca_contents()[source]

Return the contents of the local CA certificate

is_local

Determine if the server is the local machine

remote_ssl_directory

Return the ‘remote’ subdirectory of server, used for storing certificates that are used by a remote server.

remove_certificates()[source]

Remove a certificate directory for a node

server_key_file

Obtain the server private key file

server_pub_file

Obtain the server public key file

sign_csr(csr)[source]

Sign the CSR for a remote SSL certificate.

ssl_base_directory

Return the base SSL directory for the node.

ssl_directory

Return the SSL directory for the server

ssl_dn

“Return the certificate DN is openssl argument format.

ssl_subj

Return the SSL DN in regular format

mcvirt.rpc.certificate_generator_factory module

Provides an interface to obtain certificate generator objects

class mcvirt.rpc.certificate_generator_factory.CertificateGeneratorFactory[source]

Bases: mcvirt.rpc.pyro_object.PyroObject

Provides an interface to obtain certificate generator objects

get_cert_generator(server, remote=False)[source]

Obtain a certificate generator object for a given server

mcvirt.rpc.constants module

Provides constants for the RPC daemon

class mcvirt.rpc.constants.Annotations[source]

Bases: object

Pyro annotation names @TODO Move to main MCVIrt constants class

CLUSTER_MASTER = 'CLMA'
HAS_LOCK = 'HASL'
IGNORE_CLUSTER = 'IGCL'
IGNORE_Drbd = 'IGDR'
PASSWORD = 'PASS'
PROXY_USER = 'ALTU'
SESSION_ID = 'SEID'
USERNAME = 'USER'

mcvirt.rpc.daemon_lock module

Provides a locking mechanism for the MCVirt daemon

class mcvirt.rpc.daemon_lock.DaemonLock(timeout=2)[source]

Bases: object

Provides a lock for the MCVirt daemon

LOCK = None

mcvirt.rpc.lock module

Provides classes for locking the MCVirt daemon whilst a function is being performed

class mcvirt.rpc.lock.MethodLock[source]

Bases: object

Class for storing/generating/obtaining a lock object

classmethod get_lock()[source]

Obtain the lock object and return

mcvirt.rpc.lock.locking_method(object_type=None, instance_method=True)[source]

Provide a decorator method for locking the node whilst performing the method

mcvirt.rpc.name_server module

Thread for running the name server

class mcvirt.rpc.name_server.NameServer[source]

Bases: object

Thread for running the name server

start()[source]

Start the Pyro name server

mcvirt.rpc.pyro_object module

Base class for providing Pyro-based methods for objects

class mcvirt.rpc.pyro_object.PyroObject[source]

Bases: object

Base class for providing Pyro-based methods for objects

mcvirt.rpc.rpc_daemon module

Provide class for RPC daemon.

class mcvirt.rpc.rpc_daemon.BaseRpcDaemon(*args, **kwargs)[source]

Bases: Pyro4.core.Daemon

Override Pyro daemon to add authentication checks and MCVirt integration

validateHandshake(conn, data)[source]

Perform authentication on new connections

class mcvirt.rpc.rpc_daemon.DaemonSession[source]

Bases: object

Class for allowing client to obtain the session ID

get_session_id()[source]

Return the client’s current session ID

class mcvirt.rpc.rpc_daemon.RpcNSMixinDaemon[source]

Bases: object

Wrapper for the daemon. Required since the Pyro daemon class overrides get/setattr and other built-in object methods

DAEMON = None
obtain_connection()[source]

Attempt to obtain a connection to the name server.

register(obj_or_class, objectId, *args, **kwargs)[source]

Override register to register object with NS.

register_factories()[source]

Register base MCVirt factories with RPC daemon

shutdown(signum, frame)[source]

Shutdown Pyro Daemon

start(*args, **kwargs)[source]

Start the Pyro daemon

mcvirt.rpc.ssl_socket module

Provides methods for wrapping Pyro methods with SSL

class mcvirt.rpc.ssl_socket.SSLSocket[source]

Bases: object

Provides methods for wrapping Pyro methods with SSL

static create_broadcast_ssl_socket(*args, **kwargs)[source]

Override the Pyro createBroadcastSocket method and wrap with SSL

static create_ssl_socket(*args, **kwargs)[source]

Override the Pyro createSocket method and wrap with SSL

static wrap_socket(socket_object, *args, **kwargs)[source]

Wrap a Pyro socket connection with SSL

Module contents