summaryrefslogtreecommitdiff
path: root/src/leap/services/eip
diff options
context:
space:
mode:
Diffstat (limited to 'src/leap/services/eip')
-rw-r--r--src/leap/services/eip/eipbootstrapper.py12
-rw-r--r--src/leap/services/eip/providerbootstrapper.py59
-rw-r--r--src/leap/services/eip/udstelnet.py1
-rw-r--r--src/leap/services/eip/vpn.py52
-rw-r--r--src/leap/services/eip/vpnlaunchers.py114
5 files changed, 121 insertions, 117 deletions
diff --git a/src/leap/services/eip/eipbootstrapper.py b/src/leap/services/eip/eipbootstrapper.py
index 19b74856..af13ab8c 100644
--- a/src/leap/services/eip/eipbootstrapper.py
+++ b/src/leap/services/eip/eipbootstrapper.py
@@ -73,8 +73,8 @@ class EIPBootstrapper(QtCore.QObject):
"""
Downloads the EIP config for the given provider
- @return: True if the checks passed, False otherwise
- @rtype: bool
+ :return: True if the checks passed, False otherwise
+ :rtype: bool
"""
leap_assert(self._provider_config,
@@ -137,8 +137,8 @@ class EIPBootstrapper(QtCore.QObject):
"""
Downloads the EIP client certificate for the given provider
- @return: True if the checks passed, False otherwise
- @rtype: bool
+ :return: True if the checks passed, False otherwise
+ :rtype: bool
"""
leap_assert(self._provider_config, "We need a provider configuration!")
leap_assert(self._eip_config, "We need an eip configuration!")
@@ -216,8 +216,8 @@ class EIPBootstrapper(QtCore.QObject):
"""
Starts the checks needed for a new eip setup
- @param provider_config: Provider configuration
- @type provider_config: ProviderConfig
+ :param provider_config: Provider configuration
+ :type provider_config: ProviderConfig
"""
leap_assert(provider_config, "We need a provider config!")
leap_assert_type(provider_config, ProviderConfig)
diff --git a/src/leap/services/eip/providerbootstrapper.py b/src/leap/services/eip/providerbootstrapper.py
index f5559143..734d3867 100644
--- a/src/leap/services/eip/providerbootstrapper.py
+++ b/src/leap/services/eip/providerbootstrapper.py
@@ -62,9 +62,9 @@ class ProviderBootstrapper(QtCore.QObject):
"""
Constructor for provider bootstrapper object
- @param bypass_checks: Set to true if the app should bypass
+ :param bypass_checks: Set to true if the app should bypass
first round of checks for CA certificates at bootstrap
- @type bypass_checks: bool
+ :type bypass_checks: bool
"""
QtCore.QObject.__init__(self)
@@ -84,8 +84,8 @@ class ProviderBootstrapper(QtCore.QObject):
"""
Checks that the name resolution for the provider name works
- @return: True if the checks passed, False otherwise
- @rtype: bool
+ :return: True if the checks passed, False otherwise
+ :rtype: bool
"""
leap_assert(self._domain, "Cannot check DNS without a domain")
@@ -115,8 +115,8 @@ class ProviderBootstrapper(QtCore.QObject):
Checks that https is working and that the provided certificate
checks out
- @return: True if the checks passed, False otherwise
- @rtype: bool
+ :return: True if the checks passed, False otherwise
+ :rtype: bool
"""
leap_assert(self._domain, "Cannot check HTTPS without a domain")
@@ -154,8 +154,8 @@ class ProviderBootstrapper(QtCore.QObject):
"""
Downloads the provider.json defition
- @return: True if the checks passed, False otherwise
- @rtype: bool
+ :return: True if the checks passed, False otherwise
+ :rtype: bool
"""
leap_assert(self._domain,
"Cannot download provider info without a domain")
@@ -211,16 +211,15 @@ class ProviderBootstrapper(QtCore.QObject):
"""
Populates the check queue
- @param checker: checker thread to be used to run this check
- @type checker: CheckerThread
- @param domain: domain to check
- @type domain: str
- @param download_if_needed: if True, makes the checks do not
- overwrite already downloaded data
- @type download_if_needed: bool
+ :param checker: checker thread to be used to run this check
+ :type checker: CheckerThread
+ :param domain: domain to check
+ :type domain: str
+ :param download_if_needed: if True, makes the checks do not overwrite already downloaded data
+ :type download_if_needed: bool
- @return: True if the checks passed, False otherwise
- @rtype: bool
+ :return: True if the checks passed, False otherwise
+ :rtype: bool
"""
leap_assert(domain and len(domain) > 0, "We need a domain!")
@@ -238,7 +237,7 @@ class ProviderBootstrapper(QtCore.QObject):
Returns False if the certificate already exists for the given
provider. True otherwise
- @rtype: bool
+ :rtype: bool
"""
leap_assert(self._provider_config, "We need a provider config!")
@@ -252,8 +251,8 @@ class ProviderBootstrapper(QtCore.QObject):
"""
Downloads the CA cert that is going to be used for the api URL
- @return: True if the checks passed, False otherwise
- @rtype: bool
+ :return: True if the checks passed, False otherwise
+ :rtype: bool
"""
leap_assert(self._provider_config, "Cannot download the ca cert "
@@ -310,8 +309,8 @@ class ProviderBootstrapper(QtCore.QObject):
Checks the CA cert fingerprint against the one provided in the
json definition
- @return: True if the checks passed, False otherwise
- @rtype: bool
+ :return: True if the checks passed, False otherwise
+ :rtype: bool
"""
leap_assert(self._provider_config, "Cannot check the ca cert "
"without a provider config!")
@@ -362,8 +361,8 @@ class ProviderBootstrapper(QtCore.QObject):
Tries to make an API call with the downloaded cert and checks
if it validates against it
- @return: True if the checks passed, False otherwise
- @rtype: bool
+ :return: True if the checks passed, False otherwise
+ :rtype: bool
"""
leap_assert(self._provider_config, "Cannot check the ca cert "
"without a provider config!")
@@ -403,13 +402,13 @@ class ProviderBootstrapper(QtCore.QObject):
provider_config,
download_if_needed=False):
"""
- Starts the checks needed for a new provider setup
+ Starts the checks needed for a new provider setup.
- @param provider_config: Provider configuration
- @type provider_config: ProviderConfig
- @param download_if_needed: if True, makes the checks do not
- overwrite already downloaded data
- @type download_if_needed: bool
+ :param provider_config: Provider configuration
+ :type provider_config: ProviderConfig
+
+ :param download_if_needed: if True, makes the checks do not overwrite already downloaded data.
+ :type download_if_needed: bool
"""
leap_assert(provider_config, "We need a provider config!")
leap_assert_type(provider_config, ProviderConfig)
diff --git a/src/leap/services/eip/udstelnet.py b/src/leap/services/eip/udstelnet.py
index a47c24f4..e6c82350 100644
--- a/src/leap/services/eip/udstelnet.py
+++ b/src/leap/services/eip/udstelnet.py
@@ -40,7 +40,6 @@ class UDSTelnet(telnetlib.Telnet):
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.
"""
self.eof = 0
diff --git a/src/leap/services/eip/vpn.py b/src/leap/services/eip/vpn.py
index 9d838609..af1febe6 100644
--- a/src/leap/services/eip/vpn.py
+++ b/src/leap/services/eip/vpn.py
@@ -85,8 +85,8 @@ class VPN(QtCore.QThread):
"""
Returns wether this thread should quit
- @rtype: bool
- @return: True if the thread should terminate itself, Flase otherwise
+ :rtype: bool
+ :return: True if the thread should terminate itself, Flase otherwise
"""
QtCore.QMutexLocker(self._should_quit_lock)
return self._should_quit
@@ -117,15 +117,15 @@ class VPN(QtCore.QThread):
"""
Launches OpenVPN and starts the thread to watch its output
- @param eipconfig: eip configuration object
- @type eipconfig: EIPConfig
- @param providerconfig: provider specific configuration
- @type providerconfig: ProviderConfig
- @param socket_host: either socket path (unix) or socket IP
- @type socket_host: str
- @param socket_port: either string "unix" if it's a unix
+ :param eipconfig: eip configuration object
+ :type eipconfig: EIPConfig
+ :param providerconfig: provider specific configuration
+ :type providerconfig: ProviderConfig
+ :param socket_host: either socket path (unix) or socket IP
+ :type socket_host: str
+ :param socket_port: either string "unix" if it's a unix
socket, or port otherwise
- @type socket_port: str
+ :type socket_port: str
"""
leap_assert(eipconfig, "We need an eip config")
leap_assert_type(eipconfig, EIPConfig)
@@ -196,7 +196,7 @@ class VPN(QtCore.QThread):
"""
Looks for openvpn instances running
- @rtype: process
+ :rtype: process
"""
openvpn_process = None
for p in psutil.process_iter():
@@ -217,7 +217,7 @@ class VPN(QtCore.QThread):
"""
Checks if VPN is already running and tries to stop it
- @return: True if stopped, False otherwise
+ :return: True if stopped, False otherwise
"""
process = self._get_openvpn_process()
@@ -253,11 +253,11 @@ class VPN(QtCore.QThread):
def _connect(self, socket_host, socket_port):
"""
Connects to the specified socket_host socket_port
- @param socket_host: either socket path (unix) or socket IP
- @type socket_host: str
- @param socket_port: either string "unix" if it's a unix
+ :param socket_host: either socket path (unix) or socket IP
+ :type socket_host: str
+ :param socket_port: either string "unix" if it's a unix
socket, or port otherwise
- @type socket_port: str
+ :type socket_port: str
"""
try:
self._tn = UDSTelnet(socket_host, socket_port)
@@ -291,12 +291,12 @@ class VPN(QtCore.QThread):
Sends a command to the telnet connection and reads until END
is reached
- @param command: command to send
- @type command: str
- @param until: byte delimiter string for reading command output
- @type until: byte str
- @return: response read
- @rtype: list
+ :param command: command to send
+ :type command: str
+ :param until: byte delimiter string for reading command output
+ :type until: byte str
+ :return: response read
+ :rtype: list
"""
leap_assert(self._tn, "We need a tn connection!")
try:
@@ -315,9 +315,9 @@ class VPN(QtCore.QThread):
Parses the output of the state command and emits state_changed
signal when the state changes
- @param output: list of lines that the state command printed as
+ :param output: list of lines that the state command printed as
its output
- @type output: list
+ :type output: list
"""
for line in output:
stripped = line.strip()
@@ -345,9 +345,9 @@ class VPN(QtCore.QThread):
Parses the output of the status command and emits
status_changed signal when the status changes
- @param output: list of lines that the status command printed
+ :param output: list of lines that the status command printed
as its output
- @type output: list
+ :type output: list
"""
tun_tap_read = ""
tun_tap_write = ""
diff --git a/src/leap/services/eip/vpnlaunchers.py b/src/leap/services/eip/vpnlaunchers.py
index 3d36736d..540bc45e 100644
--- a/src/leap/services/eip/vpnlaunchers.py
+++ b/src/leap/services/eip/vpnlaunchers.py
@@ -67,18 +67,18 @@ class VPNLauncher:
"""
Returns the platform dependant vpn launching command
- @param eipconfig: eip configuration object
- @type eipconfig: EIPConfig
- @param providerconfig: provider specific configuration
- @type providerconfig: ProviderConfig
- @param socket_host: either socket path (unix) or socket IP
- @type socket_host: str
- @param socket_port: either string "unix" if it's a unix
+ :param eipconfig: eip configuration object
+ :type eipconfig: EIPConfig
+ :param providerconfig: provider specific configuration
+ :type providerconfig: ProviderConfig
+ :param socket_host: either socket path (unix) or socket IP
+ :type socket_host: str
+ :param socket_port: either string "unix" if it's a unix
socket, or port otherwise
- @type socket_port: str
+ :type socket_port: str
- @return: A VPN command ready to be launched
- @rtype: list
+ :return: A VPN command ready to be launched
+ :rtype: list
"""
return []
@@ -89,10 +89,10 @@ class VPNLauncher:
This is mainly used for setting LD_LIBRARY_PATH to the correct
path when distributing a standalone client
- @param providerconfig: provider specific configuration
- @type providerconfig: ProviderConfig
+ :param providerconfig: provider specific configuration
+ :type providerconfig: ProviderConfig
- @rtype: dict
+ :rtype: dict
"""
return {}
@@ -148,18 +148,21 @@ class LinuxVPNLauncher(VPNLauncher):
Might raise VPNException.
- @param eipconfig: eip configuration object
- @type eipconfig: EIPConfig
- @param providerconfig: provider specific configuration
- @type providerconfig: ProviderConfig
- @param socket_host: either socket path (unix) or socket IP
- @type socket_host: str
- @param socket_port: either string "unix" if it's a unix
- socket, or port otherwise
- @type socket_port: str
+ :param eipconfig: eip configuration object
+ :type eipconfig: EIPConfig
+
+ :param providerconfig: provider specific configuration
+ :type providerconfig: ProviderConfig
+
+ :param socket_host: either socket path (unix) or socket IP
+ :type socket_host: str
+
+ :param socket_port: either string "unix" if it's a unix
+ socket, or port otherwise
+ :type socket_port: str
- @return: A VPN command ready to be launched
- @rtype: list
+ :return: A VPN command ready to be launched
+ :rtype: list
"""
leap_assert(eipconfig, "We need an eip config")
leap_assert_type(eipconfig, EIPConfig)
@@ -263,10 +266,10 @@ class LinuxVPNLauncher(VPNLauncher):
This is mainly used for setting LD_LIBRARY_PATH to the correct
path when distributing a standalone client
- @param providerconfig: provider specific configuration
- @type providerconfig: ProviderConfig
+ :param providerconfig: provider specific configuration
+ :type providerconfig: ProviderConfig
- @rtype: dict
+ :rtype: dict
"""
leap_assert(providerconfig, "We need a provider config")
leap_assert_type(providerconfig, ProviderConfig)
@@ -300,18 +303,21 @@ class DarwinVPNLauncher(VPNLauncher):
Might raise VPNException.
- @param eipconfig: eip configuration object
- @type eipconfig: EIPConfig
- @param providerconfig: provider specific configuration
- @type providerconfig: ProviderConfig
- @param socket_host: either socket path (unix) or socket IP
- @type socket_host: str
- @param socket_port: either string "unix" if it's a unix
- socket, or port otherwise
- @type socket_port: str
+ :param eipconfig: eip configuration object
+ :type eipconfig: EIPConfig
+
+ :param providerconfig: provider specific configuration
+ :type providerconfig: ProviderConfig
+
+ :param socket_host: either socket path (unix) or socket IP
+ :type socket_host: str
+
+ :param socket_port: either string "unix" if it's a unix
+ socket, or port otherwise
+ :type socket_port: str
- @return: A VPN command ready to be launched
- @rtype: list
+ :return: A VPN command ready to be launched
+ :rtype: list
"""
leap_assert(eipconfig, "We need an eip config")
leap_assert_type(eipconfig, EIPConfig)
@@ -405,10 +411,10 @@ class DarwinVPNLauncher(VPNLauncher):
This is mainly used for setting LD_LIBRARY_PATH to the correct
path when distributing a standalone client
- @param providerconfig: provider specific configuration
- @type providerconfig: ProviderConfig
+ :param providerconfig: provider specific configuration
+ :type providerconfig: ProviderConfig
- @rtype: dict
+ :rtype: dict
"""
return {"DYLD_LIBRARY_PATH": os.path.join(
providerconfig.get_path_prefix(),
@@ -431,18 +437,18 @@ class WindowsVPNLauncher(VPNLauncher):
Might raise VPNException.
- @param eipconfig: eip configuration object
- @type eipconfig: EIPConfig
- @param providerconfig: provider specific configuration
- @type providerconfig: ProviderConfig
- @param socket_host: either socket path (unix) or socket IP
- @type socket_host: str
- @param socket_port: either string "unix" if it's a unix
+ :param eipconfig: eip configuration object
+ :type eipconfig: EIPConfig
+ :param providerconfig: provider specific configuration
+ :type providerconfig: ProviderConfig
+ :param socket_host: either socket path (unix) or socket IP
+ :type socket_host: str
+ :param socket_port: either string "unix" if it's a unix
socket, or port otherwise
- @type socket_port: str
+ :type socket_port: str
- @return: A VPN command ready to be launched
- @rtype: list
+ :return: A VPN command ready to be launched
+ :rtype: list
"""
leap_assert(eipconfig, "We need an eip config")
leap_assert_type(eipconfig, EIPConfig)
@@ -514,10 +520,10 @@ class WindowsVPNLauncher(VPNLauncher):
This is mainly used for setting LD_LIBRARY_PATH to the correct
path when distributing a standalone client
- @param providerconfig: provider specific configuration
- @type providerconfig: ProviderConfig
+ :param providerconfig: provider specific configuration
+ :type providerconfig: ProviderConfig
- @rtype: dict
+ :rtype: dict
"""
return {}