From 926575bc811e8382100695a3396da7191fb43eb3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1s=20Touceda?= Date: Fri, 8 Mar 2013 13:15:38 -0300 Subject: Add translation support Also: - Make OpenVPN use a random port every time - Logout in parallel so the UI doesn't block - Add the WAIT status from OpenVPN to the mainwindow displays - Support non-unix sockets in the LinuxVPNLauncher --- Makefile | 4 +- data/leap_client.pro | 27 ++- data/ts/en_US.ts | 434 ++++++++++++++++++---------------- src/leap/app.py | 3 +- src/leap/config/baseconfig.py | 11 +- src/leap/crypto/srpauth.py | 34 +-- src/leap/gui/mainwindow.py | 72 +++--- src/leap/gui/ui/wizard.ui | 1 + src/leap/gui/wizard.py | 28 ++- src/leap/services/eip/vpn.py | 5 +- src/leap/services/eip/vpnlaunchers.py | 11 +- src/leap/util/leap_argparse.py | 2 +- 12 files changed, 349 insertions(+), 283 deletions(-) diff --git a/Makefile b/Makefile index 62e2fd80..9e67505f 100644 --- a/Makefile +++ b/Makefile @@ -20,11 +20,9 @@ TRANSLAT_DIR = data/translations PROJFILE = data/leap_client.pro #UI files to compile -# UI_FILES = foo.ui UI_FILES = mainwindow.ui wizard.ui #Qt resource files to compile -#images.qrc -RESOURCES = mainwindow.qrc # locale.qrc +RESOURCES = mainwindow.qrc locale.qrc #pyuic4 and pyrcc4 binaries PYUIC = pyside-uic diff --git a/data/leap_client.pro b/data/leap_client.pro index 9ec1a43b..e91497c0 100644 --- a/data/leap_client.pro +++ b/data/leap_client.pro @@ -2,7 +2,32 @@ # is not there a f*** way of expanding this? other to template with python I mean... -# SOURCES += ... +SOURCES += ../src/leap/gui/mainwindow.py \ + ../src/leap/gui/wizardpage.py \ + ../src/leap/gui/wizard.py \ + ../src/leap/config/provider_spec.py \ + ../src/leap/config/pluggableconfig.py \ + ../src/leap/config/providerconfig.py \ + ../src/leap/config/prefixers.py \ + ../src/leap/config/baseconfig.py \ + ../src/leap/app.py \ + ../src/leap/util/checkerthread.py \ + ../src/leap/util/leap_argparse.py \ + ../src/leap/util/check.py \ + ../src/leap/crypto/constants.py \ + ../src/leap/crypto/srpauth.py \ + ../src/leap/crypto/srpregister.py \ + ../src/leap/services/eip/eipbootstrapper.py \ + ../src/leap/services/eip/udstelnet.py \ + ../src/leap/services/eip/eipspec.py \ + ../src/leap/services/eip/vpn.py \ + ../src/leap/services/eip/vpnlaunchers.py \ + ../src/leap/services/eip/providerbootstrapper.py \ + ../src/leap/services/eip/eipconfig.py + +FORMS += ../src/leap/gui/ui/mainwindow.ui \ + ../src/leap/gui/ui/wizard.ui + # where to generate ts files -- tx will pick from here # original file, english diff --git a/data/ts/en_US.ts b/data/ts/en_US.ts index d2cba837..0c21d4f8 100644 --- a/data/ts/en_US.ts +++ b/data/ts/en_US.ts @@ -1,476 +1,496 @@ - ConnectionPage + MainWindow - - Connecting... + + Encryption is OFF - - Setting up a encrypted connection with the provider + + Stop - - Getting EIP configuration files + + Hide - - Authentication error: %s + + Show - - Getting EIP certificate + + About LEAP - - - EIPConductorAppMixin - - &Disconnect + + LEAP is a non-profit dedicated to giving all internet users access to secure communication. Our focus is on adapting encryption technology to make it easy to use and widely available. <a href="https://leap.se">More about LEAP</a> - - &Connect + + Could not load provider configuration - - - EIPErrors - - We could not find any authentication agent in your system.<br/>Make sure you have <b>polkit-gnome-authentication-agent-1</b> running and try again. + + Please select a valid provider - - We could not find <b>pkexec</b> in your system.<br/> Do you want to try <b>setuid workaround</b>? (<i>DOES NOTHING YET</i>) + + Please provide a valid username - - No suitable openvpn command found. <br/>(Might be a permissions problem) + + Please provide a valid Password - - there is a problem with provider certificate + + Logging in... - - an error occurred during configuratio of leap services + + Stop EIP - - Server does not allow secure connections + + EIP has stopped - - Server certificate could not be verified + + Start EIP - - We could not find your eip certs in the expected path + + Checking configuration, please wait... - - Another OpenVPN Process has been detected. Please close it before starting leap-client + + %s does not support EIP - - - Errors - - Interface not found + + Encryption is ON - - Looks like your computer is not connected to the internet + + VPN: Authenticating... - - Looks like there are problems with your internet connection + + VPN: Retrieving configuration... - - It looks like there is no internet connection. + + VPN: Connected! - - Domain cannot be found + + Signing out... - - The Encrypted Connection was lost. + + LEAP - - - IntroPage - - First run wizard + + Remember - - Sign up for a new account + + Login - - Log In with my credentials + + <b>Provider:</b> - - Now we will guide you through some configuration that is needed before you can connect for the first time.<br><br>If you ever need to modify these options again, you can find the wizard in the '<i>Settings</i>' menu from the main window.<br><br>Do you want to <b>sign up</b> for a new account, or <b>log in</b> with an already existing username?<br> + + <b>Password:</b> - - - LastPage - - Connecting to Encrypted Internet Proxy service... + + <b>User:</b> - - Click '<i>%s</i>' to end the wizard and save your settings. + + 0.0 Kb - - You are now using an encrypted connection! + + Disconnected - - - LogInPage - - Username must be in the username@provider form. + + &Session - - Resolving domain name + + Help - - Authentication error: %s + + S&ettings - - Credentials validated. + + &Sign out - - Log In + + &Quit - - User &name: + + About &LEAP - - &Password: + + &Help - - Log in + + &Wizard - - Log in with your credentials + + VPN: Waiting to start... - LogPaneMixin + Wizard - - &Connect + + Refrain from using non ASCII characters like á, ñ, æ - - Disconnected + + Passwords don't match - - - ProviderInfoPage - - Provider Information + + Password too short - - Services offered by this provider + + Password too easy - - enrollment policy + + Password equal to username - - - ProviderSetupValidationPage - - Provider setup + + Starting registration... - - Fetching CA certificate + + <font color='green'><b>User registration OK</b></font> - - Checking CA fingerprint + + Unknown error - - Validating api certificate + + Unable to load provider configuration - - Gathering configuration options for this provider + + LEAP First run - - - RegisterUserPage - - Sign Up + + Welcome - - Registration succeeded! + + This is the LEAP Client first run wizard - - Password does not match.. + + Log In with my credentials - - Password too short. + + <html><head/><body><p>Now we will guide you through some configuration that is needed before you can connect for the first time.</p><p>If you ever need to modify these options again, you can find the wizard in the <span style=" font-style:italic;">'Settings'</span> menu from the main window.</p><p>Do you want to <span style=" font-weight:600;">sign up</span> for a new account, or <span style=" font-weight:600;">log in</span> with an already existing username?</p></body></html> - - Password too obvious. + + Sign up for a new account - - Error connecting to provider (timeout) + + Provider selection - - Error Connecting to provider (connerr). + + Please enter the domain of the provider you want to user for your connection - - Error during registration (%s) + + https:// - - Could not register (bad response) + + Checking provider - - Username not available. + + Download provider information - - User &name: + + HTTPS Connection - - &Password: + + Name resolution - - Password (again): + + Check - - &Remember username and password. + + Provider Information - - Register a new user with provider <em>%s</em> + + Services offered by this provider - - - SelectProviderPage - - Enter Provider + + <b>Enrollment policy:</b> - - chec&k! + + URL - - Server certificate could not be verified. + + Name - - Certificate validation + + policy - - Could not get info from provider. + + Desc - - Could not download provider info (refused conn.). + + Provider setup + + + + + Gathering configuration options for this provider + + + + + Download CA Certificate + + + + + Check CA Certificate Fingerprint + + + + + Check API Certificate + + + + + Register new user - - &Trust this provider certificate. + + Register a new user with provider - - Do you want to <b>trust this provider certificate?</b> + + <b>User:</b> - - SHA-256 fingerprint: <i>%s</i><br> + + <b>Password:</b> - - Please enter the domain of the provider you want to use for your connection + + <b>Re-enter password:</b> - - Checking if it is a valid provider + + Register - - Checking for a secure connection + + EIP Setup - - Getting info from the provider + + Setting up Encrypted Internet + + + + + Checking EIP + + + + + Download EIP configuration + + + + + Download client certificate + + + + + Congratulations! + + + + + You have successfully configured the LEAP client. - StatusAwareTrayIconMixin + __impl - - EIP Connection Status + + Unknown user - - <b>disconnected</b> + + The server did not send the salt parameter - - Encryption ON turn &off + + The server did not send the B parameter - - &Details... + + The data sent from the server had errors - - &About + + Could not connect to the server - - About Q&t + + Wrong password - - &Quit + + Unknown error (%s) - - Encryption ON turn o&ff + + Problem getting data from server - - Encryption OFF turn &on + + Bad data from server - - connecting... + + Auth verification failed - - About + + Succeeded diff --git a/src/leap/app.py b/src/leap/app.py index fa50cd1e..743ea6ea 100644 --- a/src/leap/app.py +++ b/src/leap/app.py @@ -27,8 +27,7 @@ from PySide import QtCore, QtGui VERSION = "unknown" from leap.util import leap_argparse -# TODO: add translations -#from leap.gui import locale_rc +from leap.gui import locale_rc from leap.gui.mainwindow import MainWindow diff --git a/src/leap/config/baseconfig.py b/src/leap/config/baseconfig.py index b80fd419..b6890d09 100644 --- a/src/leap/config/baseconfig.py +++ b/src/leap/config/baseconfig.py @@ -159,10 +159,13 @@ class LocalizedKey(object): """ descriptions = self._func(instance) description_lang = "" - if lang in descriptions.keys(): - description_lang = descriptions[lang] - else: - logger.warning("Unknown language: %s" % (lang,)) + config_lang = "en" + for key in descriptions.keys(): + if lang.startswith(key): + config_lang = key + break + + description_lang = descriptions[config_lang] return description_lang def __get__(self, instance, instancetype): diff --git a/src/leap/crypto/srpauth.py b/src/leap/crypto/srpauth.py index 28e4f037..8530b7da 100644 --- a/src/leap/crypto/srpauth.py +++ b/src/leap/crypto/srpauth.py @@ -156,18 +156,18 @@ class SRPAuth(QtCore.QObject): "Status code = %r. Content: %r" % (init_session.status_code, init_session.content)) if init_session.status_code == 422: - raise SRPAuthenticationError("Unknown user") + raise SRPAuthenticationError(self.tr("Unknown user")) salt = init_session.json().get("salt", None) B = init_session.json().get("B", None) if salt is None: logger.error("No salt parameter sent") - raise SRPAuthenticationError("The server did not send the " + - "salt parameter") + raise SRPAuthenticationError(self.tr("The server did not send " + "the salt parameter")) if B is None: logger.error("No B parameter sent") - raise SRPAuthenticationError("The server did not send the " + - "B parameter") + raise SRPAuthenticationError(self.tr("The server did not send " + "the B parameter")) return salt, B @@ -194,8 +194,8 @@ class SRPAuth(QtCore.QObject): unhex_B = self._safe_unhexlify(B) except TypeError as e: logger.error("Bad data from server: %r" % (e,)) - raise SRPAuthenticationError("The data sent from the server " - "had errors") + raise SRPAuthenticationError(self.tr("The data sent from " + "the server had errors")) M = self._srp_user.process_challenge(unhex_salt, unhex_B) auth_url = "%s/%s/%s/%s" % (self._provider_config.get_api_uri(), @@ -215,20 +215,21 @@ class SRPAuth(QtCore.QObject): get_ca_cert_path()) except requests.exceptions.ConnectionError as e: logger.error("No connection made (HAMK): %r" % (e,)) - raise SRPAuthenticationError("Could not connect to the server") + raise SRPAuthenticationError(self.tr("Could not connect to " + "the server")) if auth_result.status_code == 422: logger.error("[%s] Wrong password (HAMK): [%s]" % (auth_result.status_code, auth_result.json(). get("errors", ""))) - raise SRPAuthenticationError("Wrong password") + raise SRPAuthenticationError(self.tr("Wrong password")) if auth_result.status_code not in (200,): logger.error("No valid response (HAMK): " "Status code = %s. Content = %r" % (auth_result.status_code, auth_result.content)) - raise SRPAuthenticationError("Unknown error (%s)" % + raise SRPAuthenticationError(self.tr("Unknown error (%s)") % (auth_result.status_code,)) M2 = auth_result.json().get("M2", None) @@ -237,8 +238,8 @@ class SRPAuth(QtCore.QObject): if M2 is None or self.get_uid() is None: logger.error("Something went wrong. Content = %r" % (auth_result.content,)) - raise SRPAuthenticationError("Problem getting data from" - " server") + raise SRPAuthenticationError(self.tr("Problem getting data " + "from server")) return M2 @@ -258,13 +259,14 @@ class SRPAuth(QtCore.QObject): unhex_M2 = self._safe_unhexlify(M2) except TypeError: logger.error("Bad data from server (HAWK)") - raise SRPAuthenticationError("Bad data from server") + raise SRPAuthenticationError(self.tr("Bad data from server")) self._srp_user.verify_session(unhex_M2) if not self._srp_user.authenticated(): logger.error("Auth verification failed") - raise SRPAuthenticationError("Auth verification failed") + raise SRPAuthenticationError(self.tr("Auth verification " + "failed")) logger.debug("Session verified.") self.set_session_id(self._session.cookies["_session_id"]) @@ -379,7 +381,7 @@ class SRPAuth(QtCore.QObject): self.__instance.authenticate(username, password) logger.debug("Successful login!") - self.authentication_finished.emit(True, "Succeeded") + self.authentication_finished.emit(True, self.tr("Succeeded")) return True except Exception as e: logger.error("Error logging in %s" % (e,)) @@ -393,7 +395,7 @@ class SRPAuth(QtCore.QObject): """ try: self.__instance.logout() - self.logout_finished.emit(True, "Succeeded") + self.logout_finished.emit(True, self.tr("Succeeded")) return True except Exception as e: self.logout_finished.emit(False, "%s" % (e,)) diff --git a/src/leap/gui/mainwindow.py b/src/leap/gui/mainwindow.py index df21a2bb..d66ddbb5 100644 --- a/src/leap/gui/mainwindow.py +++ b/src/leap/gui/mainwindow.py @@ -20,6 +20,7 @@ Main window for the leap client """ import os import logging +import random from PySide import QtCore, QtGui @@ -141,9 +142,10 @@ class MainWindow(QtGui.QMainWindow): self._systray = None self._vpn_systray = None - self._action_eip_status = QtGui.QAction("Encryption is OFF", self) + self._action_eip_status = QtGui.QAction(self.tr("Encryption is OFF"), + self) self._action_eip_status.setEnabled(False) - self._action_eip_stop = QtGui.QAction("Stop", self) + self._action_eip_stop = QtGui.QAction(self.tr("Stop"), self) self._action_eip_stop.triggered.connect( self._stop_eip) self._action_eip_write = QtGui.QAction( @@ -155,7 +157,7 @@ class MainWindow(QtGui.QMainWindow): "0.0 Kb", self) self._action_eip_read.setEnabled(False) - self._action_visible = QtGui.QAction("Hide", self) + self._action_visible = QtGui.QAction(self.tr("Hide"), self) self._action_visible.triggered.connect(self._toggle_visible) self._center_window() @@ -226,9 +228,9 @@ class MainWindow(QtGui.QMainWindow): Toggles the window visibility """ self.setVisible(not self.isVisible()) - action_visible_text = "Hide" + action_visible_text = self.tr("Hide") if not self.isVisible(): - action_visible_text = "Show" + action_visible_text = self.tr("Show") self._action_visible.setText(action_visible_text) def _center_window(self): @@ -257,14 +259,15 @@ class MainWindow(QtGui.QMainWindow): """ Display the About LEAP dialog """ - QtGui.QMessageBox.about(self, "About LEAP", - "LEAP is a non-profit dedicated to giving " - "all internet users access to secure " - "communication. Our focus is on adapting " - "encryption technology to make it easy to use " - "and widely available. " - "More about LEAP" - "") + QtGui.QMessageBox.about( + self, self.tr("About LEAP"), + self.tr("LEAP is a non-profit dedicated to giving " + "all internet users access to secure " + "communication. Our focus is on adapting " + "encryption technology to make it easy to use " + "and widely available. " + "More about LEAP" + "")) def quit(self): self._really_quit = True @@ -399,7 +402,8 @@ class MainWindow(QtGui.QMainWindow): self._provider_config, download_if_needed=True) else: - self._set_status("Could not load provider configuration") + self._set_status( + self.tr("Could not load provider configuration")) self._login_set_enabled(True) else: self._set_status(data[self._provider_bootstrapper.ERROR_KEY]) @@ -424,18 +428,18 @@ class MainWindow(QtGui.QMainWindow): provider = self.ui.cmbProviders.currentText() if len(provider) == 0: - self._set_status("Please select a valid provider") + self._set_status(self.tr("Please select a valid provider")) return if len(username) == 0: - self._set_status("Please provide a valid username") + self._set_status(self.tr("Please provide a valid username")) return if len(password) == 0: - self._set_status("Please provide a valid Password") + self._set_status(self.tr("Please provide a valid Password")) return - self._set_status("Logging in...") + self._set_status(self.tr("Logging in...")) self._login_set_enabled(False) self._download_provider_config() @@ -496,11 +500,11 @@ class MainWindow(QtGui.QMainWindow): def _start_eip(self): self._vpn.start(eipconfig=self._eip_config, providerconfig=self._provider_config, - socket_host="/home/chiiph/vpnsock", - socket_port="unix") + socket_host="localhost", + socket_port=str(random.randint(1000, 9999))) self._vpn_systray.setVisible(True) self.ui.btnEipStartStop.setEnabled(True) - self.ui.btnEipStartStop.setText("Stop EIP") + self.ui.btnEipStartStop.setText(self.tr("Stop EIP")) self.ui.btnEipStartStop.clicked.disconnect( self._start_eip) self.ui.btnEipStartStop.clicked.connect( @@ -509,9 +513,9 @@ class MainWindow(QtGui.QMainWindow): def _stop_eip(self): self._vpn.set_should_quit() self._vpn_systray.setVisible(False) - self._set_eip_status("EIP has stopped") + self._set_eip_status(self.tr("EIP has stopped")) self._set_eip_status_icon("error") - self.ui.btnEipStartStop.setText("Start EIP") + self.ui.btnEipStartStop.setText(self.tr("Start EIP")) self.ui.btnEipStartStop.clicked.disconnect( self._stop_eip) self.ui.btnEipStartStop.clicked.connect( @@ -524,7 +528,7 @@ class MainWindow(QtGui.QMainWindow): leap_assert(self._eip_bootstrapper, "We need an eip bootstrapper!") leap_assert(self._provider_config, "We need a provider config") - self._set_eip_status("Checking configuration, please wait...") + self._set_eip_status(self.tr("Checking configuration, please wait...")) if self._provider_config.provides_eip(): self._eip_bootstrapper.run_eip_setup_checks( @@ -532,7 +536,7 @@ class MainWindow(QtGui.QMainWindow): self._provider_config, download_if_needed=True) else: - self._set_eip_status("%s does not support EIP" % + self._set_eip_status(self.tr("%s does not support EIP") % (self._provider_config.get_domain(),)) def _set_eip_status_icon(self, status): @@ -543,11 +547,11 @@ class MainWindow(QtGui.QMainWindow): @type status: str """ selected_pixmap = self.ERROR_ICON - tray_message = "Encryption is OFF" - if status in ("AUTH", "GET_CONFIG"): + tray_message = self.tr("Encryption is OFF") + if status in ("WAIT", "AUTH", "GET_CONFIG"): selected_pixmap = self.CONNECTING_ICON elif status in ("CONNECTED"): - tray_message = "Encryption is ON" + tray_message = self.tr("Encryption is ON") selected_pixmap = self.CONNECTED_ICON self.ui.lblVPNStatusIcon.setPixmap(selected_pixmap) @@ -565,11 +569,13 @@ class MainWindow(QtGui.QMainWindow): status = data[self._vpn.STATUS_STEP_KEY] self._set_eip_status_icon(status) if status == "AUTH": - self._set_eip_status("VPN: Authenticating...") + self._set_eip_status(self.tr("VPN: Authenticating...")) elif status == "GET_CONFIG": - self._set_eip_status("VPN: Retrieving configuration...") + self._set_eip_status(self.tr("VPN: Retrieving configuration...")) elif status == "CONNECTED": - self._set_eip_status("VPN: Connected!") + self._set_eip_status(self.tr("VPN: Connected!")) + elif status == "WAIT": + self._set_eip_status(self.tr("VPN: Waiting to start...")) else: self._set_eip_status(status) @@ -621,8 +627,8 @@ class MainWindow(QtGui.QMainWindow): Starts the logout sequence """ self._set_eip_status_icon("error") - self._set_eip_status("Signing out...") - self._srp_auth.logout() + self._set_eip_status(self.tr("Signing out...")) + self._checker_thread.add_checks([self._srp_auth.logout]) def _done_logging_out(self, ok, message): """ diff --git a/src/leap/gui/ui/wizard.ui b/src/leap/gui/ui/wizard.ui index 2d9cb441..a7198c5f 100644 --- a/src/leap/gui/ui/wizard.ui +++ b/src/leap/gui/ui/wizard.ui @@ -798,6 +798,7 @@ + diff --git a/src/leap/gui/wizard.py b/src/leap/gui/wizard.py index bac74d1d..fa705645 100644 --- a/src/leap/gui/wizard.py +++ b/src/leap/gui/wizard.py @@ -21,7 +21,7 @@ First run wizard import os import logging -from PySide import QtGui +from PySide import QtCore, QtGui from functools import partial from ui_wizard import Ui_Wizard @@ -152,19 +152,20 @@ class Wizard(QtGui.QWizard): username.encode("ascii") password.encode("ascii") except: - message = u"Refrain from using non ASCII áñ characters" + message = self.tr(u"Refrain from using non " + u"ASCII characters like á, ñ, æ") if message is not None and password != password2: - message = "Passwords don't match" + message = self.tr("Passwords don't match") if message is None and len(password) < 6: - message = "Password too short" + message = self.tr("Password too short") if message is None and password in self.WEAK_PASSWORDS: - message = "Password too easy" + message = self.tr("Password too easy") if message is None and username == password: - message = "Password equal to username" + message = self.tr("Password equal to username") if message is not None: self._set_register_status(message) @@ -190,20 +191,20 @@ class Wizard(QtGui.QWizard): self._checker_thread.add_checks( [partial(register.register_user, username, password)]) self._username = username - self._set_register_status("Starting registration...") + self._set_register_status(self.tr("Starting registration...")) else: self.ui.btnRegister.setEnabled(True) def _registration_finished(self, ok, req): if ok: - self._set_register_status("" - "User registration OK") + self._set_register_status(self.tr("" + "User registration OK")) self.ui.lblPassword2.clearFocus() self.page(self.REGISTER_USER_PAGE).set_completed() self.button(QtGui.QWizard.BackButton).setEnabled(False) else: self._username = None - error_msg = "Unknown error" + error_msg = self.tr("Unknown error") try: error_msg = req.json().get("errors").get("login")[0] except: @@ -304,7 +305,7 @@ class Wizard(QtGui.QWizard): new_data = { self._provider_bootstrapper.PASSED_KEY: False, self._provider_bootstrapper.ERROR_KEY: - "Unable to load provider configuration" + self.tr("Unable to load provider configuration") } self._complete_task(new_data, self.ui.lblProviderInfo) @@ -387,13 +388,14 @@ class Wizard(QtGui.QWizard): if pageId == self.PRESENT_PROVIDER_PAGE: # TODO: get the right lang for these + lang = QtCore.QLocale.system().name() self.ui.lblProviderName.setText( "%s" % - (self._provider_config.get_name(),)) + (self._provider_config.get_name(lang=lang),)) self.ui.lblProviderURL.setText(self._provider_config.get_domain()) self.ui.lblProviderDesc.setText( "%s" % - (self._provider_config.get_description(),)) + (self._provider_config.get_description(lang=lang),)) self.ui.lblProviderPolicy.setText(self._provider_config .get_enrollment_policy()) diff --git a/src/leap/services/eip/vpn.py b/src/leap/services/eip/vpn.py index 71944f50..3ec32f6f 100644 --- a/src/leap/services/eip/vpn.py +++ b/src/leap/services/eip/vpn.py @@ -31,7 +31,6 @@ from leap.services.eip.udstelnet import UDSTelnet from leap.util.check import leap_assert, leap_assert_type logger = logging.getLogger(__name__) -ON_POSIX = 'posix' in sys.builtin_module_names # TODO: abstract the thread that can be asked to quit to another @@ -103,6 +102,7 @@ class VPN(QtCore.QThread): self._send_command("signal SIGTERM") self._tn.close() self._subp.terminate() + self._subp.waitForFinished() except Exception as e: logger.debug("Could not terminate process, trying command " + "signal SIGNINT: %r" % (e,)) @@ -309,6 +309,9 @@ class VPN(QtCore.QThread): self._parse_state_and_notify(self._send_command("state")) self._parse_status_and_notify(self._send_command("status")) output_sofar = self._subp.readAllStandardOutput() + if len(output_sofar) > 0: + logger.debug(output_sofar) + output_sofar = self._subp.readAllStandardError() if len(output_sofar) > 0: logger.debug(output_sofar) QtCore.QThread.msleep(self.POLL_TIME) diff --git a/src/leap/services/eip/vpnlaunchers.py b/src/leap/services/eip/vpnlaunchers.py index 00e9c966..cf817321 100644 --- a/src/leap/services/eip/vpnlaunchers.py +++ b/src/leap/services/eip/vpnlaunchers.py @@ -215,8 +215,15 @@ class LinuxVPNLauncher(VPNLauncher): args += [ '--user', getpass.getuser(), - '--group', grp.getgrgid(os.getgroups()[-1]).gr_name, - '--management-client-user', getpass.getuser(), + '--group', grp.getgrgid(os.getgroups()[-1]).gr_name + ] + + if socket_port == "unix": + args += [ + '--management-client-user', getpass.getuser() + ] + + args += [ '--management-signal', '--management', socket_host, socket_port, '--script-security', '2' diff --git a/src/leap/util/leap_argparse.py b/src/leap/util/leap_argparse.py index 78597f63..83272a3d 100644 --- a/src/leap/util/leap_argparse.py +++ b/src/leap/util/leap_argparse.py @@ -20,7 +20,7 @@ import argparse def build_parser(): """ - all the options for the leap arg parser + All the options for the leap arg parser Some of these could be switched on only if debug flag is present! """ epilog = "Copyright 2012 The LEAP Encryption Access Project" -- cgit v1.2.3