Bases: object
Several checks needed to ensure a EIPConnection can be sucessfully established. use run_all to run all checks.
checks if default eipconfig exists, and dumps a default file if not
raises EIPMissingDefaultProvider if no default provider found on eip config. This is catched by ui and runs FirstRunWizard (MVS+)
fetches a definition file from server
gets api domain
runs all checks in a row. will raise if some error encountered. catching those exceptions is not our responsibility at this moment
sets api domain from defaultprovider config object
Bases: object
Several checks needed for getting client certs and checking tls connection with provider.
compares the fingerprint in the ca cert with a string we are passed returns True if they are equal, False if not. @param hash_type: digest function @type hash_type: str @param fingerprint: the fingerprint to compare with. @type fingerprint: str (with : separator) @rtype bool
checks that the passed string is a valid pem certificate @param cert_s: string containing pem content @type cert_s: string @rtype: bool
Checks on certificates. To be moved to base. docs TBD
It is used from the eip conductor (a instance of EIPConnection that is managed from the QtApp), running run_all method before trying to call connect or any other of the state-changing methods.
It checks that the needed files are provided or can be discovered over the net. Much of these tests are not specific to EIP module, and can be splitted into base.tests to be invoked by the base leap init routines. However, I’m testing them alltogether for the sake of having the whole unit reachable and testable as a whole.
Bases: leap.base.config.JSONLeapConfig
alias of EIPConfigSpec
Bases: leap.base.config.JSONLeapConfig
alias of EIPServiceConfigSpec
build a string with the complete openvpn invocation
@rtype [string, [list of strings]] @rparam: a list containing the command string
and a list of options.
build a list of options to be passed in the openvpn invocation @rtype: list @rparam: options
performs an existance and permission check over the openvpn keys file. Currently we’re expecting a single file per provider, containing the CA cert, the provider key, and our client certificate
gathers optional cipher options from eip-service config. :param eipserviceconfig: EIPServiceConfig instance
return the first host in eip service config that matches the name defined in the eip.json config file.
checks the existence of the up/down scripts
EIP Connection Class
Bases: leap.eip.openvpnconnection.OpenVPNConnection, leap.eip.eipconnection.StatusMixIn
Aka conductor. Manages the execution of the OpenVPN process, auto starts, monitors the network connection, handles configuration, fixes leaky hosts, handles errors, etc. Status updates (connected, bandwidth, etc) are signaled to the GUI.
entry point for connection process
disconnects client
initialize checkers
run all eip checks previous to attempting a connection
sets the provider domain. used from the first run wizard when we launch the run_checks and connect process after having initialized the conductor.
Bases: object
Keep track of client (gui) and openvpn states.
These are the OpenVPN states: CONNECTING – OpenVPN’s initial state. WAIT – (Client only) Waiting for initial response
from server.
AUTH – (Client only) Authenticating with server. GET_CONFIG – (Client only) Downloading configuration options
from server.
ADD_ROUTES – Adding routes to system. CONNECTED – Initialization Sequence Completed. RECONNECTING – A restart has occurred. EXITING – A graceful exit is in progress.
We add some extra states:
DISCONNECTED – GUI initial state. UNRECOVERABLE – An unrecoverable error has been raised
while invoking openvpn service.
Parameters: | to (int) – destination state |
---|
returns the high level icon for each fine-grain openvpn state
setter for the ‘current’ property :param to: destination state :type to: int
accepts a state string from the management interface, and sets the internal state. :param status: openvpn STATE (uppercase). :type status: str
Bases: object
returns the current connection state
get icon name from status object
capture error and wrap it in an understandable format
Sends OpenVPN command: state
OpenVPN command: status
OpenVPN command: last 2 statuses
Generic error hierarchy Leap/EIP exceptions used for exception handling, logging, and notifying user of errors during leap operation.
All EIP Errors must inherit from EIPClientError (note: move that to a more generic LEAPClientBaseError).
after attempting any cleaning action.
the error queue.
message: the message that will be used in the __repr__ of the exception.
in Qt-land.
TODO:
Bases: exceptions.Exception
Bases: leap.eip.exceptions.EIPClientError
we cannot do anything about it, sorry
Bases: leap.eip.exceptions.Warning
Bases: exceptions.Exception
base EIPClient exception
Bases: leap.eip.exceptions.Warning
Bases: leap.eip.exceptions.CriticalError
Bases: exceptions.Exception
Bases: leap.eip.exceptions.EIPClientError
Bases: leap.eip.exceptions.Warning
Bases: leap.eip.exceptions.CriticalError
Bases: leap.base.exceptions.LeapException
Bases: leap.base.exceptions.LeapException
Bases: leap.eip.exceptions.Warning
Bases: exceptions.Exception
Bases: leap.eip.exceptions.CriticalError
Bases: leap.eip.exceptions.EIPClientError
just that, warnings
OpenVPN Connection
Bases: leap.base.connection.Connection, leap.eip.openvpnconnection.OpenVPNManagement
All related to invocation of the openvpn binary. It’s extended by EIPConnection.
Returns True if connected rtype: bool
runs check needed before launching openvpn subprocess. will raise if errors found.
terminates openvpn child subprocess
attempts to connect
Bases: telnetlib.Telnet
a telnet-alike class, that can listen on unix domain sockets
Connect to a host. If port is ‘unix’, it will open a connection over unix docmain sockets.
The optional second argument is the port number, which defaults to the standard telnet port (23).
Don’t try to reopen an already connected instance.