summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/leap/bitmask/__init__.py6
-rw-r--r--src/leap/bitmask/gui/__init__.py6
-rw-r--r--src/leap/bitmask/gui/wizard.py69
-rw-r--r--src/leap/bitmask/platform_init/initializers.py44
-rw-r--r--src/leap/bitmask/provider/pinned.py10
-rw-r--r--src/leap/bitmask/services/eip/linuxvpnlauncher.py7
6 files changed, 74 insertions, 68 deletions
diff --git a/src/leap/bitmask/__init__.py b/src/leap/bitmask/__init__.py
index 0f733f26..03da1e2f 100644
--- a/src/leap/bitmask/__init__.py
+++ b/src/leap/bitmask/__init__.py
@@ -25,6 +25,12 @@ from pkg_resources import parse_version
from leap.bitmask.util import first
+# HACK: This is a hack so that py2app copies _scrypt.so to the right
+# place, it can't be technically imported, but that doesn't matter
+# because the import is never executed
+if False:
+ import _scrypt
+
def _is_release_version(version):
"""
diff --git a/src/leap/bitmask/gui/__init__.py b/src/leap/bitmask/gui/__init__.py
index 4b289442..94bf1fd5 100644
--- a/src/leap/bitmask/gui/__init__.py
+++ b/src/leap/bitmask/gui/__init__.py
@@ -17,5 +17,7 @@
"""
init file for leap.gui
"""
-app = __import__("app", globals(), locals(), [], 2)
-__all__ = [app]
+# This was added for coverage and testing, but when doing the osx
+# bundle with py2app it fails because of this, so commenting for now
+# app = __import__("app", globals(), locals(), [], 2)
+# __all__ = [app]
diff --git a/src/leap/bitmask/gui/wizard.py b/src/leap/bitmask/gui/wizard.py
index f66c553d..4f67958f 100644
--- a/src/leap/bitmask/gui/wizard.py
+++ b/src/leap/bitmask/gui/wizard.py
@@ -83,7 +83,8 @@ class Wizard(QtGui.QWizard):
self.ui.grpCheckProvider.setVisible(False)
self._connect_and_track(self.ui.btnCheck.clicked, self._check_provider)
- self._connect_and_track(self.ui.lnProvider.returnPressed, self._check_provider)
+ self._connect_and_track(self.ui.lnProvider.returnPressed,
+ self._check_provider)
self._backend = backend
self._backend_connect()
@@ -98,22 +99,24 @@ class Wizard(QtGui.QWizard):
self._provider_select_defer = None
self._provider_setup_defer = None
- self._connect_and_track(self.currentIdChanged, self._current_id_changed)
+ self._connect_and_track(self.currentIdChanged,
+ self._current_id_changed)
- self._connect_and_track(self.ui.lnProvider.textChanged, self._enable_check)
+ self._connect_and_track(self.ui.lnProvider.textChanged,
+ self._enable_check)
self._connect_and_track(self.ui.rbNewProvider.toggled,
- lambda x: self._enable_check())
+ lambda x: self._enable_check())
self._connect_and_track(self.ui.cbProviders.currentIndexChanged[int],
- self._reset_provider_check)
+ self._reset_provider_check)
self._connect_and_track(self.ui.lblUser.returnPressed,
- self._focus_password)
+ self._focus_password)
self._connect_and_track(self.ui.lblPassword.returnPressed,
- self._focus_second_password)
+ self._focus_second_password)
self._connect_and_track(self.ui.lblPassword2.returnPressed,
- self._register)
+ self._register)
self._connect_and_track(self.ui.btnRegister.clicked,
- self._register)
+ self._register)
self._connect_and_track(self.ui.rbExistingProvider.toggled,
self._skip_provider_checks)
@@ -184,21 +187,55 @@ class Wizard(QtGui.QWizard):
:param pinned: list of pinned providers
:type pinned: list of str
+
+
+ How the combobox items are arranged:
+ -----------------------------------
+
+ First run:
+
+ demo.bitmask.net
+ --
+ pinned2.org
+ pinned1.org
+ pinned3.org
+
+ After some usage:
+
+ added-by-user.org
+ pinned-but-then-used.org
+ ---
+ demo.bitmask.net
+ pinned1.org
+ pinned3.org
+ pinned2.org
+
+ In other words:
+ * There are two sections.
+ * Section one consists of all the providers that the user has used.
+ If this is empty, than use demo.bitmask.net for this section.
+ This list is sorted alphabetically.
+ * Section two consists of all the pinned or 'pre seeded' providers,
+ minus any providers that are now in section one. This last list
+ is in random order.
"""
ls = LeapSettings()
- providers = ls.get_configured_providers()
- if not providers and not pinned:
+ user_added = ls.get_configured_providers()
+ if not user_added and not pinned:
self.ui.rbExistingProvider.setEnabled(False)
self.ui.label_8.setEnabled(False) # 'https://' label
self.ui.cbProviders.setEnabled(False)
return
- user_added = []
+ user_added.sort()
+
+ if not user_added:
+ user_added = [pinned.pop(0)]
- # separate pinned providers from user added ones
- for p in providers:
- if p not in pinned:
- user_added.append(p)
+ # separate unused pinned providers from user added ones
+ for p in user_added:
+ if p in pinned:
+ pinned.remove(p)
if user_added:
self.ui.cbProviders.addItems(user_added)
diff --git a/src/leap/bitmask/platform_init/initializers.py b/src/leap/bitmask/platform_init/initializers.py
index 384e1ec1..2d800703 100644
--- a/src/leap/bitmask/platform_init/initializers.py
+++ b/src/leap/bitmask/platform_init/initializers.py
@@ -373,30 +373,6 @@ def DarwinInitializer():
# Linux initializers
#
-def _get_missing_resolvconf_dialog():
- """
- Create a dialog for notifying about missing openresolv.
-
- :rtype: QtGui.QMessageBox instance
- """
- msgstr = QtCore.QObject()
- msgstr.NO_RESOLVCONF = msgstr.tr(
- "Could not find <b>resolvconf</b> installed in your system.\n"
- "Do you want to quit Bitmask now?")
-
- msgstr.EXPLAIN = msgstr.tr(
- "Encrypted Internet needs resolvconf installed to work properly.\n"
- "Please use your package manager to install it.\n")
-
- msg = QtGui.QMessageBox()
- msg.setWindowTitle(msg.tr("Missing resolvconf framework"))
- msg.setText(msgstr.NO_RESOLVCONF)
- # but maybe the user really deserve to know more
- msg.setInformativeText(msgstr.EXPLAIN)
- msg.setStandardButtons(QtGui.QMessageBox.Yes | QtGui.QMessageBox.No)
- msg.setDefaultButton(QtGui.QMessageBox.Yes)
- return msg
-
def _get_missing_complain_dialog(stuff):
"""
@@ -445,21 +421,6 @@ def _get_missing_complain_dialog(stuff):
return msg
-def _linux_check_resolvconf():
- """
- Raise a dialog warning about the lack of the resolvconf framework.
- """
- RESOLVCONF_PATH = "/sbin/resolvconf"
- missing = not os.path.isfile(RESOLVCONF_PATH)
-
- if missing:
- msg = _get_missing_resolvconf_dialog()
- ret = msg.exec_()
-
- if ret == QtGui.QMessageBox.Yes:
- sys.exit()
-
-
def _linux_install_missing_scripts(badexec, notfound):
"""
Try to install the missing helper files.
@@ -509,9 +470,8 @@ def LinuxInitializer():
"""
Raise a dialog if needed files are missing.
- Missing files can be either system-wide resolvconf, bitmask-root, or
- policykit file. The dialog will also be raised if some of those files are
+ Missing files can be either bitmask-root policykit file.
+ The dialog will also be raised if some of those files are
found to have incorrect permissions.
"""
- _linux_check_resolvconf()
check_missing()
diff --git a/src/leap/bitmask/provider/pinned.py b/src/leap/bitmask/provider/pinned.py
index 38851621..6fd2fa70 100644
--- a/src/leap/bitmask/provider/pinned.py
+++ b/src/leap/bitmask/provider/pinned.py
@@ -32,6 +32,7 @@ class PinnedProviders(object):
CONFIG_KEY = "config"
CACERT_KEY = "cacert"
+ PREFERRED_PROVIDER = pinned_demobitmask.DOMAIN
PROVIDERS = {
pinned_demobitmask.DOMAIN: {
@@ -50,11 +51,16 @@ class PinnedProviders(object):
@classmethod
def domains(self):
"""
- Return the domains that are pinned in here
+ Return the domains that are pinned in here.
+ The first domain in the list is the preferred one.
:rtype: list of str
"""
- return self.PROVIDERS.keys()
+ domains = self.PROVIDERS.keys()
+ domains.remove(self.PREFERRED_PROVIDER)
+ domains.insert(0, self.PREFERRED_PROVIDER)
+
+ return domains
@classmethod
def save_hardcoded(self, domain, provider_path, cacert_path):
diff --git a/src/leap/bitmask/services/eip/linuxvpnlauncher.py b/src/leap/bitmask/services/eip/linuxvpnlauncher.py
index 8ec0c050..b6e47f25 100644
--- a/src/leap/bitmask/services/eip/linuxvpnlauncher.py
+++ b/src/leap/bitmask/services/eip/linuxvpnlauncher.py
@@ -74,6 +74,7 @@ def _is_auth_agent_running():
'ps aux | grep "polkit-[m]ate-authentication-agent-1"',
'ps aux | grep "[l]xpolkit"',
'ps aux | grep "[g]nome-shell"',
+ 'ps aux | grep "[f]ingerprint-polkit-agent"',
]
is_running = [commands.getoutput(cmd) for cmd in polkit_options]
@@ -126,12 +127,6 @@ class LinuxVPNLauncher(VPNLauncher):
# LinuxPolicyChecker will give us the right path if standalone.
return LinuxPolicyChecker.get_polkit_path()
- class RESOLVCONF_BIN_PATH(object):
- def __call__(self):
- return ("/usr/local/sbin/leap-resolvconf" if flags.STANDALONE else
- "/sbin/resolvconf")
- # this only will work with debian/ubuntu distros.
-
OTHER_FILES = (POLKIT_PATH, BITMASK_ROOT, OPENVPN_BIN_PATH)
@classmethod