From 67120dc79170d4254d23f44fa6fecaed4da9b13a Mon Sep 17 00:00:00 2001 From: Kali Kaneko Date: Tue, 27 Aug 2013 00:01:53 +0200 Subject: Add data_files under linux * polkit file * /etc/leap/resolv-update --- setup.py | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/setup.py b/setup.py index 2c80eb5c..7f2a5011 100755 --- a/setup.py +++ b/setup.py @@ -108,6 +108,21 @@ class cmd_sdist(versioneer_sdist): cmdclass["build"] = cmd_build cmdclass["sdist"] = cmd_sdist +import platform +_system = platform.system() +IS_LINUX = True if _system == "Linux" else False + +if IS_LINUX: + data_files = [ + # ("share/man/man1", + # ["docs/man/bitmask.1"]), + ("share/polkit-1/actions", + ["pkg/linux/polkit/net.openvpn.gui.leap.policy"]), + ("/etc/leap/", + ["pkg/linux/resolv-update"]), + ] +else: + data_files = [] setup( name="leap.bitmask", @@ -146,12 +161,7 @@ setup( include_package_data=True, # not being used? -- setuptools does not like it. # looks like debhelper is honoring it... - data_files=[ - # ("share/man/man1", - # ["docs/man/bitmask.1"]), - ("share/polkit-1/actions", - ["pkg/linux/polkit/net.openvpn.gui.leap.policy"]), - ], + data_files=data_files, zip_safe=False, platforms="all", entry_points={ -- cgit v1.2.3 From 4889a723c05482b76c1ce830d1373ad48b39102f Mon Sep 17 00:00:00 2001 From: Ivan Alejandro Date: Tue, 27 Aug 2013 09:52:53 -0300 Subject: Move configured providers getter to LeapSettings. --- src/leap/bitmask/config/leapsettings.py | 29 ++++++++++++++++++++++++----- src/leap/bitmask/gui/mainwindow.py | 27 ++++----------------------- 2 files changed, 28 insertions(+), 28 deletions(-) diff --git a/src/leap/bitmask/config/leapsettings.py b/src/leap/bitmask/config/leapsettings.py index 35010280..6aab84e4 100644 --- a/src/leap/bitmask/config/leapsettings.py +++ b/src/leap/bitmask/config/leapsettings.py @@ -75,11 +75,10 @@ class LeapSettings(object): the config :type standalone: bool """ - - settings_path = os.path.join(get_platform_prefixer() - .get_path_prefix(standalone=standalone), - "leap", - self.CONFIG_NAME) + self._path_prefix = get_platform_prefixer().get_path_prefix( + standalone=standalone) + settings_path = os.path.join( + self._path_prefix, "leap", self.CONFIG_NAME) self._settings = QtCore.QSettings(settings_path, QtCore.QSettings.IniFormat) @@ -119,6 +118,26 @@ class LeapSettings(object): leap_assert(windowstate, "We need a window state") self._settings.setValue(self.WINDOWSTATE_KEY, windowstate) + def get_configured_providers(self): + """ + Returns the configured providers based on the file structure in the + settings directory. + + :rtype: list of str + """ + # TODO: check which providers have a valid certificate among + # other things, not just the directories + providers = [] + try: + providers_path = os.path.join( + self._path_prefix, "leap", "providers") + providers = os.listdir(providers_path) + except Exception as e: + logger.debug("Error listing providers, assume there are none. %r" + % (e,)) + + return providers + def get_enabled_services(self, provider): """ Returns a list of enabled services for the given provider diff --git a/src/leap/bitmask/gui/mainwindow.py b/src/leap/bitmask/gui/mainwindow.py index c832887a..7b9d492e 100644 --- a/src/leap/bitmask/gui/mainwindow.py +++ b/src/leap/bitmask/gui/mainwindow.py @@ -491,7 +491,8 @@ class MainWindow(QtGui.QMainWindow): """ # XXX: May be this can be divided into two methods? - self._login_widget.set_providers(self._configured_providers()) + providers = self._settings.get_configured_providers() + self._login_widget.set_providers(providers) self._show_systray() self.show() if IS_MAC: @@ -736,34 +737,14 @@ class MainWindow(QtGui.QMainWindow): QtGui.QMainWindow.closeEvent(self, e) - def _configured_providers(self): - """ - Returns the available providers based on the file structure - - :rtype: list - """ - - # TODO: check which providers have a valid certificate among - # other things, not just the directories - providers = [] - try: - providers = os.listdir( - os.path.join(self._provider_config.get_path_prefix(), - "leap", - "providers")) - except Exception as e: - logger.debug("Error listing providers, assume there are none. %r" - % (e,)) - - return providers - def _first_run(self): """ Returns True if there are no configured providers. False otherwise :rtype: bool """ - has_provider_on_disk = len(self._configured_providers()) != 0 + providers = self._settings.get_configured_providers() + has_provider_on_disk = len(providers) != 0 is_proper_provider = self._settings.get_properprovider() return not (has_provider_on_disk and is_proper_provider) -- cgit v1.2.3 From 1ad3ef4fdacd02d0022f5039ee67e5bf4f578a82 Mon Sep 17 00:00:00 2001 From: Ivan Alejandro Date: Tue, 27 Aug 2013 11:05:00 -0300 Subject: Remove key for a provider with no enabled services --- src/leap/bitmask/config/leapsettings.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/leap/bitmask/config/leapsettings.py b/src/leap/bitmask/config/leapsettings.py index 6aab84e4..c1fabd9c 100644 --- a/src/leap/bitmask/config/leapsettings.py +++ b/src/leap/bitmask/config/leapsettings.py @@ -170,8 +170,12 @@ class LeapSettings(object): leap_assert(len(provider) > 0, "We need a nonempty provider") leap_assert_type(services, list) - self._settings.setValue("%s/Services" % (provider,), - services) + key = "{0}/Services".format(provider) + if not services: + # if there are no enabled services we don't need that key + self._settings.remove(key) + else: + self._settings.setValue(key, services) def get_user(self): """ -- cgit v1.2.3 From 8dda3781b784b2286e11529831eb5e3aea0956b1 Mon Sep 17 00:00:00 2001 From: Ivan Alejandro Date: Mon, 26 Aug 2013 17:47:01 -0300 Subject: Preferences: select enabled services for providers --- src/leap/bitmask/gui/mainwindow.py | 3 +- src/leap/bitmask/gui/preferenceswindow.py | 153 +++++++++++++++++++++++++++++- src/leap/bitmask/gui/ui/preferences.ui | 75 +++++++++++++-- 3 files changed, 217 insertions(+), 14 deletions(-) diff --git a/src/leap/bitmask/gui/mainwindow.py b/src/leap/bitmask/gui/mainwindow.py index 7b9d492e..25747785 100644 --- a/src/leap/bitmask/gui/mainwindow.py +++ b/src/leap/bitmask/gui/mainwindow.py @@ -419,7 +419,8 @@ class MainWindow(QtGui.QMainWindow): Displays the preferences window. """ - PreferencesWindow(self, self._srp_auth, self._soledad).show() + PreferencesWindow( + self, self._srp_auth, self._soledad, self._settings).show() def _uncheck_logger_button(self): """ diff --git a/src/leap/bitmask/gui/preferenceswindow.py b/src/leap/bitmask/gui/preferenceswindow.py index a8220e86..2b48b54c 100644 --- a/src/leap/bitmask/gui/preferenceswindow.py +++ b/src/leap/bitmask/gui/preferenceswindow.py @@ -18,15 +18,18 @@ """ Preferences window """ +import os import logging from functools import partial -from PySide import QtGui +from PySide import QtCore, QtGui from leap.bitmask.gui.ui_preferences import Ui_Preferences from leap.soledad.client import NoStorageSecret from leap.bitmask.crypto.srpauth import SRPAuthBadPassword from leap.bitmask.util.password import basic_password_checks +from leap.bitmask.services import get_supported +from leap.bitmask.config.providerconfig import ProviderConfig logger = logging.getLogger(__name__) @@ -38,7 +41,7 @@ class PreferencesWindow(QtGui.QDialog): WEAK_PASSWORDS = ("123456", "qweasd", "qwerty", "password") - def __init__(self, parent, srp_auth, soledad): + def __init__(self, parent, srp_auth, soledad, leap_settings): """ :param parent: parent object of the PreferencesWindow. :parent type: QWidget @@ -51,14 +54,39 @@ class PreferencesWindow(QtGui.QDialog): self._srp_auth = srp_auth self._soledad = soledad + self._settings = leap_settings # Load UI self.ui = Ui_Preferences() self.ui.setupUi(self) self.ui.lblPasswordChangeStatus.setVisible(False) + self.ui.lblProvidersServicesStatus.setVisible(False) + + # Correspondence for services and their name to display + EIP_LABEL = self.tr("Encrypted Internet") + MX_LABEL = self.tr("Encrypted Mail") + + self.SERVICE_DISPLAY = [ + EIP_LABEL, + MX_LABEL + ] + self.SERVICE_CONFIG = [ + "openvpn", + "mx" + ] + + self._selected_services = set() + self._provider_config = ProviderConfig() # Connections self.ui.pbChangePassword.clicked.connect(self._change_password) + self.ui.cbProvidersServices.currentIndexChanged[unicode].connect( + self._populate_services) + + if not self._settings.get_configured_providers(): + self.ui.gbEnabledServices.setEnabled(False) + else: + self._add_configured_providers() def _set_password_change_status(self, status, error=False, success=False): """ @@ -134,7 +162,7 @@ class PreferencesWindow(QtGui.QDialog): self._set_password_change_status( self.tr("Password changed successfully."), success=True) - self._clear_inputs() + self._clear_password_inputs() self._set_changing_password(False) def _change_password_problem(self, failure): @@ -156,10 +184,127 @@ class PreferencesWindow(QtGui.QDialog): self._set_changing_password(False) failure.trap(Exception) - def _clear_inputs(self): + def _clear_password_inputs(self): """ Clear the contents of the inputs. """ self.ui.leCurrentPassword.setText("") self.ui.leNewPassword.setText("") self.ui.leNewPassword2.setText("") + + def _set_providers_services_status(self, status, success=False): + """ + Sets the status label for the password change. + + :param status: status message to display, can be HTML + :type status: str + """ + if success: + status = "%s" % (status,) + + self.ui.lblProvidersServicesStatus.setVisible(True) + self.ui.lblProvidersServicesStatus.setText(status) + + def _add_configured_providers(self): + """ + Add the client's configured providers to the providers combo boxes. + """ + self.ui.cbProvidersServices.clear() + self.ui.cbProvidersGateway.clear() + for provider in self._settings.get_configured_providers(): + self.ui.cbProvidersServices.addItem(provider) + self.ui.cbProvidersGateway.addItem(provider) + + def _service_selection_changed(self, service, state): + """ + SLOT + TRIGGER: service_checkbox.stateChanged + Adds the service to the state if the state is checked, removes + it otherwise + + :param service: service to handle + :type service: str + :param state: state of the checkbox + :type state: int + """ + if state == QtCore.Qt.Checked: + self._selected_services = \ + self._selected_services.union(set([service])) + else: + self._selected_services = \ + self._selected_services.difference(set([service])) + + # We hide the maybe-visible status label after a change + self.ui.lblProvidersServicesStatus.setVisible(False) + + def _populate_services(self, domain): + """ + SLOT + TRIGGERS: + self.ui.cbProvidersServices.clicked + + Loads the services that the provider provides into the UI for + the user to enable or disable. + + :param domain: the domain of the provider to load services from. + :type domain: str + """ + # We hide the maybe-visible status label after a change + self.ui.lblProvidersServicesStatus.setVisible(False) + + provider_config_path = os.path.join( + "leap", "providers", domain, "provider.json") + + if not domain or not self._provider_config.load(provider_config_path): + return + + # set the proper connection for the 'save' button + try: + self.ui.pbSaveServices.clicked.disconnect() + except RuntimeError: + pass # Signal was not connected + + save_services = partial(self._save_enabled_services, domain) + self.ui.pbSaveServices.clicked.connect(save_services) + + services = get_supported(self._provider_config.get_services()) + services_conf = self._settings.get_enabled_services(domain) + + # discard changes if other provider is selected + self._selected_services = set() + + # from: http://stackoverflow.com/a/13103617/687989 + # remove existing checkboxes + layout = self.ui.vlServices + for i in reversed(range(layout.count())): + layout.itemAt(i).widget().setParent(None) + + # add one checkbox per service and set the current configured value + for service in services: + try: + checkbox = QtGui.QCheckBox(self) + service_index = self.SERVICE_CONFIG.index(service) + checkbox.setText(self.SERVICE_DISPLAY[service_index]) + self.ui.vlServices.addWidget(checkbox) + checkbox.stateChanged.connect( + partial(self._service_selection_changed, service)) + + checkbox.setChecked(service in services_conf) + except ValueError: + logger.error("Something went wrong while trying to " + "load service %s" % (service,)) + + def _save_enabled_services(self, provider): + """ + Saves the new settings to the configuration file. + + :param provider: the provider config that we need to save. + :type provider: str + """ + services = list(self._selected_services) + self._settings.set_enabled_services(provider, services) + + msg = self.tr( + "Services settings for provider '{0}' saved.".format(provider)) + logger.debug(msg) + self._set_providers_services_status(msg, success=True) diff --git a/src/leap/bitmask/gui/ui/preferences.ui b/src/leap/bitmask/gui/ui/preferences.ui index 8c63ccad..1f9ef4c4 100644 --- a/src/leap/bitmask/gui/ui/preferences.ui +++ b/src/leap/bitmask/gui/ui/preferences.ui @@ -6,8 +6,8 @@ 0 0 - 451 - 267 + 453 + 463 @@ -17,8 +17,8 @@ :/images/mask-icon.png:/images/mask-icon.png - - + + Password Change @@ -98,7 +98,64 @@ - + + + + Enabled services + + + + + + Save this provider settings + + + + + + + Services + + + false + + + + + + + + + + + + + <Select provider> + + + + + + + + Select provider: + + + + + + + < Providers Services Status > + + + Qt::AlignCenter + + + + + + + false @@ -116,12 +173,12 @@ &Select provider: - cbProviders + cbProvidersGateway - + <Select provider> @@ -137,7 +194,7 @@ - + Automatic @@ -148,7 +205,7 @@ - + Qt::Vertical -- cgit v1.2.3 From 34aa27b9251ff32c22bc8f4c6826a460714602b3 Mon Sep 17 00:00:00 2001 From: Ivan Alejandro Date: Tue, 27 Aug 2013 10:47:05 -0300 Subject: Add changelog. Closes #3534. --- changes/feature-3534_preference-select-enabled-services | 1 + 1 file changed, 1 insertion(+) create mode 100644 changes/feature-3534_preference-select-enabled-services diff --git a/changes/feature-3534_preference-select-enabled-services b/changes/feature-3534_preference-select-enabled-services new file mode 100644 index 00000000..e3376877 --- /dev/null +++ b/changes/feature-3534_preference-select-enabled-services @@ -0,0 +1 @@ + o Add preferences option to select the enabled services of a provider. Closes #3534. -- cgit v1.2.3 From 061051efd4159faaa043c0da7b5aeba21e7429d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1s=20Touceda?= Date: Tue, 27 Aug 2013 14:49:45 -0300 Subject: Add build scripts for OSX bundles --- pkg/osx/build_bundle.sh | 123 +++++++++++++++++++++++++++++++++++++ pkg/osx/build_bundle_from_linux.sh | 84 +++++++++++++++++++++++++ 2 files changed, 207 insertions(+) create mode 100755 pkg/osx/build_bundle.sh create mode 100644 pkg/osx/build_bundle_from_linux.sh diff --git a/pkg/osx/build_bundle.sh b/pkg/osx/build_bundle.sh new file mode 100755 index 00000000..a13746bf --- /dev/null +++ b/pkg/osx/build_bundle.sh @@ -0,0 +1,123 @@ +REPOS_ROOT=$1 +VERSION=$2 +TEMPLATE_BUNDLE=$3 +JOINT_CHANGELOG=$4 +DEST=$5 + +# clean template + +rm $TEMPLATE_BUNDLE/CHANGELOG.txt +rm $TEMPLATE_BUNDLE/relnotes.txt +rm -rf $TEMPLATE_BUNDLE/Bitmask.app/Contentes/MacOS/apps/leap +rm $TEMPLATE_BUNDLE/Bitmask.app/Contentes/MacOS/lib/leap/{common,keymanager,soledad,mail} + +# checkout VERSION in all repos + +for i in {leap_client,leap_pycommon,soledad,keymanager,leap_mail} + do + cd $REPOS_ROOT/$i + git checkout $VERSION + done + +# make ui in client + +cd $REPOS_ROOT/leap_client +make + +# cp client + +cp -r $REPOS_ROOT/leap_client/src/leap $TEMPLATE_BUNDLE/Bitmask.app/Contents/MacOS/apps/leap + +# setup sdist client + +cd $REPOS_ROOT/leap_client +python setup.py sdist + +# extract $VERSION and copy _version.py to TEMPLATE_BUNDLE/Bitmask.app/Contents/MacOS/apps/leap/bitmask/_version.py + +cd dist +rm -rf leap.bitmask-$VERSION +tar xzf leap.bitmask-$VERSION.tar.gz +cp leap.bitmask-$VERSION/src/leap/bitmask/_version.py $TEMPLATE_BUNDLE/Bitmask.app/Contents/MacOS/apps/leap/bitmask/_version.py +cp leap.bitmask-$VERSION/src/leap/bitmask/util/reqs.txt $TEMPLATE_BUNDLE/Bitmask.app/Contents/MacOS/apps/leap/bitmask/util/reqs.txt + +# cp common, soledad(client and common), mail and keymanager in TEMPLATE_BUNDLE/Bitmask.app/Contents/MacOS/lib/leap/ + +LEAP_LIB=$TEMPLATE_BUNDLE/Bitmask.app/Contents/MacOS/lib/leap/ + +cp -r $REPOS_ROOT/leap_pycommon/src/leap/common $LEAP_LIB +cp -r $REPOS_ROOT/soledad/common/src/leap/soledad $LEAP_LIB +cp -r $REPOS_ROOT/soledad/client/src/leap/soledad/client $LEAP_LIB/soledad +cp -r $REPOS_ROOT/leap_mail/src/leap/mail $LEAP_LIB +cp -r $REPOS_ROOT/keymanager/src/leap/keymanager $LEAP_LIB + +# cp leap_client launcher to TEMPLATE_BUNDLE/Bitmask.app/Contents/MacOS/Bitmask + +BITMASK_BIN=$TEMPLATE_BUNDLE/Bitmask.app/Contents/MacOS/Bitmask + +cd $REPOS_ROOT/leap_client_launcher/build/ +make +cp src/launcher $BITMASK_BIN + +# cp launcher.py to TEMPLATE_BUNDLE/Bitmask.app/Contents/MacOS/apps/ + +cd $REPOS_ROOT/leap_client_launcher/src/ +cp launcher.py $TEMPLATE_BUNDLE/Bitmask.app/Contents/MacOS/apps/ + +# install_name_tool it + +install_name_tool -change libboost_python.dylib lib/libboost_python.dylib $BITMASK_BIN +install_name_tool -change libboost_filesystem.dylib lib/libboost_filesystem.dylib $BITMASK_BIN +install_name_tool -change libboost_system.dylib lib/libboost_system.dylib $BITMASK_BIN + +# cp relnotes to TEMPLATE_BUNDLE + +cp $REPOS_ROOT/leap_client/relnotes.txt $TEMPLATE_BUNDLE + +# cp joint_chglog to TEMPLATE_BUNDLE + +cp $JOINT_CHANGELOG $TEMPLATE_BUNDLE/CHANGELOG.txt + +# cp LICENSE to TEMPLATE_BUNDLE + +cp $REPOS_ROOT/leap_client/LICENSE $TEMPLATE_BUNDLE/LICENSE.txt + +# clean pyc$ + +cd $TEMPLATE_BUNDLE +for i in $(find . | grep pyc$); + do + rm $i + done + +# create dmg + +TMP=/tmp/Bitmask +VOLUME_NAME=Bitmask +DMG_FILE=Bitmask-OSX-$VERSION.dmg + +rm -rf $TMP +mkdir -p $TMP +cp -R $TEMPLATE_BUNDLE/* $TMP +cp $REPOS_ROOT/leap_assets/mac/bitmask.icns $TMP/.VolumeIcon.icns +SetFile -c icnC $TMP/.VolumeIcon.icns +hdiutil create -srcfolder $TMP -volname $VOLUME_NAME -format UDRW -ov $DEST/raw-$DMG_FILE + +rm -rf $TMP +mkdir -p $TMP +hdiutil attach $DEST/raw-$DMG_FILE -mountpoint $TMP + +SetFile -a C $TMP +hdiutil detach $TMP + +rm -rf $TMP +rm -f $DEST/$DMG_FILE +hdiutil convert $DEST/raw-$DMG_FILE -format UDZO -o $DEST/$DMG_FILE +rm -f $DEST/raw-$DMG_FILE + +# go back to develop in all repos +for i in {leap_client,leap_pycommon,soledad,keymanager,leap_mail} + do + cd $REPOS_ROOT/$i + git checkout develop + done diff --git a/pkg/osx/build_bundle_from_linux.sh b/pkg/osx/build_bundle_from_linux.sh new file mode 100644 index 00000000..c98e1b7a --- /dev/null +++ b/pkg/osx/build_bundle_from_linux.sh @@ -0,0 +1,84 @@ +REPOS_ROOT=$1 +VERSION=$2 +TEMPLATE_BUNDLE=$3 +JOINT_CHANGELOG=$4 +DEST=$5 + +# clean template + +rm $TEMPLATE_BUNDLE/CHANGELOG.txt +rm $TEMPLATE_BUNDLE/relnotes.txt +rm -rf $TEMPLATE_BUNDLE/Bitmask.app/Contentes/MacOS/apps/leap +rm $TEMPLATE_BUNDLE/Bitmask.app/Contentes/MacOS/lib/leap/{common,keymanager,soledad,mail} + +# checkout VERSION in all repos + +for i in {leap_client,leap_pycommon,soledad,keymanager,leap_mail} + do + cd $REPOS_ROOT/$i + git checkout $VERSION + done + +# make ui in client + +cd $REPOS_ROOT/leap_client +make + +# cp client + +cp -r $REPOS_ROOT/leap_client/src/leap $TEMPLATE_BUNDLE/Bitmask.app/Contents/MacOS/apps/leap + +# setup sdist client + +cd $REPOS_ROOT/leap_client +python setup.py sdist + +# extract $VERSION and copy _version.py to TEMPLATE_BUNDLE/Bitmask.app/Contents/MacOS/apps/leap/bitmask/_version.py + +cd dist +rm -rf leap.bitmask-$VERSION +tar xzf leap.bitmask-$VERSION.tar.gz +cp leap.bitmask-$VERSION/src/leap/bitmask/_version.py $TEMPLATE_BUNDLE/Bitmask.app/Contents/MacOS/apps/leap/bitmask/_version.py +cp leap.bitmask-$VERSION/src/leap/bitmask/util/reqs.txt $TEMPLATE_BUNDLE/Bitmask.app/Contents/MacOS/apps/leap/bitmask/util/reqs.txt + +# cp common, soledad(client and common), mail and keymanager in TEMPLATE_BUNDLE/Bitmask.app/Contents/MacOS/lib/leap/ + +LEAP_LIB=$TEMPLATE_BUNDLE/Bitmask.app/Contents/MacOS/lib/leap/ + +cp -r $REPOS_ROOT/leap_pycommon/src/leap/common $LEAP_LIB +cp -r $REPOS_ROOT/soledad/common/src/leap/soledad $LEAP_LIB +cp -r $REPOS_ROOT/soledad/client/src/leap/soledad/client $LEAP_LIB/soledad +cp -r $REPOS_ROOT/leap_mail/src/leap/mail $LEAP_LIB +cp -r $REPOS_ROOT/keymanager/src/leap/keymanager $LEAP_LIB + +# cp relnotes to TEMPLATE_BUNDLE + +cp $REPOS_ROOT/leap_client/relnotes.txt $TEMPLATE_BUNDLE + +# cp joint_chglog to TEMPLATE_BUNDLE + +cp $JOINT_CHANGELOG $TEMPLATE_BUNDLE/CHANGELOG.txt + +# cp LICENSE to TEMPLATE_BUNDLE + +cp $REPOS_ROOT/leap_client/LICENSE $TEMPLATE_BUNDLE/LICENSE.txt + +# clean pyc$ + +cd $TEMPLATE_BUNDLE +for i in $(find . | grep pyc$); + do + rm $i + done + +# create dmg + +genisoimage -D -V "Bitmask" -no-pad -r -apple -o raw-Bitmask-OSX-$VERSION.dmg $TEMPLATE_BUNDLE +dmg dmg raw-Bitmask-OSX-$VERSION.dmg Bitmask-OSX-$VERSION.dmg + +# go back to develop in all repos +for i in {leap_client,leap_pycommon,soledad,keymanager,leap_mail} + do + cd $REPOS_ROOT/$i + git checkout develop + done -- cgit v1.2.3 From c7ce3204b2e1335c159e991260a8670f62a56b9d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1s=20Touceda?= Date: Tue, 27 Aug 2013 15:49:03 -0300 Subject: Add build scripts for Linux bundle --- pkg/linux/build_bundle.sh | 106 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 106 insertions(+) create mode 100755 pkg/linux/build_bundle.sh diff --git a/pkg/linux/build_bundle.sh b/pkg/linux/build_bundle.sh new file mode 100755 index 00000000..781884cb --- /dev/null +++ b/pkg/linux/build_bundle.sh @@ -0,0 +1,106 @@ +REPOS_ROOT=$1 +VERSION=$2 +TEMPLATE_BUNDLE=$3 +JOINT_CHANGELOG=$4 +DEST=$5 + +# clean template + +rm $TEMPLATE_BUNDLE/CHANGELOG +rm $TEMPLATE_BUNDLE/relnotes.txt +rm -rf $TEMPLATE_BUNDLE/apps/leap +rm $TEMPLATE_BUNDLE/lib/leap/{common,keymanager,soledad,mail} + +# checkout VERSION in all repos + +for i in {leap_client,leap_pycommon,soledad,keymanager,leap_mail} + do + cd $REPOS_ROOT/$i + git checkout $VERSION + done + +# make ui in client + +cd $REPOS_ROOT/leap_client +make + +# cp client + +cp -r $REPOS_ROOT/leap_client/src/leap $TEMPLATE_BUNDLE/apps/leap + +# setup sdist client + +cd $REPOS_ROOT/leap_client +python setup.py sdist + +# extract $VERSION and copy _version.py to TEMPLATE_BUNDLE/Bitmask.app/Contents/MacOS/apps/leap/bitmask/_version.py + +cd dist +rm -rf leap.bitmask-$VERSION +tar xzf leap.bitmask-$VERSION.tar.gz +cp leap.bitmask-$VERSION/src/leap/bitmask/_version.py $TEMPLATE_BUNDLE/apps/leap/bitmask/_version.py +cp leap.bitmask-$VERSION/src/leap/bitmask/util/reqs.txt $TEMPLATE_BUNDLE/apps/leap/bitmask/util/reqs.txt + +# cp common, soledad(client and common), mail and keymanager in TEMPLATE_BUNDLE/Bitmask.app/Contents/MacOS/lib/leap/ + +LEAP_LIB=$TEMPLATE_BUNDLE/lib/leap/ + +cp -r $REPOS_ROOT/leap_pycommon/src/leap/common $LEAP_LIB +cp -r $REPOS_ROOT/soledad/common/src/leap/soledad $LEAP_LIB +cp -r $REPOS_ROOT/soledad/client/src/leap/soledad/client $LEAP_LIB/soledad +cp -r $REPOS_ROOT/leap_mail/src/leap/mail $LEAP_LIB +cp -r $REPOS_ROOT/keymanager/src/leap/keymanager $LEAP_LIB + +# cp leap_client launcher to TEMPLATE_BUNDLE/Bitmask.app/Contents/MacOS/Bitmask + +BITMASK_BIN=$TEMPLATE_BUNDLE/bitmask + +cd $REPOS_ROOT/leap_client_launcher/build/ +make +cp src/launcher $BITMASK_BIN + +# cp launcher.py to TEMPLATE_BUNDLE/Bitmask.app/Contents/MacOS/apps/ + +cd $REPOS_ROOT/leap_client_launcher/src/ +cp launcher.py $TEMPLATE_BUNDLE/apps/ + +# cp relnotes to TEMPLATE_BUNDLE + +cp $REPOS_ROOT/leap_client/relnotes.txt $TEMPLATE_BUNDLE + +# cp joint_chglog to TEMPLATE_BUNDLE + +cp $JOINT_CHANGELOG $TEMPLATE_BUNDLE/CHANGELOG + +# cp LICENSE to TEMPLATE_BUNDLE + +cp $REPOS_ROOT/leap_client/LICENSE $TEMPLATE_BUNDLE/LICENSE + +# clean pyc$ + +cd $TEMPLATE_BUNDLE +for i in $(find . | grep pyc$); + do + rm $i + done + +# create tarball + +ARCH=$(uname -m | sed 's/x86_//;s/i[3-6]86/32/') +BUNDLE_NAME=Bitmask-linux$ARCH-$VERSION +TMP=/tmp/$BUNDLE_NAME + +rm -rf $TMP +mkdir -p $TMP +cp -R $TEMPLATE_BUNDLE/* $TMP +cd /tmp +tar cjf $DEST/$BUNDLE_NAME.tar.bz2 $BUNDLE_NAME +cd +rm -rf $TMP + +# go back to develop in all repos +for i in {leap_client,leap_pycommon,soledad,keymanager,leap_mail} + do + cd $REPOS_ROOT/$i + git checkout develop + done -- cgit v1.2.3 From 8cce83844448a83ab03cb8a3a04320547e024d06 Mon Sep 17 00:00:00 2001 From: Ivan Alejandro Date: Tue, 27 Aug 2013 09:52:53 -0300 Subject: Move configured providers getter to LeapSettings. --- src/leap/bitmask/config/leapsettings.py | 29 ++++++++++++++++++++++++----- src/leap/bitmask/gui/mainwindow.py | 27 ++++----------------------- 2 files changed, 28 insertions(+), 28 deletions(-) diff --git a/src/leap/bitmask/config/leapsettings.py b/src/leap/bitmask/config/leapsettings.py index 35010280..6aab84e4 100644 --- a/src/leap/bitmask/config/leapsettings.py +++ b/src/leap/bitmask/config/leapsettings.py @@ -75,11 +75,10 @@ class LeapSettings(object): the config :type standalone: bool """ - - settings_path = os.path.join(get_platform_prefixer() - .get_path_prefix(standalone=standalone), - "leap", - self.CONFIG_NAME) + self._path_prefix = get_platform_prefixer().get_path_prefix( + standalone=standalone) + settings_path = os.path.join( + self._path_prefix, "leap", self.CONFIG_NAME) self._settings = QtCore.QSettings(settings_path, QtCore.QSettings.IniFormat) @@ -119,6 +118,26 @@ class LeapSettings(object): leap_assert(windowstate, "We need a window state") self._settings.setValue(self.WINDOWSTATE_KEY, windowstate) + def get_configured_providers(self): + """ + Returns the configured providers based on the file structure in the + settings directory. + + :rtype: list of str + """ + # TODO: check which providers have a valid certificate among + # other things, not just the directories + providers = [] + try: + providers_path = os.path.join( + self._path_prefix, "leap", "providers") + providers = os.listdir(providers_path) + except Exception as e: + logger.debug("Error listing providers, assume there are none. %r" + % (e,)) + + return providers + def get_enabled_services(self, provider): """ Returns a list of enabled services for the given provider diff --git a/src/leap/bitmask/gui/mainwindow.py b/src/leap/bitmask/gui/mainwindow.py index c832887a..7b9d492e 100644 --- a/src/leap/bitmask/gui/mainwindow.py +++ b/src/leap/bitmask/gui/mainwindow.py @@ -491,7 +491,8 @@ class MainWindow(QtGui.QMainWindow): """ # XXX: May be this can be divided into two methods? - self._login_widget.set_providers(self._configured_providers()) + providers = self._settings.get_configured_providers() + self._login_widget.set_providers(providers) self._show_systray() self.show() if IS_MAC: @@ -736,34 +737,14 @@ class MainWindow(QtGui.QMainWindow): QtGui.QMainWindow.closeEvent(self, e) - def _configured_providers(self): - """ - Returns the available providers based on the file structure - - :rtype: list - """ - - # TODO: check which providers have a valid certificate among - # other things, not just the directories - providers = [] - try: - providers = os.listdir( - os.path.join(self._provider_config.get_path_prefix(), - "leap", - "providers")) - except Exception as e: - logger.debug("Error listing providers, assume there are none. %r" - % (e,)) - - return providers - def _first_run(self): """ Returns True if there are no configured providers. False otherwise :rtype: bool """ - has_provider_on_disk = len(self._configured_providers()) != 0 + providers = self._settings.get_configured_providers() + has_provider_on_disk = len(providers) != 0 is_proper_provider = self._settings.get_properprovider() return not (has_provider_on_disk and is_proper_provider) -- cgit v1.2.3 From 956330af5a67922e7710e7c4817de8fc15fab5ac Mon Sep 17 00:00:00 2001 From: Ivan Alejandro Date: Tue, 27 Aug 2013 11:05:00 -0300 Subject: Remove key for a provider with no enabled services --- src/leap/bitmask/config/leapsettings.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/leap/bitmask/config/leapsettings.py b/src/leap/bitmask/config/leapsettings.py index 6aab84e4..c1fabd9c 100644 --- a/src/leap/bitmask/config/leapsettings.py +++ b/src/leap/bitmask/config/leapsettings.py @@ -170,8 +170,12 @@ class LeapSettings(object): leap_assert(len(provider) > 0, "We need a nonempty provider") leap_assert_type(services, list) - self._settings.setValue("%s/Services" % (provider,), - services) + key = "{0}/Services".format(provider) + if not services: + # if there are no enabled services we don't need that key + self._settings.remove(key) + else: + self._settings.setValue(key, services) def get_user(self): """ -- cgit v1.2.3 From 45796e0256e3a57e506d6db8c2bde62a510ae6ae Mon Sep 17 00:00:00 2001 From: Ivan Alejandro Date: Mon, 26 Aug 2013 17:47:01 -0300 Subject: Preferences: select enabled services for providers --- src/leap/bitmask/gui/mainwindow.py | 11 +- src/leap/bitmask/gui/preferenceswindow.py | 165 +++++++++++++++++++++++++++++- src/leap/bitmask/gui/ui/mainwindow.ui | 2 +- src/leap/bitmask/gui/ui/preferences.ui | 78 ++++++++++++-- 4 files changed, 236 insertions(+), 20 deletions(-) diff --git a/src/leap/bitmask/gui/mainwindow.py b/src/leap/bitmask/gui/mainwindow.py index 7b9d492e..34451928 100644 --- a/src/leap/bitmask/gui/mainwindow.py +++ b/src/leap/bitmask/gui/mainwindow.py @@ -288,17 +288,12 @@ class MainWindow(QtGui.QMainWindow): ################################# end Qt Signals connection ######## - # Enable the password change when soledad is ready - self.soledad_ready.connect( - partial(self.ui.btnPreferences.setEnabled, True)) - init_platform() self._wizard = None self._wizard_firstrun = False self._logger_window = None - self._preferences_window = None self._bypass_checks = bypass_checks @@ -419,7 +414,11 @@ class MainWindow(QtGui.QMainWindow): Displays the preferences window. """ - PreferencesWindow(self, self._srp_auth, self._soledad).show() + preferences_window = PreferencesWindow( + self, self._srp_auth, self._soledad, + self._settings, self._standalone) + + preferences_window.show() def _uncheck_logger_button(self): """ diff --git a/src/leap/bitmask/gui/preferenceswindow.py b/src/leap/bitmask/gui/preferenceswindow.py index a8220e86..f580e703 100644 --- a/src/leap/bitmask/gui/preferenceswindow.py +++ b/src/leap/bitmask/gui/preferenceswindow.py @@ -18,15 +18,18 @@ """ Preferences window """ +import os import logging from functools import partial -from PySide import QtGui +from PySide import QtCore, QtGui from leap.bitmask.gui.ui_preferences import Ui_Preferences from leap.soledad.client import NoStorageSecret from leap.bitmask.crypto.srpauth import SRPAuthBadPassword from leap.bitmask.util.password import basic_password_checks +from leap.bitmask.services import get_supported +from leap.bitmask.config.providerconfig import ProviderConfig logger = logging.getLogger(__name__) @@ -38,7 +41,7 @@ class PreferencesWindow(QtGui.QDialog): WEAK_PASSWORDS = ("123456", "qweasd", "qwerty", "password") - def __init__(self, parent, srp_auth, soledad): + def __init__(self, parent, srp_auth, soledad, leap_settings): """ :param parent: parent object of the PreferencesWindow. :parent type: QWidget @@ -51,14 +54,51 @@ class PreferencesWindow(QtGui.QDialog): self._srp_auth = srp_auth self._soledad = soledad + self._settings = leap_settings # Load UI self.ui = Ui_Preferences() self.ui.setupUi(self) self.ui.lblPasswordChangeStatus.setVisible(False) + self.ui.lblProvidersServicesStatus.setVisible(False) + + # Correspondence for services and their name to display + EIP_LABEL = self.tr("Encrypted Internet") + MX_LABEL = self.tr("Encrypted Mail") + + self.SERVICE_DISPLAY = [ + EIP_LABEL, + MX_LABEL + ] + self.SERVICE_CONFIG = [ + "openvpn", + "mx" + ] + + self._selected_services = set() + self._provider_config = ProviderConfig() # Connections self.ui.pbChangePassword.clicked.connect(self._change_password) + self.ui.cbProvidersServices.currentIndexChanged[unicode].connect( + self._populate_services) + + parent.soledad_ready.connect(self._soledad_ready) + + if not self._settings.get_configured_providers(): + self.ui.gbEnabledServices.setEnabled(False) + else: + self._add_configured_providers() + + def _soledad_ready(self): + """ + SLOT + TRIGGERS: + parent.soledad_ready + It sets the soledad object as ready to use. + """ + self._soledad_ready = True + self.ui.gbPasswordChange.setEnabled(True) def _set_password_change_status(self, status, error=False, success=False): """ @@ -134,7 +174,7 @@ class PreferencesWindow(QtGui.QDialog): self._set_password_change_status( self.tr("Password changed successfully."), success=True) - self._clear_inputs() + self._clear_password_inputs() self._set_changing_password(False) def _change_password_problem(self, failure): @@ -156,10 +196,127 @@ class PreferencesWindow(QtGui.QDialog): self._set_changing_password(False) failure.trap(Exception) - def _clear_inputs(self): + def _clear_password_inputs(self): """ Clear the contents of the inputs. """ self.ui.leCurrentPassword.setText("") self.ui.leNewPassword.setText("") self.ui.leNewPassword2.setText("") + + def _set_providers_services_status(self, status, success=False): + """ + Sets the status label for the password change. + + :param status: status message to display, can be HTML + :type status: str + """ + if success: + status = "%s" % (status,) + + self.ui.lblProvidersServicesStatus.setVisible(True) + self.ui.lblProvidersServicesStatus.setText(status) + + def _add_configured_providers(self): + """ + Add the client's configured providers to the providers combo boxes. + """ + self.ui.cbProvidersServices.clear() + self.ui.cbProvidersGateway.clear() + for provider in self._settings.get_configured_providers(): + self.ui.cbProvidersServices.addItem(provider) + self.ui.cbProvidersGateway.addItem(provider) + + def _service_selection_changed(self, service, state): + """ + SLOT + TRIGGER: service_checkbox.stateChanged + Adds the service to the state if the state is checked, removes + it otherwise + + :param service: service to handle + :type service: str + :param state: state of the checkbox + :type state: int + """ + if state == QtCore.Qt.Checked: + self._selected_services = \ + self._selected_services.union(set([service])) + else: + self._selected_services = \ + self._selected_services.difference(set([service])) + + # We hide the maybe-visible status label after a change + self.ui.lblProvidersServicesStatus.setVisible(False) + + def _populate_services(self, domain): + """ + SLOT + TRIGGERS: + self.ui.cbProvidersServices.clicked + + Loads the services that the provider provides into the UI for + the user to enable or disable. + + :param domain: the domain of the provider to load services from. + :type domain: str + """ + # We hide the maybe-visible status label after a change + self.ui.lblProvidersServicesStatus.setVisible(False) + + provider_config_path = os.path.join( + "leap", "providers", domain, "provider.json") + + if not domain or not self._provider_config.load(provider_config_path): + return + + # set the proper connection for the 'save' button + try: + self.ui.pbSaveServices.clicked.disconnect() + except RuntimeError: + pass # Signal was not connected + + save_services = partial(self._save_enabled_services, domain) + self.ui.pbSaveServices.clicked.connect(save_services) + + services = get_supported(self._provider_config.get_services()) + services_conf = self._settings.get_enabled_services(domain) + + # discard changes if other provider is selected + self._selected_services = set() + + # from: http://stackoverflow.com/a/13103617/687989 + # remove existing checkboxes + layout = self.ui.vlServices + for i in reversed(range(layout.count())): + layout.itemAt(i).widget().setParent(None) + + # add one checkbox per service and set the current configured value + for service in services: + try: + checkbox = QtGui.QCheckBox(self) + service_index = self.SERVICE_CONFIG.index(service) + checkbox.setText(self.SERVICE_DISPLAY[service_index]) + self.ui.vlServices.addWidget(checkbox) + checkbox.stateChanged.connect( + partial(self._service_selection_changed, service)) + + checkbox.setChecked(service in services_conf) + except ValueError: + logger.error("Something went wrong while trying to " + "load service %s" % (service,)) + + def _save_enabled_services(self, provider): + """ + Saves the new settings to the configuration file. + + :param provider: the provider config that we need to save. + :type provider: str + """ + services = list(self._selected_services) + self._settings.set_enabled_services(provider, services) + + msg = self.tr( + "Services settings for provider '{0}' saved.".format(provider)) + logger.debug(msg) + self._set_providers_services_status(msg, success=True) diff --git a/src/leap/bitmask/gui/ui/mainwindow.ui b/src/leap/bitmask/gui/ui/mainwindow.ui index 834a562e..17837642 100644 --- a/src/leap/bitmask/gui/ui/mainwindow.ui +++ b/src/leap/bitmask/gui/ui/mainwindow.ui @@ -217,7 +217,7 @@ - false + true Preferences diff --git a/src/leap/bitmask/gui/ui/preferences.ui b/src/leap/bitmask/gui/ui/preferences.ui index 8c63ccad..b59990b1 100644 --- a/src/leap/bitmask/gui/ui/preferences.ui +++ b/src/leap/bitmask/gui/ui/preferences.ui @@ -6,8 +6,8 @@ 0 0 - 451 - 267 + 453 + 463 @@ -17,9 +17,12 @@ :/images/mask-icon.png:/images/mask-icon.png - - + + + + false + Password Change @@ -98,7 +101,64 @@ - + + + + Enabled services + + + + + + Save this provider settings + + + + + + + Services + + + false + + + + + + + + + + + + + <Select provider> + + + + + + + + Select provider: + + + + + + + < Providers Services Status > + + + Qt::AlignCenter + + + + + + + false @@ -116,12 +176,12 @@ &Select provider: - cbProviders + cbProvidersGateway - + <Select provider> @@ -137,7 +197,7 @@ - + Automatic @@ -148,7 +208,7 @@ - + Qt::Vertical -- cgit v1.2.3 From 39395c6c9ac3bc7011f5ac3fbe5da9605f36ed18 Mon Sep 17 00:00:00 2001 From: Ivan Alejandro Date: Tue, 27 Aug 2013 17:52:40 -0300 Subject: Refactor services display names out. Closes #3578. --- src/leap/bitmask/gui/preferenceswindow.py | 27 ++++++++++-------------- src/leap/bitmask/gui/wizard.py | 25 +++++----------------- src/leap/bitmask/services/__init__.py | 35 +++++++++++++++++++++++++++++++ 3 files changed, 51 insertions(+), 36 deletions(-) diff --git a/src/leap/bitmask/gui/preferenceswindow.py b/src/leap/bitmask/gui/preferenceswindow.py index f580e703..05f616b0 100644 --- a/src/leap/bitmask/gui/preferenceswindow.py +++ b/src/leap/bitmask/gui/preferenceswindow.py @@ -30,6 +30,7 @@ from leap.bitmask.crypto.srpauth import SRPAuthBadPassword from leap.bitmask.util.password import basic_password_checks from leap.bitmask.services import get_supported from leap.bitmask.config.providerconfig import ProviderConfig +from leap.bitmask.services import get_service_display_name logger = logging.getLogger(__name__) @@ -41,7 +42,7 @@ class PreferencesWindow(QtGui.QDialog): WEAK_PASSWORDS = ("123456", "qweasd", "qwerty", "password") - def __init__(self, parent, srp_auth, soledad, leap_settings): + def __init__(self, parent, srp_auth, soledad, leap_settings, standalone): """ :param parent: parent object of the PreferencesWindow. :parent type: QWidget @@ -49,12 +50,17 @@ class PreferencesWindow(QtGui.QDialog): :type srp_auth: SRPAuth :param soledad: Soledad object configured in the main app. :type soledad: Soledad + :param standalone: If True, the application is running as standalone + and the preferences dialog should display some + messages according to this. + :type standalone: bool """ QtGui.QDialog.__init__(self, parent) self._srp_auth = srp_auth self._soledad = soledad self._settings = leap_settings + self._standalone = standalone # Load UI self.ui = Ui_Preferences() @@ -62,19 +68,6 @@ class PreferencesWindow(QtGui.QDialog): self.ui.lblPasswordChangeStatus.setVisible(False) self.ui.lblProvidersServicesStatus.setVisible(False) - # Correspondence for services and their name to display - EIP_LABEL = self.tr("Encrypted Internet") - MX_LABEL = self.tr("Encrypted Mail") - - self.SERVICE_DISPLAY = [ - EIP_LABEL, - MX_LABEL - ] - self.SERVICE_CONFIG = [ - "openvpn", - "mx" - ] - self._selected_services = set() self._provider_config = ProviderConfig() @@ -295,8 +288,10 @@ class PreferencesWindow(QtGui.QDialog): for service in services: try: checkbox = QtGui.QCheckBox(self) - service_index = self.SERVICE_CONFIG.index(service) - checkbox.setText(self.SERVICE_DISPLAY[service_index]) + service_label = get_service_display_name( + service, self._standalone) + checkbox.setText(service_label) + self.ui.vlServices.addWidget(checkbox) checkbox.stateChanged.connect( partial(self._service_selection_changed, service)) diff --git a/src/leap/bitmask/gui/wizard.py b/src/leap/bitmask/gui/wizard.py index e3f0085b..ac0f032f 100644 --- a/src/leap/bitmask/gui/wizard.py +++ b/src/leap/bitmask/gui/wizard.py @@ -34,7 +34,7 @@ from leap.bitmask.util.request_helpers import get_content from leap.bitmask.util.keyring_helpers import has_keyring from leap.bitmask.util.password import basic_password_checks from leap.bitmask.services.eip.providerbootstrapper import ProviderBootstrapper -from leap.bitmask.services import get_supported +from leap.bitmask.services import get_service_display_name, get_supported from ui_wizard import Ui_Wizard @@ -84,23 +84,6 @@ class Wizard(QtGui.QWizard): self.ERROR_ICON = QtGui.QPixmap(":/images/Dialog-error.png") self.OK_ICON = QtGui.QPixmap(":/images/Dialog-accept.png") - # Correspondence for services and their name to display - EIP_LABEL = self.tr("Encrypted Internet") - MX_LABEL = self.tr("Encrypted Mail") - - if self._is_need_eip_password_warning(): - EIP_LABEL += " " + self.tr( - "(will need admin password to start)") - - self.SERVICE_DISPLAY = [ - EIP_LABEL, - MX_LABEL - ] - self.SERVICE_CONFIG = [ - "openvpn", - "mx" - ] - self._selected_services = set() self._shown_services = set() @@ -507,8 +490,10 @@ class Wizard(QtGui.QWizard): try: if service not in self._shown_services: checkbox = QtGui.QCheckBox(self) - service_index = self.SERVICE_CONFIG.index(service) - checkbox.setText(self.SERVICE_DISPLAY[service_index]) + service_label = get_service_display_name( + service, self.standalone) + checkbox.setText(service_label) + self.ui.serviceListLayout.addWidget(checkbox) checkbox.stateChanged.connect( partial(self._service_selection_changed, service)) diff --git a/src/leap/bitmask/services/__init__.py b/src/leap/bitmask/services/__init__.py index 253359cd..924ca547 100644 --- a/src/leap/bitmask/services/__init__.py +++ b/src/leap/bitmask/services/__init__.py @@ -17,9 +17,44 @@ """ Services module. """ +from PySide import QtCore +from leap.bitmask.util.privilege_policies import is_missing_policy_permissions + DEPLOYED = ["openvpn", "mx"] +def get_service_display_name(service, standalone=False): + """ + Returns the name to display of the given service. + + :param service: the 'machine' service name + :type service: str + :param standalone: True if the app is running in a standalone mode, used + to display messages according that. + :type standalone: bool + + :rtype: str + """ + # qt translator method helper + _tr = QtCore.QObject().tr + + # Correspondence for services and their name to display + EIP_LABEL = _tr("Encrypted Internet") + MX_LABEL = _tr("Encrypted Mail") + + service_display = [EIP_LABEL, MX_LABEL] + service_config = ["openvpn", "mx"] + + # If we need to add a warning about eip needing + # administrative permissions to start. That can be either + # because we are running in standalone mode, or because we could + # not find the needed privilege escalation mechanisms being operative. + if standalone or is_missing_policy_permissions(): + EIP_LABEL += " " + _tr("(will need admin password to start)") + + return service_display[service_config.index(service)] + + def get_supported(services): """ Returns a list of the available services. -- cgit v1.2.3 From a3d229bd52405146e188905ec1d37c7bfb30320f Mon Sep 17 00:00:00 2001 From: Ivan Alejandro Date: Tue, 27 Aug 2013 10:47:05 -0300 Subject: Add changelog. Closes #3534. --- changes/feature-3534_preference-select-enabled-services | 1 + 1 file changed, 1 insertion(+) create mode 100644 changes/feature-3534_preference-select-enabled-services diff --git a/changes/feature-3534_preference-select-enabled-services b/changes/feature-3534_preference-select-enabled-services new file mode 100644 index 00000000..e3376877 --- /dev/null +++ b/changes/feature-3534_preference-select-enabled-services @@ -0,0 +1 @@ + o Add preferences option to select the enabled services of a provider. Closes #3534. -- cgit v1.2.3 From 40b016a02a0df5d7106d453f5aa01bbf804b39d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1s=20Touceda?= Date: Wed, 28 Aug 2013 15:34:24 -0300 Subject: Update release checklist --- docs/checklist_for_leap_client_release.wiki | 45 ----------------------------- docs/release_checklist.wiki | 34 ++++++++++++++++++++++ 2 files changed, 34 insertions(+), 45 deletions(-) delete mode 100644 docs/checklist_for_leap_client_release.wiki create mode 100644 docs/release_checklist.wiki diff --git a/docs/checklist_for_leap_client_release.wiki b/docs/checklist_for_leap_client_release.wiki deleted file mode 100644 index d3bdf1ee..00000000 --- a/docs/checklist_for_leap_client_release.wiki +++ /dev/null @@ -1,45 +0,0 @@ -= LEAP CLient Release Checklist (*) = - - * [ ] validate rc - * [ ] all rc-critical closed! - * [ ] all bbots green - * [ ] uploaded translations: make translations - * [ ] re-generate pyside resources - - * [ ] update docs - * [ ] CREDITS - * [ ] relnotes.txt - * [ ] docs/known_issues.rst - * [ ] NEWS.rst: Add release name and date to top-most item in NEWS. - - * [ ] change docs/quickstart.rst to point to just the current - leap-client-X.Y.Z.deb binaries and .tar.gz source code files - * [ ] on release/vX.Y.Z branch: git pull - * [ ] git tag X.Y.Z - * [ ] build locally to make sure the release is reporting itself as the - intended version (FIXME!) - * [ ] make sure buildbot is green - * [ ] make sure other people aren't committing at that moment - * [ ] FUTURE: push tag along with some other documentation-only patch (typically to - relnotes.txt) to trigger buildslaves - * [ ] git push --tags official; git push official - * [ ] that will build tarballs - * [ ] make sure buildbot is green (in a parallel universe, he) - * [ ] download tarballs, sign with "gpg -ba -u deadbeef TAR", upload *.asc - * [ ] symlink the release tarball on leap.se downloads page: - /var/www/source/leap-client/releases/ CHANGEME XXX - - * [ ] update news pages. release notes. - * [ ] send out relnotes.txt to internal list. - * [ ] wait ...? - - * [ ] PYPI UPLOAD: with "python ./setup.py sdist upload register" - - * [ ] make an "announcement of new release" on leap.se - * [ ] close the Milestone on the chili Roadmap - * [ ] send out relnotes.txt to: - * [ ] mailing lists... - -notes ------ -(*) this checklist kindly borrowed from tahoe-lafs documentation =) diff --git a/docs/release_checklist.wiki b/docs/release_checklist.wiki new file mode 100644 index 00000000..8987f0b8 --- /dev/null +++ b/docs/release_checklist.wiki @@ -0,0 +1,34 @@ += Bitmask Release Checklist (*) = + * [ ] Tag everything + * Should be done for the following packages, in order: + 1. leap.common + 2. leap.keymanager + 3. leap.soledad + 4. leap.mail + 5. leap.bitmask + 6. leap.mx + * NOTE: It's assumed that origin is the leap.se repo + * [ ] git fetch origin + * [ ] git tag -l, and see the latest tagged version (unless it's not a minor version bump, in which case, just bump to it) + * [ ] Checkout release-X.Y.Z (locally, never pushed) + * [ ] Fold in changes files into the CHANGELOG + - NOTE: For leap.soledad, the CHANGELOG entries should be divided per package (common, client, server). See older releases for reference. + - Helper bash line: for i in $(ls changes); do cat changes/$i; echo; done + * [ ] Update relnotes.txt if needed. + * [ ] git rm changes/* + * [ ] git commit -av + * [ ] Update dependencies on the current package in the packages that remain if needed (that's why the order). + * [ ] git tag -s X.Y.Z (note the -s so that it's a signed tag) The message should be something like: Tag version X.Y.Z + * [ ] git push origin X.Y.Z + * [ ] git checkout master && git pull origin master && git merge release-X.Y.Z && git push origin master + * [ ] git checkout develop && git pull origin develop && git merge release-X.Y.Z && git push origin develop + * [ ] Build bundles + * [ ] Use the scripts under pkg// to build the the bundles. + * [ ] Sign them with gpg -a + * [ ] Upload bundle and signature to web-uploads@salmon.leap.se:~/public/client// + * [ ] Announce + * [ ] Mail leap@lists.riseup.net + +Notes +----- +(*) this checklist kindly borrowed from tahoe-lafs documentation =) -- cgit v1.2.3 From 3b12583c01976025a18caef8ef4bdccae9e92549 Mon Sep 17 00:00:00 2001 From: Ivan Alejandro Date: Wed, 28 Aug 2013 15:34:38 -0300 Subject: Use dirspec instead of plain xdg. Closes #3574. --- changes/feature-3574_use-dirspec-instead-of-plain-xdg | 1 + src/leap/bitmask/config/leapsettings.py | 9 ++++----- 2 files changed, 5 insertions(+), 5 deletions(-) create mode 100644 changes/feature-3574_use-dirspec-instead-of-plain-xdg diff --git a/changes/feature-3574_use-dirspec-instead-of-plain-xdg b/changes/feature-3574_use-dirspec-instead-of-plain-xdg new file mode 100644 index 00000000..9bdc5071 --- /dev/null +++ b/changes/feature-3574_use-dirspec-instead-of-plain-xdg @@ -0,0 +1 @@ + o Use dirspec instead of plain xdg. Closes #3574. diff --git a/src/leap/bitmask/config/leapsettings.py b/src/leap/bitmask/config/leapsettings.py index 35010280..4929ab41 100644 --- a/src/leap/bitmask/config/leapsettings.py +++ b/src/leap/bitmask/config/leapsettings.py @@ -24,7 +24,7 @@ import logging from PySide import QtCore from leap.common.check import leap_assert, leap_assert_type -from leap.common.config.prefixers import get_platform_prefixer +from leap.common.config import get_path_prefix logger = logging.getLogger(__name__) @@ -76,10 +76,9 @@ class LeapSettings(object): :type standalone: bool """ - settings_path = os.path.join(get_platform_prefixer() - .get_path_prefix(standalone=standalone), - "leap", - self.CONFIG_NAME) + settings_path = os.path.join( + get_path_prefix(standalone=standalone), "leap", self.CONFIG_NAME) + self._settings = QtCore.QSettings(settings_path, QtCore.QSettings.IniFormat) -- cgit v1.2.3 From b27fcd2a41fec9c642207488489f0d13cc04f6db Mon Sep 17 00:00:00 2001 From: Ivan Alejandro Date: Wed, 28 Aug 2013 16:03:58 -0300 Subject: Replace old path_prefix with new method. --- src/leap/bitmask/config/leapsettings.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/leap/bitmask/config/leapsettings.py b/src/leap/bitmask/config/leapsettings.py index 4604b807..ca94129e 100644 --- a/src/leap/bitmask/config/leapsettings.py +++ b/src/leap/bitmask/config/leapsettings.py @@ -129,7 +129,7 @@ class LeapSettings(object): providers = [] try: providers_path = os.path.join( - self._path_prefix, "leap", "providers") + get_path_prefix(), "leap", "providers") providers = os.listdir(providers_path) except Exception as e: logger.debug("Error listing providers, assume there are none. %r" -- cgit v1.2.3 From 85eb26371d1f3ec5cfd07beb27778b9d908b94b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1s=20Touceda?= Date: Thu, 29 Aug 2013 10:11:06 -0300 Subject: Add hacking doc for contributors --- docs/dev/workflow.rst | 45 ++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 44 insertions(+), 1 deletion(-) diff --git a/docs/dev/workflow.rst b/docs/dev/workflow.rst index e36431ff..1e3bd4af 100644 --- a/docs/dev/workflow.rst +++ b/docs/dev/workflow.rst @@ -5,6 +5,11 @@ Development Workflow This section documents the workflow that the LEAP project team follows and expects for the code contributions. +While reading this guide, you should have in mind the two rules of contributing code: + +* The first rule of code contribution is: Nobody will push unreviewed code to the mainline branches. +* The second rule of code contribution is: Nobody will push unreviewed code to the mainline branches. + Code formatting --------------- In one word: `PEP8`_. @@ -24,7 +29,7 @@ We are basing our workflow on what is described in `A successful git branching m .. image:: https://leap.se/code/attachments/13/git-branching-model.png -The author of the aforementioned post has also a handy pdf version of it: `branching_model.pdf`_ +The author of the aforementioned post has also a handy pdf version of it: `branching_model.pdf`_ However, we use a setup in which each developer maintains her own feature branch in her private repo. After a code review, this feature branch is rebased onto the authoritative integration branch. Thus, the leapcode repo in leap.se (mirrored in github) only maintains the master and develop branches. @@ -41,3 +46,41 @@ All code ready to be merged into the integration branch is expected to: * Have tests * Be documented * Pass existing tests: do **run_tests.sh** and **tox -v**. All feature branches are automagically built by our `buildbot farm `_. So please check your branch is green before merging it it to `develop`. Rebasing against the current tip of the integration when possible is preferred in order to keep a clean history. + +Using Github +------------ + +Particularly for the Bitmask client, we are using Github. So you should fork the repo from `github`_ . Depending on what kind of work you are going to do (bug or feature) you should create a branch with the following name: + +`bug/some_descriptive_text` + +or + +`feature/some_descriptive_text` + +Do your work there, push it, and create a pull request against the develop branch in the leapcode owned repo. Either you should post the pull request in `#leap-dev` at `Freenode` or we will just notice it when it's created. + +Your code will get reviewed/discussed by someone else on the team, and say that you need to make some changes. What you would do is the following: + + git checkout + + # edit what you need here ... + + # Simple commit, this doesn't need a good commit message + git commit -avm "Fix" + + # This will help you reorder your commits and squash them (so that the + # final commit list has good representative messages) + git rebase -i develop + + # Since you've rewritten your history, you'll need a force push + git push + + +This will update your pull request automatically, but it won't notify us about the update, so you should add a comment saying so, or re-pingthe reviewer. + +.. _`github`: https://github.com/leapcode/ + +Other methods +------------- + +Feel free to use any other methods like format-patch and mail or whatever method you prefer, although we recommend you follow the same workflow as we do. -- cgit v1.2.3 From c43193f36b69620a5f88ec67c515975819c6b542 Mon Sep 17 00:00:00 2001 From: Ivan Alejandro Date: Thu, 29 Aug 2013 17:19:02 -0300 Subject: Enable password change when soledad is ready. Closes #3610. --- src/leap/bitmask/gui/mainwindow.py | 21 +++++++++++++++++++-- src/leap/bitmask/gui/preferenceswindow.py | 20 ++++++++++++-------- 2 files changed, 31 insertions(+), 10 deletions(-) diff --git a/src/leap/bitmask/gui/mainwindow.py b/src/leap/bitmask/gui/mainwindow.py index 34451928..6d612d4e 100644 --- a/src/leap/bitmask/gui/mainwindow.py +++ b/src/leap/bitmask/gui/mainwindow.py @@ -284,6 +284,7 @@ class MainWindow(QtGui.QMainWindow): # Services signals/slots connection self.new_updates.connect(self._react_to_new_updates) self.soledad_ready.connect(self._start_imap_service) + self.soledad_ready.connect(self._set_soledad_ready) self.mail_client_logged_in.connect(self._fetch_incoming_mail) ################################# end Qt Signals connection ######## @@ -298,6 +299,7 @@ class MainWindow(QtGui.QMainWindow): self._bypass_checks = bypass_checks self._soledad = None + self._soledad_ready = False self._keymanager = None self._imap_service = None @@ -415,11 +417,26 @@ class MainWindow(QtGui.QMainWindow): Displays the preferences window. """ preferences_window = PreferencesWindow( - self, self._srp_auth, self._soledad, - self._settings, self._standalone) + self, self._srp_auth, self._settings, self._standalone) + + if self._soledad_ready: + preferences_window.set_soledad_ready(self._soledad) + else: + self.soledad_ready.connect( + lambda: preferences_window.set_soledad_ready(self._soledad)) preferences_window.show() + def _set_soledad_ready(self): + """ + SLOT + TRIGGERS: + self.soledad_ready + + It sets the soledad object as ready to use. + """ + self._soledad_ready = True + def _uncheck_logger_button(self): """ SLOT diff --git a/src/leap/bitmask/gui/preferenceswindow.py b/src/leap/bitmask/gui/preferenceswindow.py index 05f616b0..17e12304 100644 --- a/src/leap/bitmask/gui/preferenceswindow.py +++ b/src/leap/bitmask/gui/preferenceswindow.py @@ -42,14 +42,12 @@ class PreferencesWindow(QtGui.QDialog): WEAK_PASSWORDS = ("123456", "qweasd", "qwerty", "password") - def __init__(self, parent, srp_auth, soledad, leap_settings, standalone): + def __init__(self, parent, srp_auth, leap_settings, standalone): """ :param parent: parent object of the PreferencesWindow. :parent type: QWidget :param srp_auth: SRPAuth object configured in the main app. :type srp_auth: SRPAuth - :param soledad: Soledad object configured in the main app. - :type soledad: Soledad :param standalone: If True, the application is running as standalone and the preferences dialog should display some messages according to this. @@ -58,9 +56,9 @@ class PreferencesWindow(QtGui.QDialog): QtGui.QDialog.__init__(self, parent) self._srp_auth = srp_auth - self._soledad = soledad self._settings = leap_settings self._standalone = standalone + self._soledad = None # Load UI self.ui = Ui_Preferences() @@ -76,21 +74,23 @@ class PreferencesWindow(QtGui.QDialog): self.ui.cbProvidersServices.currentIndexChanged[unicode].connect( self._populate_services) - parent.soledad_ready.connect(self._soledad_ready) - if not self._settings.get_configured_providers(): self.ui.gbEnabledServices.setEnabled(False) else: self._add_configured_providers() - def _soledad_ready(self): + def set_soledad_ready(self, soledad): """ SLOT TRIGGERS: parent.soledad_ready + It sets the soledad object as ready to use. + + :param soledad: Soledad object configured in the main app. + :type soledad: Soledad """ - self._soledad_ready = True + self._soledad = soledad self.ui.gbPasswordChange.setEnabled(True) def _set_password_change_status(self, status, error=False, success=False): @@ -128,6 +128,10 @@ class PreferencesWindow(QtGui.QDialog): def _change_password(self): """ + SLOT + TRIGGERS: + self.ui.pbChangePassword.clicked + Changes the user's password if the inputboxes are correctly filled. """ username = self._srp_auth.get_username() -- cgit v1.2.3 From cd9eb81ab722bcaf77995cd308fcb8c70cba02cb Mon Sep 17 00:00:00 2001 From: Kali Kaneko Date: Fri, 30 Aug 2013 20:36:52 +0200 Subject: s/bitmask/leap.bitmask in package name ...And this should be fixed forever and ever now. or until we change namespaces/package names again :) --- src/leap/bitmask/util/requirement_checker.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/leap/bitmask/util/requirement_checker.py b/src/leap/bitmask/util/requirement_checker.py index bd3c1412..37e8e693 100644 --- a/src/leap/bitmask/util/requirement_checker.py +++ b/src/leap/bitmask/util/requirement_checker.py @@ -53,7 +53,7 @@ def get_requirements(): if not develop: requires_file_name = os.path.join( 'leap', 'bitmask', 'util', 'reqs.txt') - dist_name = Requirement.parse('bitmask') + dist_name = Requirement.parse('leap.bitmask') try: with resource_stream(dist_name, requires_file_name) as stream: -- cgit v1.2.3 From f29e099d524a39a80fc6225d3547217eefa7fc0f Mon Sep 17 00:00:00 2001 From: Kali Kaneko Date: Fri, 30 Aug 2013 20:52:40 +0200 Subject: fix naming in resolv-update --- pkg/linux/resolv-update | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkg/linux/resolv-update b/pkg/linux/resolv-update index a54802e3..601d3bd2 100755 --- a/pkg/linux/resolv-update +++ b/pkg/linux/resolv-update @@ -20,13 +20,13 @@ function up() { comment=$( cat < Date: Fri, 30 Aug 2013 16:12:52 -0300 Subject: Update preferences ui to select and save gateway. --- src/leap/bitmask/gui/ui/preferences.ui | 199 ++++++++++++++++++--------------- 1 file changed, 108 insertions(+), 91 deletions(-) diff --git a/src/leap/bitmask/gui/ui/preferences.ui b/src/leap/bitmask/gui/ui/preferences.ui index b59990b1..e66a2d68 100644 --- a/src/leap/bitmask/gui/ui/preferences.ui +++ b/src/leap/bitmask/gui/ui/preferences.ui @@ -6,8 +6,8 @@ 0 0 - 453 - 463 + 503 + 529 @@ -18,80 +18,77 @@ :/images/mask-icon.png:/images/mask-icon.png - - + + + + Qt::Vertical + + + + 20 + 40 + + + + + + - false + true - Password Change + Select gateway for provider - - - QFormLayout::ExpandingFieldsGrow - - - - - &Current password: - - - leCurrentPassword - - - - - - - QLineEdit::Password - + + false + + + + + + + <Select provider> + + - - + + - &New password: + &Select provider: - leNewPassword - - - - - - - QLineEdit::Password + cbProvidersGateway - - + + - &Re-enter new password: - - - leNewPassword2 + Select gateway: - - - - QLineEdit::Password - + + + + + Automatic + + - - + + - Change + Save this provider settings - - + + - <Password change status> + < Providers Gateway Status > Qt::AlignCenter @@ -101,7 +98,7 @@ - + Enabled services @@ -158,69 +155,89 @@ - - + + false - Select gateway for provider - - - false + Password Change - + + + QFormLayout::ExpandingFieldsGrow + - + - &Select provider: + &Current password: - cbProvidersGateway + leCurrentPassword - - - - <Select provider> - - + + + QLineEdit::Password + - + - Select gateway: + &New password: + + + leNewPassword - - - - Automatic - - + + + QLineEdit::Password + + + + + + + &Re-enter new password: + + + leNewPassword2 + + + + + + + QLineEdit::Password + + + + + + + Change + + + + + + + <Password change status> + + + Qt::AlignCenter + - - - - Qt::Vertical - - - - 20 - 40 - - - - -- cgit v1.2.3 From f29133e7e2244ef7181685af7d93653cb54562e8 Mon Sep 17 00:00:00 2001 From: Ivan Alejandro Date: Fri, 30 Aug 2013 16:14:06 -0300 Subject: Add config option to set & get preferred gateway. --- src/leap/bitmask/config/leapsettings.py | 36 +++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/src/leap/bitmask/config/leapsettings.py b/src/leap/bitmask/config/leapsettings.py index ca94129e..ad67b29e 100644 --- a/src/leap/bitmask/config/leapsettings.py +++ b/src/leap/bitmask/config/leapsettings.py @@ -66,6 +66,10 @@ class LeapSettings(object): REMEMBER_KEY = "RememberUserAndPass" DEFAULTPROVIDER_KEY = "DefaultProvider" ALERTMISSING_KEY = "AlertMissingScripts" + GATEWAY_KEY = "Gateway" + + # values + GATEWAY_AUTOMATIC = "Automatic" def __init__(self, standalone=False): """ @@ -137,6 +141,38 @@ class LeapSettings(object): return providers + def get_selected_gateway(self, provider): + """ + Returns the configured gateway for the given provider. + + :param provider: provider domain + :type provider: str + + :rtype: str + """ + leap_assert(len(provider) > 0, "We need a nonempty provider") + gateway_key = "{0}/{1}".format(provider, self.GATEWAY_KEY) + gateway = self._settings.value(gateway_key, self.GATEWAY_AUTOMATIC) + + return gateway + + def set_selected_gateway(self, provider, gateway): + """ + Saves the configured gateway for the given provider + + :param provider: provider domain + :type provider: str + + :param gateway: gateway to use as default + :type gateway: str + """ + + leap_assert(len(provider) > 0, "We need a nonempty provider") + leap_assert_type(gateway, (str, unicode)) + + gateway_key = "{0}/{1}".format(provider, self.GATEWAY_KEY) + self._settings.setValue(gateway_key, gateway) + def get_enabled_services(self, provider): """ Returns a list of enabled services for the given provider -- cgit v1.2.3 From 3edf686a911f9fd58a0d66dcc7f2d798f5ab88f7 Mon Sep 17 00:00:00 2001 From: Ivan Alejandro Date: Fri, 30 Aug 2013 16:16:13 -0300 Subject: Add method to return gateways with their names. Also the test code in the bottom was updated to work. --- src/leap/bitmask/services/eip/eipconfig.py | 41 +++++++++++++++++++++++------- 1 file changed, 32 insertions(+), 9 deletions(-) diff --git a/src/leap/bitmask/services/eip/eipconfig.py b/src/leap/bitmask/services/eip/eipconfig.py index 843e7397..1f49f9cd 100644 --- a/src/leap/bitmask/services/eip/eipconfig.py +++ b/src/leap/bitmask/services/eip/eipconfig.py @@ -62,11 +62,12 @@ class VPNGatewaySelector(object): self._eipconfig = eipconfig - def get_gateways(self): + def get_gateways_list(self): """ - Returns the 4 best gateways, sorted by timezone proximity. + Returns the existing gateways, sorted by timezone proximity. - :rtype: list of IPv4Address or IPv6Address object. + :rtype: list of tuples (location, ip) + (str, IPv4Address or IPv6Address object) """ gateways_timezones = [] locations = self._eipconfig.get_locations() @@ -77,19 +78,35 @@ class VPNGatewaySelector(object): gateway_distance = 99 # if hasn't location -> should go last if gateway_location is not None: - gw_offset = int(locations[gateway['location']]['timezone']) + timezone = locations[gateway['location']]['timezone'] + gateway_name = locations[gateway['location']].get('name', None) + if gateway_name is not None: + gateway_location = gateway_name + + gw_offset = int(timezone) if gw_offset in self.equivalent_timezones: gw_offset = self.equivalent_timezones[gw_offset] gateway_distance = self._get_timezone_distance(gw_offset) ip = self._eipconfig.get_gateway_ip(idx) - gateways_timezones.append((ip, gateway_distance)) + gateways_timezones.append((ip, gateway_distance, gateway_location)) - gateways_timezones = sorted(gateways_timezones, - key=lambda gw: gw[1])[:4] + gateways_timezones = sorted(gateways_timezones, key=lambda gw: gw[1]) + + gateways = [] + for ip, distance, location in gateways_timezones: + gateways.append((location, ip)) + + return gateways - gateways = [ip for ip, dist in gateways_timezones] + def get_gateways(self): + """ + Returns the 4 best gateways, sorted by timezone proximity. + + :rtype: list of IPv4Address or IPv6Address object. + """ + gateways = [ip for location, ip in self.get_gateways_list()][:4] return gateways def _get_timezone_distance(self, offset): @@ -246,7 +263,8 @@ if __name__ == "__main__": console.setFormatter(formatter) logger.addHandler(console) - eipconfig = EIPConfig('1') + eipconfig = EIPConfig() + eipconfig.set_api_version('1') try: eipconfig.get_clusters() @@ -255,9 +273,14 @@ if __name__ == "__main__": print "Safe value getting is working" if eipconfig.load("leap/providers/bitmask.net/eip-service.json"): + print "EIPConfig methods" print eipconfig.get_clusters() print eipconfig.get_gateways() print eipconfig.get_locations() print eipconfig.get_openvpn_configuration() print eipconfig.get_serial() print eipconfig.get_version() + print "VPNGatewaySelector methods" + gws = VPNGatewaySelector(eipconfig) + print gws.get_gateways() + print gws.get_gateways_list() -- cgit v1.2.3 From 89e89d5f1bada3dfc65ce44c76b4250ed561d6ab Mon Sep 17 00:00:00 2001 From: Ivan Alejandro Date: Fri, 30 Aug 2013 16:31:32 -0300 Subject: Add gateway selection feature to the preferences. --- src/leap/bitmask/gui/preferenceswindow.py | 156 ++++++++++++++++++++++++++++-- 1 file changed, 149 insertions(+), 7 deletions(-) diff --git a/src/leap/bitmask/gui/preferenceswindow.py b/src/leap/bitmask/gui/preferenceswindow.py index 17e12304..c3c3490b 100644 --- a/src/leap/bitmask/gui/preferenceswindow.py +++ b/src/leap/bitmask/gui/preferenceswindow.py @@ -30,6 +30,7 @@ from leap.bitmask.crypto.srpauth import SRPAuthBadPassword from leap.bitmask.util.password import basic_password_checks from leap.bitmask.services import get_supported from leap.bitmask.config.providerconfig import ProviderConfig +from leap.bitmask.services.eip.eipconfig import EIPConfig, VPNGatewaySelector from leap.bitmask.services import get_service_display_name logger = logging.getLogger(__name__) @@ -54,6 +55,7 @@ class PreferencesWindow(QtGui.QDialog): :type standalone: bool """ QtGui.QDialog.__init__(self, parent) + self.AUTOMATIC_GATEWAY_LABEL = self.tr("Automatic") self._srp_auth = srp_auth self._settings = leap_settings @@ -65,14 +67,19 @@ class PreferencesWindow(QtGui.QDialog): self.ui.setupUi(self) self.ui.lblPasswordChangeStatus.setVisible(False) self.ui.lblProvidersServicesStatus.setVisible(False) + self.ui.lblProvidersGatewayStatus.setVisible(False) self._selected_services = set() - self._provider_config = ProviderConfig() # Connections self.ui.pbChangePassword.clicked.connect(self._change_password) self.ui.cbProvidersServices.currentIndexChanged[unicode].connect( self._populate_services) + self.ui.cbProvidersGateway.currentIndexChanged[unicode].connect( + self._populate_gateways) + + self.ui.cbGateways.currentIndexChanged[unicode].connect( + lambda x: self.ui.lblProvidersGatewayStatus.setVisible(False)) if not self._settings.get_configured_providers(): self.ui.gbEnabledServices.setEnabled(False) @@ -207,6 +214,9 @@ class PreferencesWindow(QtGui.QDialog): :param status: status message to display, can be HTML :type status: str + :param success: is set to True if we should display the + message as green + :type success: bool """ if success: status = "%s" % (status,) @@ -214,6 +224,28 @@ class PreferencesWindow(QtGui.QDialog): self.ui.lblProvidersServicesStatus.setVisible(True) self.ui.lblProvidersServicesStatus.setText(status) + def _set_providers_gateway_status(self, status, success=False, + error=False): + """ + Sets the status label for the gateway change. + + :param status: status message to display, can be HTML + :type status: str + :param success: is set to True if we should display the + message as green + :type success: bool + :param error: is set to True if we should display the + message as red + :type error: bool + """ + if success: + status = "%s" % (status,) + elif error: + status = "%s" % (status,) + + self.ui.lblProvidersGatewayStatus.setVisible(True) + self.ui.lblProvidersGatewayStatus.setText(status) + def _add_configured_providers(self): """ Add the client's configured providers to the providers combo boxes. @@ -250,7 +282,7 @@ class PreferencesWindow(QtGui.QDialog): """ SLOT TRIGGERS: - self.ui.cbProvidersServices.clicked + self.ui.cbProvidersServices.currentIndexChanged[unicode] Loads the services that the provider provides into the UI for the user to enable or disable. @@ -261,10 +293,11 @@ class PreferencesWindow(QtGui.QDialog): # We hide the maybe-visible status label after a change self.ui.lblProvidersServicesStatus.setVisible(False) - provider_config_path = os.path.join( - "leap", "providers", domain, "provider.json") + if not domain: + return - if not domain or not self._provider_config.load(provider_config_path): + provider_config = self._get_provider_config(domain) + if provider_config is None: return # set the proper connection for the 'save' button @@ -276,7 +309,7 @@ class PreferencesWindow(QtGui.QDialog): save_services = partial(self._save_enabled_services, domain) self.ui.pbSaveServices.clicked.connect(save_services) - services = get_supported(self._provider_config.get_services()) + services = get_supported(provider_config.get_services()) services_conf = self._settings.get_enabled_services(domain) # discard changes if other provider is selected @@ -307,7 +340,11 @@ class PreferencesWindow(QtGui.QDialog): def _save_enabled_services(self, provider): """ - Saves the new settings to the configuration file. + SLOT + TRIGGERS: + self.ui.pbSaveServices.clicked + + Saves the new enabled services settings to the configuration file. :param provider: the provider config that we need to save. :type provider: str @@ -319,3 +356,108 @@ class PreferencesWindow(QtGui.QDialog): "Services settings for provider '{0}' saved.".format(provider)) logger.debug(msg) self._set_providers_services_status(msg, success=True) + + def _get_provider_config(self, domain): + """ + Helper to return a valid Provider Config from the domain name. + + :param domain: the domain name of the provider. + :type domain: str + + :rtype: ProviderConfig or None if there is a problem loading the config + """ + provider_config = ProviderConfig() + provider_config_path = os.path.join( + "leap", "providers", domain, "provider.json") + + if not provider_config.load(provider_config_path): + provider_config = None + + return provider_config + + def _save_selected_gateway(self, provider): + """ + SLOT + TRIGGERS: + self.ui.pbSaveGateway.clicked + + Saves the new gateway setting to the configuration file. + + :param provider: the provider config that we need to save. + :type provider: str + """ + gateway = self.ui.cbGateways.currentText() + + if gateway == self.AUTOMATIC_GATEWAY_LABEL: + gateway = self._settings.GATEWAY_AUTOMATIC + else: + idx = self.ui.cbGateways.currentIndex() + gateway = self.ui.cbGateways.itemData(idx) + + self._settings.set_selected_gateway(provider, gateway) + + msg = self.tr( + "Gateway settings for provider '{0}' saved.".format(provider)) + logger.debug(msg) + self._set_providers_gateway_status(msg, success=True) + + def _populate_gateways(self, domain): + """ + SLOT + TRIGGERS: + self.ui.cbProvidersGateway.currentIndexChanged[unicode] + + Loads the gateways that the provider provides into the UI for + the user to select. + + :param domain: the domain of the provider to load gateways from. + :type domain: str + """ + # We hide the maybe-visible status label after a change + self.ui.lblProvidersGatewayStatus.setVisible(False) + + if not domain: + return + + try: + # disconnect prevoiusly connected save method + self.ui.pbSaveGateway.clicked.disconnect() + except RuntimeError: + pass # Signal was not connected + + # set the proper connection for the 'save' button + save_gateway = partial(self._save_selected_gateway, domain) + self.ui.pbSaveGateway.clicked.connect(save_gateway) + + eip_config = EIPConfig() + provider_config = self._get_provider_config(domain) + + eip_config_path = os.path.join("leap", "providers", + domain, "eip-service.json") + api_version = provider_config.get_api_version() + eip_config.set_api_version(api_version) + eip_loaded = eip_config.load(eip_config_path) + + if not eip_loaded or provider_config is None: + self._set_providers_gateway_status( + self.tr("There was a problem with configuration files."), + error=True) + return + + gateways = VPNGatewaySelector(eip_config).get_gateways_list() + logger.debug(gateways) + + self.ui.cbGateways.clear() + self.ui.cbGateways.addItem(self.AUTOMATIC_GATEWAY_LABEL) + + # Add the available gateways and + # select the one stored in configuration file. + selected_gateway = self._settings.get_selected_gateway(domain) + index = 0 + for idx, (gw_name, gw_ip) in enumerate(gateways): + gateway = "{0} ({1})".format(gw_name, gw_ip) + self.ui.cbGateways.addItem(gateway, gw_ip) + if gw_ip == selected_gateway: + index = idx + 1 + + self.ui.cbGateways.setCurrentIndex(index) -- cgit v1.2.3 From 07da9729f4cb3d62361c226e772aa077bf07cfa7 Mon Sep 17 00:00:00 2001 From: Ivan Alejandro Date: Fri, 30 Aug 2013 16:20:34 -0300 Subject: Start the vpn with the user configured gateway. --- src/leap/bitmask/services/eip/vpnlaunchers.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/leap/bitmask/services/eip/vpnlaunchers.py b/src/leap/bitmask/services/eip/vpnlaunchers.py index f8c51ad8..15221c48 100644 --- a/src/leap/bitmask/services/eip/vpnlaunchers.py +++ b/src/leap/bitmask/services/eip/vpnlaunchers.py @@ -33,6 +33,7 @@ except ImportError: from abc import ABCMeta, abstractmethod from functools import partial +from leap.bitmask.config.leapsettings import LeapSettings from leap.bitmask.config.providerconfig import ProviderConfig from leap.bitmask.services.eip.eipconfig import EIPConfig, VPNGatewaySelector from leap.bitmask.util import first @@ -414,8 +415,15 @@ class LinuxVPNLauncher(VPNLauncher): if openvpn_verb is not None: args += ['--verb', '%d' % (openvpn_verb,)] - gateway_selector = VPNGatewaySelector(eipconfig) - gateways = gateway_selector.get_gateways() + gateways = [] + leap_settings = LeapSettings(ProviderConfig.standalone) + gateway_conf = leap_settings.get_selected_gateway() + + if gateway_conf == leap_settings.GATEWAY_AUTOMATIC: + gateway_selector = VPNGatewaySelector(eipconfig) + gateways = gateway_selector.get_gateways() + else: + gateways = [gateway_conf] if not gateways: logger.error('No gateway was found!') -- cgit v1.2.3 From 294e70f80ac8feb7ecac14691051037bf0c84afa Mon Sep 17 00:00:00 2001 From: Ivan Alejandro Date: Fri, 30 Aug 2013 16:05:01 -0300 Subject: Add changelog. Closes #3505. --- changes/feature-3505_preferences-select-gateway-manually | 1 + 1 file changed, 1 insertion(+) create mode 100644 changes/feature-3505_preferences-select-gateway-manually diff --git a/changes/feature-3505_preferences-select-gateway-manually b/changes/feature-3505_preferences-select-gateway-manually new file mode 100644 index 00000000..de414e6b --- /dev/null +++ b/changes/feature-3505_preferences-select-gateway-manually @@ -0,0 +1 @@ + o Add option to select gateway manually in the preferences panel. Closes #3505. -- cgit v1.2.3 From dce567ef1acdc0b8dcffa1f4f0ab0cddd02e9227 Mon Sep 17 00:00:00 2001 From: Kali Kaneko Date: Fri, 30 Aug 2013 21:48:14 +0200 Subject: add notes about version compat --- changes/VERSION_COMPAT | 10 ++++++++++ docs/release_checklist.wiki | 4 +++- 2 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 changes/VERSION_COMPAT diff --git a/changes/VERSION_COMPAT b/changes/VERSION_COMPAT new file mode 100644 index 00000000..32391745 --- /dev/null +++ b/changes/VERSION_COMPAT @@ -0,0 +1,10 @@ +################################################# +# This file keeps track of the recent changes +# introduced in internal leap dependencies. +# Add your changes here so we can properly update +# requirements.pip during the release process. +################################################# + +leap.common>=0.3.2 +# leap.common.config.get_path_prefix + diff --git a/docs/release_checklist.wiki b/docs/release_checklist.wiki index 8987f0b8..e766d6f8 100644 --- a/docs/release_checklist.wiki +++ b/docs/release_checklist.wiki @@ -17,7 +17,9 @@ * [ ] Update relnotes.txt if needed. * [ ] git rm changes/* * [ ] git commit -av - * [ ] Update dependencies on the current package in the packages that remain if needed (that's why the order). + * [ ] Review pkg/requirements.pip for everything and update if needed (that's why the order). + - See whatever has been introduced in changes/VERSION_COMPAT + - Reset changes/VERSION_COMPAT * [ ] git tag -s X.Y.Z (note the -s so that it's a signed tag) The message should be something like: Tag version X.Y.Z * [ ] git push origin X.Y.Z * [ ] git checkout master && git pull origin master && git merge release-X.Y.Z && git push origin master -- cgit v1.2.3 From 8df63e671ee971e5f987320482f020ad7ceeeb6b Mon Sep 17 00:00:00 2001 From: Kali Kaneko Date: Fri, 30 Aug 2013 21:50:35 +0200 Subject: remove reqs from vcs --- .gitignore | 12 ++++-------- src/leap/bitmask/util/reqs.txt | 14 -------------- 2 files changed, 4 insertions(+), 22 deletions(-) delete mode 100644 src/leap/bitmask/util/reqs.txt diff --git a/.gitignore b/.gitignore index 18bfcd69..ecec4091 100644 --- a/.gitignore +++ b/.gitignore @@ -12,7 +12,6 @@ ui_*.py bin/ build/ core -debian/python-leap-client/ dist/ docs/_build docs/covhtml @@ -20,15 +19,12 @@ include/ lib/ local/ share/ -src/leap/util/reqs.txt -src/leap.egg-info/ -src/leap_client.egg-info -src/leap/_branding.py -src/leap/certs/*.pem -src/*.egg-info -src/pysqlcipher pkg/osx/dist pkg/osx/build + +src/*.egg-info +src/pysqlcipher +src/leap/bitmask/util/reqs.txt MANIFEST _trial_temp* config/* diff --git a/src/leap/bitmask/util/reqs.txt b/src/leap/bitmask/util/reqs.txt deleted file mode 100644 index 0bcf85dc..00000000 --- a/src/leap/bitmask/util/reqs.txt +++ /dev/null @@ -1,14 +0,0 @@ -requests -srp>=1.0.2 -pyopenssl -keyring -python-dateutil -psutil -ipaddr -twisted -qt4reactor -python-gnupg -leap.common>=0.2.5 -leap.soledad>=0.1.0 -mock -oauth \ No newline at end of file -- cgit v1.2.3 From 68f9095533af0623a3e2555fe860a60667351a6d Mon Sep 17 00:00:00 2001 From: Ivan Alejandro Date: Fri, 30 Aug 2013 18:06:19 -0300 Subject: Fix, method name bug. --- src/leap/bitmask/gui/preferenceswindow.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/leap/bitmask/gui/preferenceswindow.py b/src/leap/bitmask/gui/preferenceswindow.py index c3c3490b..1becfb18 100644 --- a/src/leap/bitmask/gui/preferenceswindow.py +++ b/src/leap/bitmask/gui/preferenceswindow.py @@ -126,7 +126,7 @@ class PreferencesWindow(QtGui.QDialog): :type disable: bool """ if disable: - self._set_password_change_disable(self.tr("Changing password...")) + self._set_password_change_status(self.tr("Changing password...")) self.ui.leCurrentPassword.setEnabled(not disable) self.ui.leNewPassword.setEnabled(not disable) -- cgit v1.2.3 From 579f06a924767962aac7d23df21d0cf2aa43a7bd Mon Sep 17 00:00:00 2001 From: Kali Kaneko Date: Sun, 1 Sep 2013 19:21:57 +0200 Subject: Fix arguments passed to get_selected_gateway() Closes: #3658 --- src/leap/bitmask/services/eip/vpnlaunchers.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/leap/bitmask/services/eip/vpnlaunchers.py b/src/leap/bitmask/services/eip/vpnlaunchers.py index 15221c48..5921882b 100644 --- a/src/leap/bitmask/services/eip/vpnlaunchers.py +++ b/src/leap/bitmask/services/eip/vpnlaunchers.py @@ -417,7 +417,8 @@ class LinuxVPNLauncher(VPNLauncher): gateways = [] leap_settings = LeapSettings(ProviderConfig.standalone) - gateway_conf = leap_settings.get_selected_gateway() + domain = providerconfig.get_domain() + gateway_conf = leap_settings.get_selected_gateway(domain) if gateway_conf == leap_settings.GATEWAY_AUTOMATIC: gateway_selector = VPNGatewaySelector(eipconfig) -- cgit v1.2.3 From 2085475e3b5ac44b82d8bf7d98b30a67e5c42a61 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1s=20Touceda?= Date: Sun, 1 Sep 2013 16:10:04 -0300 Subject: Improve mail UI until we have a proper state machine --- src/leap/bitmask/gui/statuspanel.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/leap/bitmask/gui/statuspanel.py b/src/leap/bitmask/gui/statuspanel.py index 9352eb04..49d7e24a 100644 --- a/src/leap/bitmask/gui/statuspanel.py +++ b/src/leap/bitmask/gui/statuspanel.py @@ -591,6 +591,11 @@ class StatusPanelWidget(QtGui.QWidget): :param req: Request type :type req: leap.common.events.events_pb2.SignalRequest """ + # We want to ignore this kind of events once everything has + # started + if self._smtp_started and self._imap_started: + return + self.ui.lblMailStatus.setText(self.tr("Starting...")) ext_status = "" -- cgit v1.2.3 From 8856f3fd19fa1617b716ce1c8b9d3a3281a8398d Mon Sep 17 00:00:00 2001 From: Ivan Alejandro Date: Mon, 2 Sep 2013 11:42:01 -0300 Subject: Fix typo, closes #3615. --- changes/bug_3615-wizard-typo | 1 + src/leap/bitmask/gui/ui/wizard.ui | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) create mode 100644 changes/bug_3615-wizard-typo diff --git a/changes/bug_3615-wizard-typo b/changes/bug_3615-wizard-typo new file mode 100644 index 00000000..89e18174 --- /dev/null +++ b/changes/bug_3615-wizard-typo @@ -0,0 +1 @@ + o Fix typo in wizard: stablish -> establish. Closes #3615. diff --git a/src/leap/bitmask/gui/ui/wizard.ui b/src/leap/bitmask/gui/ui/wizard.ui index 3b8f1215..570c01a9 100644 --- a/src/leap/bitmask/gui/ui/wizard.ui +++ b/src/leap/bitmask/gui/ui/wizard.ui @@ -183,7 +183,7 @@ - Can we stablish a secure connection? + Can we establish a secure connection? -- cgit v1.2.3 From eb01c527bcfa3152eab6601fde88236f7866c2f1 Mon Sep 17 00:00:00 2001 From: Ivan Alejandro Date: Mon, 2 Sep 2013 11:32:13 -0300 Subject: Use configured gateway in all platforms. Also use python 2.6 compatible str.format. --- src/leap/bitmask/services/eip/vpnlaunchers.py | 39 +++++++++++++++++++++------ 1 file changed, 31 insertions(+), 8 deletions(-) diff --git a/src/leap/bitmask/services/eip/vpnlaunchers.py b/src/leap/bitmask/services/eip/vpnlaunchers.py index 5921882b..a9213a9a 100644 --- a/src/leap/bitmask/services/eip/vpnlaunchers.py +++ b/src/leap/bitmask/services/eip/vpnlaunchers.py @@ -430,7 +430,7 @@ class LinuxVPNLauncher(VPNLauncher): logger.error('No gateway was found!') raise VPNLauncherException(self.tr('No gateway was found!')) - logger.debug("Using gateways ips: {}".format(', '.join(gateways))) + logger.debug("Using gateways ips: {0}".format(', '.join(gateways))) for gw in gateways: args += ['--remote', gw, '1194', 'udp'] @@ -678,11 +678,22 @@ class DarwinVPNLauncher(VPNLauncher): if openvpn_verb is not None: args += ['--verb', '%d' % (openvpn_verb,)] - gateway_selector = VPNGatewaySelector(eipconfig) - gateways = gateway_selector.get_gateways() + gateways = [] + leap_settings = LeapSettings(ProviderConfig.standalone) + domain = providerconfig.get_domain() + gateway_conf = leap_settings.get_selected_gateway(domain) + + if gateway_conf == leap_settings.GATEWAY_AUTOMATIC: + gateway_selector = VPNGatewaySelector(eipconfig) + gateways = gateway_selector.get_gateways() + else: + gateways = [gateway_conf] + + if not gateways: + logger.error('No gateway was found!') + raise VPNLauncherException(self.tr('No gateway was found!')) - logger.debug("Using gateways ips: {gw}".format( - gw=', '.join(gateways))) + logger.debug("Using gateways ips: {0}".format(', '.join(gateways))) for gw in gateways: args += ['--remote', gw, '1194', 'udp'] @@ -850,10 +861,22 @@ class WindowsVPNLauncher(VPNLauncher): if openvpn_verb is not None: args += ['--verb', '%d' % (openvpn_verb,)] - gateway_selector = VPNGatewaySelector(eipconfig) - gateways = gateway_selector.get_gateways() + gateways = [] + leap_settings = LeapSettings(ProviderConfig.standalone) + domain = providerconfig.get_domain() + gateway_conf = leap_settings.get_selected_gateway(domain) + + if gateway_conf == leap_settings.GATEWAY_AUTOMATIC: + gateway_selector = VPNGatewaySelector(eipconfig) + gateways = gateway_selector.get_gateways() + else: + gateways = [gateway_conf] + + if not gateways: + logger.error('No gateway was found!') + raise VPNLauncherException(self.tr('No gateway was found!')) - logger.debug("Using gateways ips: {}".format(', '.join(gateways))) + logger.debug("Using gateways ips: {0}".format(', '.join(gateways))) for gw in gateways: args += ['--remote', gw, '1194', 'udp'] -- cgit v1.2.3 From c6baec1cc4e5b5aea2690569cb1be64b983d6986 Mon Sep 17 00:00:00 2001 From: Kali Kaneko Date: Mon, 2 Sep 2013 01:07:22 +0200 Subject: emit failed for all kinds of socket error --- changes/bug-fail-soledad-when-socketerr | 1 + src/leap/bitmask/services/soledad/soledadbootstrapper.py | 3 +-- 2 files changed, 2 insertions(+), 2 deletions(-) create mode 100644 changes/bug-fail-soledad-when-socketerr diff --git a/changes/bug-fail-soledad-when-socketerr b/changes/bug-fail-soledad-when-socketerr new file mode 100644 index 00000000..2bb6696a --- /dev/null +++ b/changes/bug-fail-soledad-when-socketerr @@ -0,0 +1 @@ + o Make soledad emit failed signal for all kinds of socket error. diff --git a/src/leap/bitmask/services/soledad/soledadbootstrapper.py b/src/leap/bitmask/services/soledad/soledadbootstrapper.py index 2419fc0d..3bbfea85 100644 --- a/src/leap/bitmask/services/soledad/soledadbootstrapper.py +++ b/src/leap/bitmask/services/soledad/soledadbootstrapper.py @@ -159,8 +159,7 @@ class SoledadBootstrapper(AbstractBootstrapper): self.soledad_timeout.emit() except socket.error as exc: logger.error("Socket error while initializing soledad") - if exc.errno in (111, ): - self.soledad_failed.emit() + self.soledad_failed.emit() except u1db_errors.Unauthorized: logger.error("Error while initializing soledad " "(unauthorized).") -- cgit v1.2.3 From 4b3f00962cbce75f5120c0d370e03c3007dfe92d Mon Sep 17 00:00:00 2001 From: Kali Kaneko Date: Mon, 2 Sep 2013 13:40:17 +0200 Subject: Add a selective filter for leap logs. Closes: #3504 --- changes/feature_3504_add_log_silencer | 1 + src/leap/bitmask/app.py | 11 +++- src/leap/bitmask/util/leap_log_handler.py | 3 + src/leap/bitmask/util/log_silencer.py | 95 +++++++++++++++++++++++++++++++ 4 files changed, 108 insertions(+), 2 deletions(-) create mode 100644 changes/feature_3504_add_log_silencer create mode 100644 src/leap/bitmask/util/log_silencer.py diff --git a/changes/feature_3504_add_log_silencer b/changes/feature_3504_add_log_silencer new file mode 100644 index 00000000..7c551162 --- /dev/null +++ b/changes/feature_3504_add_log_silencer @@ -0,0 +1 @@ + o Allow to selectively silence logs from different leap components. Closes: #3504 diff --git a/src/leap/bitmask/app.py b/src/leap/bitmask/app.py index 6ffa1d25..0dce5e61 100644 --- a/src/leap/bitmask/app.py +++ b/src/leap/bitmask/app.py @@ -25,6 +25,7 @@ from functools import partial from PySide import QtCore, QtGui from leap.bitmask.util import leap_argparse +from leap.bitmask.util import log_silencer from leap.bitmask.util.leap_log_handler import LeapLogHandler from leap.bitmask.util.streamtologger import StreamToLogger from leap.common.events import server as event_server @@ -51,7 +52,7 @@ def install_qtreactor(logger): logger.debug("Qt4 reactor installed") -def add_logger_handlers(debug=False, logfile=None): +def add_logger_handlers(debug=False, logfile=None, standalone=False): """ Create the logger and attach the handlers. @@ -71,6 +72,7 @@ def add_logger_handlers(debug=False, logfile=None): # Create logger and formatter logger = logging.getLogger(name='leap') logger.setLevel(level) + log_format = '%(asctime)s - %(name)s - %(levelname)s - %(message)s' formatter = logging.Formatter(log_format) @@ -78,12 +80,16 @@ def add_logger_handlers(debug=False, logfile=None): console = logging.StreamHandler() console.setLevel(level) console.setFormatter(formatter) + + silencer = log_silencer.SelectiveSilencerFilter(standalone=standalone) + console.addFilter(silencer) logger.addHandler(console) logger.debug('Console handler plugged!') # LEAP custom handler leap_handler = LeapLogHandler() leap_handler.setLevel(level) + leap_handler.addFilter(silencer) logger.addHandler(leap_handler) logger.debug('Leap handler plugged!') @@ -93,6 +99,7 @@ def add_logger_handlers(debug=False, logfile=None): fileh = logging.FileHandler(logfile) fileh.setLevel(logging.DEBUG) fileh.setFormatter(formatter) + fileh.addFilter(silencer) logger.addHandler(fileh) logger.debug('File handler plugged!') @@ -155,7 +162,7 @@ def main(): # pylint: avoid unused import assert(locale_rc) - logger = add_logger_handlers(debug, logfile) + logger = add_logger_handlers(debug, logfile, standalone) replace_stdout_stderr_with_logging(logger) if not we_are_the_one_and_only(): diff --git a/src/leap/bitmask/util/leap_log_handler.py b/src/leap/bitmask/util/leap_log_handler.py index 9adb21a5..98924c12 100644 --- a/src/leap/bitmask/util/leap_log_handler.py +++ b/src/leap/bitmask/util/leap_log_handler.py @@ -90,6 +90,9 @@ class HandlerAdapter(object): def setLevel(self, *args, **kwargs): return self._handler.setLevel(*args, **kwargs) + def addFilter(self, *args, **kwargs): + return self._handler.addFilter(*args, **kwargs) + def handle(self, *args, **kwargs): return self._handler.handle(*args, **kwargs) diff --git a/src/leap/bitmask/util/log_silencer.py b/src/leap/bitmask/util/log_silencer.py new file mode 100644 index 00000000..09aa2cff --- /dev/null +++ b/src/leap/bitmask/util/log_silencer.py @@ -0,0 +1,95 @@ +# -*- coding: utf-8 -*- +# log_silencer.py +# Copyright (C) 2013 LEAP +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +""" +Filter for leap logs. +""" +import logging +import os +import re + +from leap.common.config import get_path_prefix + + +class SelectiveSilencerFilter(logging.Filter): + """ + Configurable filter for root leap logger. + + If you want to ignore components from the logging, just add them, + one by line, to ~/.config/leap/leap.dev.conf + """ + # TODO we can augment this by properly parsing the log-silencer file + # and having different sections: ignore, levels, ... + + # TODO use ConfigParser to unify sections [log-ignore] [log-debug] etc + + CONFIG_NAME = "leap.dev.conf" + + # Components to be completely silenced in the main bitmask logs. + # You probably should think twice before adding a component to + # the tuple below. Only very well tested components should go here, and + # only in those cases in which we gain more from silencing them than from + # having their logs into the main log file that the user will likely send + # to us. + SILENCER_RULES = ( + 'leap.common.events', + ) + + def __init__(self, standalone=False): + """ + Tries to load silencer rules from the default path, + or load from the SILENCER_RULES tuple if not found. + """ + self.standalone = standalone + self.rules = None + if os.path.isfile(self._rules_path): + self.rules = self._load_rules() + if not self.rules: + self.rules = self.SILENCER_RULES + + @property + def _rules_path(self): + """ + The configuration file for custom ignore rules. + """ + return os.path.join( + get_path_prefix(standalone=self.standalone), + "leap", self.CONFIG_NAME) + + def _load_rules(self): + """ + Loads a list of paths to be ignored from the logging. + """ + lines = open(self._rules_path).readlines() + return map(lambda line: re.sub('\s', '', line), + lines) + + def filter(self, record): + """ + Implements the filter functionality for this Filter + + :param record: the record to be examined + :type record: logging.LogRecord + :returns: a bool indicating whether the record should be logged or not. + :rtype: bool + """ + if not self.rules: + return True + logger_path = record.name + for path in self.rules: + if logger_path.startswith(path): + return False + return True -- cgit v1.2.3 From 0cacbe7c8dae97a04654c2cca5e928dfa9e3741d Mon Sep 17 00:00:00 2001 From: Ivan Alejandro Date: Mon, 2 Sep 2013 14:46:38 -0300 Subject: Fix local offset calculation. Closes #3595. Python returns the timezone with the opposed sign to the standard notation. --- changes/bug-3595_fix-gateway-selection-problem | 1 + src/leap/bitmask/services/eip/eipconfig.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) create mode 100644 changes/bug-3595_fix-gateway-selection-problem diff --git a/changes/bug-3595_fix-gateway-selection-problem b/changes/bug-3595_fix-gateway-selection-problem new file mode 100644 index 00000000..7225eed0 --- /dev/null +++ b/changes/bug-3595_fix-gateway-selection-problem @@ -0,0 +1 @@ + o Fix gateway selection problem. Closes 3595. diff --git a/src/leap/bitmask/services/eip/eipconfig.py b/src/leap/bitmask/services/eip/eipconfig.py index 1f49f9cd..1cb7419e 100644 --- a/src/leap/bitmask/services/eip/eipconfig.py +++ b/src/leap/bitmask/services/eip/eipconfig.py @@ -141,7 +141,7 @@ class VPNGatewaySelector(object): if time.daylight: local_offset = time.altzone - return local_offset / 3600 + return -local_offset / 3600 class EIPConfig(BaseConfig): -- cgit v1.2.3 From e4e79e29c01e6389d37d12ed72b0ba9f972d2ede Mon Sep 17 00:00:00 2001 From: Ivan Alejandro Date: Mon, 2 Sep 2013 15:06:01 -0300 Subject: Display correct service name in wizard. --- changes/bug-3657_display-correct-service-name-in-wiard | 1 + src/leap/bitmask/config/providerconfig.py | 10 +++++++--- src/leap/bitmask/services/__init__.py | 10 +++++++--- 3 files changed, 15 insertions(+), 6 deletions(-) create mode 100644 changes/bug-3657_display-correct-service-name-in-wiard diff --git a/changes/bug-3657_display-correct-service-name-in-wiard b/changes/bug-3657_display-correct-service-name-in-wiard new file mode 100644 index 00000000..4fe3d0b1 --- /dev/null +++ b/changes/bug-3657_display-correct-service-name-in-wiard @@ -0,0 +1 @@ + o Display Encrypted Mail instead of mx in wizard. Closes #3657. diff --git a/src/leap/bitmask/config/providerconfig.py b/src/leap/bitmask/config/providerconfig.py index c65932be..a7808399 100644 --- a/src/leap/bitmask/config/providerconfig.py +++ b/src/leap/bitmask/config/providerconfig.py @@ -24,6 +24,7 @@ import os from leap.bitmask.config.provider_spec import leap_provider_spec from leap.common.check import leap_check from leap.common.config.baseconfig import BaseConfig, LocalizedKey +from leap.bitmask.services import get_service_display_name logger = logging.getLogger(__name__) @@ -130,9 +131,11 @@ class ProviderConfig(BaseConfig): Returns a string with the available services in the current provider, ready to be shown to the user. """ - services_str = ", ".join(self.get_services()) - services_str = services_str.replace( - "openvpn", "Encrypted Internet") + services = [] + for service in self.get_services(): + services.append(get_service_display_name(service)) + + services_str = ", ".join(services) return services_str def get_ca_cert_path(self, about_to_download=False): @@ -216,3 +219,4 @@ if __name__ == "__main__": print provider.get_languages() print provider.get_name() print provider.get_services() + print provider.get_services_string() diff --git a/src/leap/bitmask/services/__init__.py b/src/leap/bitmask/services/__init__.py index 924ca547..339f9cc6 100644 --- a/src/leap/bitmask/services/__init__.py +++ b/src/leap/bitmask/services/__init__.py @@ -26,6 +26,8 @@ DEPLOYED = ["openvpn", "mx"] def get_service_display_name(service, standalone=False): """ Returns the name to display of the given service. + If there is no configured name for that service, then returns the same + parameter :param service: the 'machine' service name :type service: str @@ -42,8 +44,10 @@ def get_service_display_name(service, standalone=False): EIP_LABEL = _tr("Encrypted Internet") MX_LABEL = _tr("Encrypted Mail") - service_display = [EIP_LABEL, MX_LABEL] - service_config = ["openvpn", "mx"] + service_display = { + "openvpn": EIP_LABEL, + "mx": MX_LABEL + } # If we need to add a warning about eip needing # administrative permissions to start. That can be either @@ -52,7 +56,7 @@ def get_service_display_name(service, standalone=False): if standalone or is_missing_policy_permissions(): EIP_LABEL += " " + _tr("(will need admin password to start)") - return service_display[service_config.index(service)] + return service_display.get(service, service) def get_supported(services): -- cgit v1.2.3 From 99667150fc48841742f97de83c11bb97b0e8882a Mon Sep 17 00:00:00 2001 From: Kali Kaneko Date: Tue, 3 Sep 2013 11:13:47 +0200 Subject: Logout stops mail services. Closes: #3553 --- changes/VERSION_COMPAT | 7 +++ changes/bug_3553_logout-stop-mail | 1 + src/leap/bitmask/gui/mainwindow.py | 88 ++++++++++++++++++++++++-------------- 3 files changed, 65 insertions(+), 31 deletions(-) create mode 100644 changes/bug_3553_logout-stop-mail diff --git a/changes/VERSION_COMPAT b/changes/VERSION_COMPAT index 32391745..cd6e4ef1 100644 --- a/changes/VERSION_COMPAT +++ b/changes/VERSION_COMPAT @@ -3,8 +3,15 @@ # introduced in internal leap dependencies. # Add your changes here so we can properly update # requirements.pip during the release process. +# (leave header when resetting) ################################################# +# +# BEGIN DEPENDENCY LIST ------------------------- +# leap.foo.bar>=x.y.z leap.common>=0.3.2 # leap.common.config.get_path_prefix +# +leap.mail>=0.3.2 +# smtp returns factory diff --git a/changes/bug_3553_logout-stop-mail b/changes/bug_3553_logout-stop-mail new file mode 100644 index 00000000..ee898137 --- /dev/null +++ b/changes/bug_3553_logout-stop-mail @@ -0,0 +1 @@ + o Logout stops imap and smtp services. Closes: #3553 diff --git a/src/leap/bitmask/gui/mainwindow.py b/src/leap/bitmask/gui/mainwindow.py index 6d612d4e..7a94fd0f 100644 --- a/src/leap/bitmask/gui/mainwindow.py +++ b/src/leap/bitmask/gui/mainwindow.py @@ -14,9 +14,8 @@ # # You should have received a copy of the GNU General Public License # along with this program. If not, see . - """ -Main window for the leap client +Main window for Bitmask. """ import logging import os @@ -102,6 +101,7 @@ class MainWindow(QtGui.QMainWindow): raise_window = QtCore.Signal([]) soledad_ready = QtCore.Signal([]) mail_client_logged_in = QtCore.Signal([]) + logout = QtCore.Signal([]) # We use this flag to detect abnormal terminations user_stopped_eip = False @@ -286,6 +286,8 @@ class MainWindow(QtGui.QMainWindow): self.soledad_ready.connect(self._start_imap_service) self.soledad_ready.connect(self._set_soledad_ready) self.mail_client_logged_in.connect(self._fetch_incoming_mail) + self.logout.connect(self._stop_imap_service) + self.logout.connect(self._stop_smtp_service) ################################# end Qt Signals connection ######## @@ -301,6 +303,7 @@ class MainWindow(QtGui.QMainWindow): self._soledad = None self._soledad_ready = False self._keymanager = None + self._smtp_service = None self._imap_service = None self._login_defer = None @@ -909,7 +912,7 @@ class MainWindow(QtGui.QMainWindow): self._srp_auth.logout_finished.connect( self._done_logging_out) - # TODO: Add errback! + # TODO Add errback! self._login_defer = self._srp_auth.authenticate(username, password) else: self._login_widget.set_status( @@ -976,7 +979,7 @@ class MainWindow(QtGui.QMainWindow): """ passed = data[self._soledad_bootstrapper.PASSED_KEY] if not passed: - # TODO: display in the GUI: + # TODO display in the GUI: # should pass signal to a slot in status_panel # that sets the global status logger.error("Soledad failed to start: %s" % @@ -1037,13 +1040,13 @@ class MainWindow(QtGui.QMainWindow): True) else: if self._enabled_services.count(self.MX_SERVICE) > 0: - pass # TODO: show MX status + pass # TODO show MX status #self._status_panel.set_eip_status( # self.tr("%s does not support MX") % # (self._provider_config.get_domain(),), # error=True) else: - pass # TODO: show MX status + pass # TODO show MX status #self._status_panel.set_eip_status( # self.tr("MX is disabled")) @@ -1070,25 +1073,43 @@ class MainWindow(QtGui.QMainWindow): logger.debug("Done bootstrapping SMTP") hosts = self._smtp_config.get_hosts() - # TODO: handle more than one host and define how to choose + # TODO handle more than one host and define how to choose if len(hosts) > 0: hostname = hosts.keys()[0] logger.debug("Using hostname %s for SMTP" % (hostname,)) host = hosts[hostname][self.IP_KEY].encode("utf-8") port = hosts[hostname][self.PORT_KEY] - # TODO: pick local smtp port in a better way - # TODO: Make the encrypted_only configurable + # TODO move the start to _start_smtp_service + + # TODO Make the encrypted_only configurable + # TODO pick local smtp port in a better way + # TODO remove hard-coded port and let leap.mail set + # the specific default. from leap.mail.smtp import setup_smtp_relay client_cert = self._eip_config.get_client_cert_path( self._provider_config) - setup_smtp_relay(port=2013, - keymanager=self._keymanager, - smtp_host=host, - smtp_port=port, - smtp_cert=client_cert, - smtp_key=client_cert, - encrypted_only=False) + self._smtp_service = setup_smtp_relay( + port=2013, + keymanager=self._keymanager, + smtp_host=host, + smtp_port=port, + smtp_cert=client_cert, + smtp_key=client_cert, + encrypted_only=False) + + def _stop_smtp_service(self): + """ + SLOT + TRIGGERS: + self.logout + """ + # There is a subtle difference here: + # we are stopping the factory for the smtp service here, + # but in the imap case we are just stopping the fetcher. + if self._smtp_service is not None: + logger.debug('Stopping smtp service.') + self._smtp_service.doStop() ################################################################### # Service control methods: imap @@ -1097,7 +1118,7 @@ class MainWindow(QtGui.QMainWindow): """ SLOT TRIGGERS: - soledad_ready + self.soledad_ready """ if self._provider_config.provides_mx() and \ self._enabled_services.count(self.MX_SERVICE) > 0: @@ -1106,17 +1127,6 @@ class MainWindow(QtGui.QMainWindow): self._imap_service = imap.start_imap_service( self._soledad, self._keymanager) - else: - if self._enabled_services.count(self.MX_SERVICE) > 0: - pass # TODO: show MX status - #self._status_panel.set_eip_status( - # self.tr("%s does not support MX") % - # (self._provider_config.get_domain(),), - # error=True) - else: - pass # TODO: show MX status - #self._status_panel.set_eip_status( - # self.tr("MX is disabled")) def _on_mail_client_logged_in(self, req): """ @@ -1128,13 +1138,27 @@ class MainWindow(QtGui.QMainWindow): """ SLOT TRIGGERS: - mail_client_logged_in + self.mail_client_logged_in """ # TODO have a mutex over fetch operation. if self._imap_service: logger.debug('Client connected, fetching mail...') self._imap_service.fetch() + def _stop_imap_service(self): + """ + SLOT + TRIGGERS: + self.logout + """ + # There is a subtle difference here: + # we are just stopping the fetcher here, + # but in the smtp case we are stopping the factory. + # We should homogenize both services. + if self._imap_service is not None: + logger.debug('Stopping imap service.') + self._imap_service.stop() + # end service control methods (imap) ################################################################### @@ -1146,7 +1170,8 @@ class MainWindow(QtGui.QMainWindow): :rtype: tuple (str, str) (host, port) """ - # TODO: make this properly multiplatform + # TODO make this properly multiplatform + # TODO get this out of gui/ if platform.system() == "Windows": host = "localhost" @@ -1399,6 +1424,7 @@ class MainWindow(QtGui.QMainWindow): # XXX: If other defers are doing authenticated stuff, this # might conflict with those. CHECK! threads.deferToThread(self._srp_auth.logout) + self.logout.emit() def _done_logging_out(self, ok, message): """ @@ -1573,7 +1599,7 @@ class MainWindow(QtGui.QMainWindow): """ Cleanup and tidely close the main window before quitting. """ - # TODO: separate the shutting down of services from the + # TODO separate the shutting down of services from the # UI stuff. self._cleanup_and_quit() -- cgit v1.2.3 From 7511d3ffe98602c979a80972e0ba67b2a0e54310 Mon Sep 17 00:00:00 2001 From: Ivan Alejandro Date: Tue, 3 Sep 2013 15:30:53 -0300 Subject: Remove last page from wizard. Also remove the globe image because is no longer needed. --- LICENSE | 6 -- changes/feature-3616_remove-last-page-from-wizard | 1 + data/images/Globe.png | Bin 22470 -> 0 bytes src/leap/bitmask/gui/ui/wizard.ui | 91 ---------------------- src/leap/bitmask/gui/wizard.py | 3 +- 5 files changed, 2 insertions(+), 99 deletions(-) create mode 100644 changes/feature-3616_remove-last-page-from-wizard delete mode 100644 data/images/Globe.png diff --git a/LICENSE b/LICENSE index bfd516bd..bca70598 100644 --- a/LICENSE +++ b/LICENSE @@ -686,12 +686,6 @@ License: GNU General Public License - http://en.wikipedia.org/wiki/GNU_General_P WebSite: http://wefunction.com/ IconPackage: WooFunction icon pack - http://www.iconspedia.com/pack/woofunction-icons-4136/ --- -data/images/Globe.png - -Author: Everaldo Coelho -License: LGPL - http://www.gnu.org/licenses/lgpl.html -WebSite: http://www.everaldo.com/ ---- data/images/oxygen-icons/ The following icons were created based on 'mail-unread.png' from oxygen: diff --git a/changes/feature-3616_remove-last-page-from-wizard b/changes/feature-3616_remove-last-page-from-wizard new file mode 100644 index 00000000..cc02c02c --- /dev/null +++ b/changes/feature-3616_remove-last-page-from-wizard @@ -0,0 +1 @@ + o Remove last page from wizard. Closes #3616. diff --git a/data/images/Globe.png b/data/images/Globe.png deleted file mode 100644 index 7549433b..00000000 Binary files a/data/images/Globe.png and /dev/null differ diff --git a/src/leap/bitmask/gui/ui/wizard.ui b/src/leap/bitmask/gui/ui/wizard.ui index 570c01a9..2a412784 100644 --- a/src/leap/bitmask/gui/ui/wizard.ui +++ b/src/leap/bitmask/gui/ui/wizard.ui @@ -740,97 +740,6 @@ - - - Congratulations! - - - You have successfully configured Bitmask. - - - 6 - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - - - - :/images/mask-icon.png - - - - - - - - 0 - 0 - - - - - - - :/images/Globe.png - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - diff --git a/src/leap/bitmask/gui/wizard.py b/src/leap/bitmask/gui/wizard.py index ac0f032f..e004e6cf 100644 --- a/src/leap/bitmask/gui/wizard.py +++ b/src/leap/bitmask/gui/wizard.py @@ -52,7 +52,6 @@ class Wizard(QtGui.QWizard): SETUP_PROVIDER_PAGE = 3 REGISTER_USER_PAGE = 4 SERVICES_PAGE = 5 - FINISH_PAGE = 6 WEAK_PASSWORDS = ("123456", "qweasd", "qwerty", "password") @@ -144,7 +143,7 @@ class Wizard(QtGui.QWizard): self.page(self.REGISTER_USER_PAGE).setButtonText( QtGui.QWizard.CommitButton, self.tr("&Next >")) - self.page(self.FINISH_PAGE).setButtonText( + self.page(self.SERVICES_PAGE).setButtonText( QtGui.QWizard.FinishButton, self.tr("Connect")) # XXX: Temporary removal for enrollment policy -- cgit v1.2.3 From d315312740333abf8450e4e0b004d219a0936488 Mon Sep 17 00:00:00 2001 From: Kali Kaneko Date: Wed, 28 Aug 2013 19:44:27 +0200 Subject: Properly daemonize the call to polkit gnome authentication agent. Closes: #3554 --- changes/bug_3554_fix-polkit-auth-agent | 1 + pkg/requirements.pip | 1 + src/leap/bitmask/services/eip/vpnlaunchers.py | 25 ++++++------- src/leap/bitmask/util/polkit_agent.py | 52 +++++++++++++++++++++++++++ 4 files changed, 67 insertions(+), 12 deletions(-) create mode 100644 changes/bug_3554_fix-polkit-auth-agent create mode 100644 src/leap/bitmask/util/polkit_agent.py diff --git a/changes/bug_3554_fix-polkit-auth-agent b/changes/bug_3554_fix-polkit-auth-agent new file mode 100644 index 00000000..9498868b --- /dev/null +++ b/changes/bug_3554_fix-polkit-auth-agent @@ -0,0 +1 @@ + o Properly daemonize polkit-gnome-authentication-agent. Closes: #3554 diff --git a/pkg/requirements.pip b/pkg/requirements.pip index e04127b7..7d0f79af 100644 --- a/pkg/requirements.pip +++ b/pkg/requirements.pip @@ -16,6 +16,7 @@ ipaddr twisted qt4reactor python-gnupg +python-daemon # this should not be needed for Windows. leap.common>=0.3.0 leap.soledad.client>=0.3.0 diff --git a/src/leap/bitmask/services/eip/vpnlaunchers.py b/src/leap/bitmask/services/eip/vpnlaunchers.py index 5921882b..7ee54342 100644 --- a/src/leap/bitmask/services/eip/vpnlaunchers.py +++ b/src/leap/bitmask/services/eip/vpnlaunchers.py @@ -23,8 +23,8 @@ import logging import getpass import os import platform -import subprocess import stat +import subprocess try: import grp except ImportError: @@ -34,6 +34,7 @@ from abc import ABCMeta, abstractmethod from functools import partial from leap.bitmask.config.leapsettings import LeapSettings + from leap.bitmask.config.providerconfig import ProviderConfig from leap.bitmask.services.eip.eipconfig import EIPConfig, VPNGatewaySelector from leap.bitmask.util import first @@ -218,19 +219,19 @@ def _is_auth_agent_running(): return any(is_running) -def _try_to_launch_agent(): +def _try_to_launch_agent(standalone=False): """ Tries to launch a polkit daemon. """ - opts = [ - "/usr/lib/policykit-1-gnome/polkit-gnome-authentication-agent-1", - # XXX add kde thing here - ] - for cmd in opts: - try: - subprocess.Popen([cmd], shell=True) - except: - pass + env = None + if standalone is True: + env = { + "PYTHONPATH": os.path.abspath('../../../../lib/')} + try: + subprocess.call(["python", "-m", "leap.bitmask.util.polkit_agent"], + shell=True, env=env) + except Exception as exc: + logger.exception(exc) class LinuxVPNLauncher(VPNLauncher): @@ -314,7 +315,7 @@ class LinuxVPNLauncher(VPNLauncher): """ if _is_pkexec_in_system(): if not _is_auth_agent_running(): - _try_to_launch_agent() + _try_to_launch_agent(ProviderConfig.standalone) if _is_auth_agent_running(): pkexec_possibilities = which(kls.PKEXEC_BIN) leap_assert(len(pkexec_possibilities) > 0, diff --git a/src/leap/bitmask/util/polkit_agent.py b/src/leap/bitmask/util/polkit_agent.py new file mode 100644 index 00000000..a4650273 --- /dev/null +++ b/src/leap/bitmask/util/polkit_agent.py @@ -0,0 +1,52 @@ +# -*- coding: utf-8 -*- +# polkit_agent.py +# Copyright (C) 2013 LEAP +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +""" +Daemonizes polkit authentication agent. +""" +import logging +import subprocess + +import daemon + +logger = logging.getLogger(__name__) + +BASE_PATH = "/usr/lib/policykit-1-gnome/"\ + + "polkit-%s-authentication-agent-1" + +GNOME_PATH = BASE_PATH % ("gnome",) +KDE_PATH = BASE_PATH % ("kde",) + + +def _launch_agent(): + logger.debug('Launching polkit auth agent') + print "launching polkit" + try: + subprocess.call(GNOME_PATH) + except Exception as exc: + try: + subprocess.call(KDE_PATH) + except Exception as exc: + logger.error('Exception while running polkit authentication agent ' + '%s' % (exc,)) + + +def launch(): + with daemon.DaemonContext(): + _launch_agent() + +if __name__ == "__main__": + launch() -- cgit v1.2.3 From aae5eb050d6c5f8f4559ee33e231382421d1a569 Mon Sep 17 00:00:00 2001 From: Ivan Alejandro Date: Wed, 4 Sep 2013 11:27:07 -0300 Subject: Set appropiate error on login cancel. Closes #3582 --- changes/bug-3582_set-appropiate-message-on-login-cancel | 1 + src/leap/bitmask/gui/mainwindow.py | 2 ++ 2 files changed, 3 insertions(+) create mode 100644 changes/bug-3582_set-appropiate-message-on-login-cancel diff --git a/changes/bug-3582_set-appropiate-message-on-login-cancel b/changes/bug-3582_set-appropiate-message-on-login-cancel new file mode 100644 index 00000000..3ad11490 --- /dev/null +++ b/changes/bug-3582_set-appropiate-message-on-login-cancel @@ -0,0 +1 @@ + o Set appropiate error on login cancel. Closes #3582. diff --git a/src/leap/bitmask/gui/mainwindow.py b/src/leap/bitmask/gui/mainwindow.py index 7a94fd0f..759a591b 100644 --- a/src/leap/bitmask/gui/mainwindow.py +++ b/src/leap/bitmask/gui/mainwindow.py @@ -891,6 +891,8 @@ class MainWindow(QtGui.QMainWindow): logger.debug("Cancelling login defer.") self._login_defer.cancel() + self._login_widget.set_status(self.tr("Log in cancelled by the user.")) + def _provider_config_loaded(self, data): """ SLOT -- cgit v1.2.3 From 4da5d2ef7a6671c6f7f83a290c52441da5ac9873 Mon Sep 17 00:00:00 2001 From: Kali Kaneko Date: Wed, 4 Sep 2013 17:14:17 +0200 Subject: warn user if python3 is used to run setup --- changes/bug_3711-warn-with-python3 | 1 + setup.py | 23 +++++++++++++++++++++++ 2 files changed, 24 insertions(+) create mode 100644 changes/bug_3711-warn-with-python3 diff --git a/changes/bug_3711-warn-with-python3 b/changes/bug_3711-warn-with-python3 new file mode 100644 index 00000000..79271caf --- /dev/null +++ b/changes/bug_3711-warn-with-python3 @@ -0,0 +1 @@ + o Complain if setup.py is run with python3. Closes: #3711 diff --git a/setup.py b/setup.py index 7f2a5011..5099c1b1 100755 --- a/setup.py +++ b/setup.py @@ -1,10 +1,33 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- +# setup.py +# Copyright (C) 2013 LEAP +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +""" +Setup file for bitmask. +""" from __future__ import print_function import sys +if not sys.version_info[0] == 2: + print("[ERROR] Sorry, Python 3 is not supported (yet). " + "Try running with python2: python2 setup.py ...") + exit() + try: from setuptools import setup, find_packages except ImportError: -- cgit v1.2.3 From 1d9199849f889f244da113dd8e73fca02aa1d40e Mon Sep 17 00:00:00 2001 From: Ivan Alejandro Date: Wed, 4 Sep 2013 12:18:33 -0300 Subject: Enable preferences option in systray. Closes #3717 --- changes/bug-3717_enable-preferences-option-in-systray | 1 + src/leap/bitmask/gui/mainwindow.py | 11 ++++++----- 2 files changed, 7 insertions(+), 5 deletions(-) create mode 100644 changes/bug-3717_enable-preferences-option-in-systray diff --git a/changes/bug-3717_enable-preferences-option-in-systray b/changes/bug-3717_enable-preferences-option-in-systray new file mode 100644 index 00000000..8f9f30d1 --- /dev/null +++ b/changes/bug-3717_enable-preferences-option-in-systray @@ -0,0 +1 @@ + o Enable preferences option in systray. Closes #3717. diff --git a/src/leap/bitmask/gui/mainwindow.py b/src/leap/bitmask/gui/mainwindow.py index 759a591b..1fdd0792 100644 --- a/src/leap/bitmask/gui/mainwindow.py +++ b/src/leap/bitmask/gui/mainwindow.py @@ -270,6 +270,9 @@ class MainWindow(QtGui.QMainWindow): self._status_panel.set_action_eip_startstop( self._action_eip_startstop) + self._action_preferences = QtGui.QAction(self.tr("Preferences"), self) + self._action_preferences.triggered.connect(self._show_preferences) + self._action_visible = QtGui.QAction(self.tr("Hide Main Window"), self) self._action_visible.triggered.connect(self._toggle_visible) @@ -609,10 +612,8 @@ class MainWindow(QtGui.QMainWindow): self._systray.setVisible(True) return - # Placeholder actions - # They are temporary to display the tray as designed - preferences_action = QtGui.QAction(self.tr("Preferences"), self) - preferences_action.setEnabled(False) + # Placeholder action + # It is temporary to display the tray as designed help_action = QtGui.QAction(self.tr("Help"), self) help_action.setEnabled(False) @@ -623,7 +624,7 @@ class MainWindow(QtGui.QMainWindow): systrayMenu.addAction(self._action_eip_status) systrayMenu.addAction(self._action_eip_startstop) systrayMenu.addSeparator() - systrayMenu.addAction(preferences_action) + systrayMenu.addAction(self._action_preferences) systrayMenu.addAction(help_action) systrayMenu.addSeparator() systrayMenu.addAction(self.ui.action_log_out) -- cgit v1.2.3 From 845d70c8efb70478cb19fcc88e0c7958ee75370c Mon Sep 17 00:00:00 2001 From: Ivan Alejandro Date: Mon, 2 Sep 2013 17:39:22 -0300 Subject: Fix save log dialog freezing. Closes #3675. Avoid using native dialog seems to solve the QFileDialog freezing when qtreactor is used. See more at: http://www.code-corner.de/?p=171 --- changes/bug-3675_qfiledialog-and-qtreactor-freezes | 1 + src/leap/bitmask/gui/loggerwindow.py | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 changes/bug-3675_qfiledialog-and-qtreactor-freezes diff --git a/changes/bug-3675_qfiledialog-and-qtreactor-freezes b/changes/bug-3675_qfiledialog-and-qtreactor-freezes new file mode 100644 index 00000000..fa0ef6a2 --- /dev/null +++ b/changes/bug-3675_qfiledialog-and-qtreactor-freezes @@ -0,0 +1 @@ + o Fix save logs to file dialog freezing. Closes #3675. diff --git a/src/leap/bitmask/gui/loggerwindow.py b/src/leap/bitmask/gui/loggerwindow.py index 9b4ba55d..ece4cad6 100644 --- a/src/leap/bitmask/gui/loggerwindow.py +++ b/src/leap/bitmask/gui/loggerwindow.py @@ -146,7 +146,8 @@ class LoggerWindow(QtGui.QDialog): Lets the user save the current log to a file """ fileName, filtr = QtGui.QFileDialog.getSaveFileName( - self, self.tr("Save As")) + self, self.tr("Save As"), + options=QtGui.QFileDialog.DontUseNativeDialog) if fileName: try: -- cgit v1.2.3 From 4a6acd4ed143d6d43ad9a70c13694dbae0cbaf49 Mon Sep 17 00:00:00 2001 From: Kali Kaneko Date: Wed, 4 Sep 2013 20:05:57 +0200 Subject: Update version --- docs/conf.py | 20 +++++---- src/leap/bitmask/__init__.py | 75 ++++++++++++++++++++++++++++++++++ src/leap/bitmask/util/__init__.py | 50 +---------------------- src/leap/bitmask/util/leap_argparse.py | 6 ++- 4 files changed, 91 insertions(+), 60 deletions(-) diff --git a/docs/conf.py b/docs/conf.py index 39f17d9b..082b4d67 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -18,11 +18,12 @@ import sys, os # documentation root, use os.path.abspath to make it absolute, like shown here. sys.path.insert(0, os.path.abspath('../src')) sys.path.insert(0, os.path.abspath('../src/leap')) -sys.path.insert(0, os.path.abspath('../src/leap/crypto')) -sys.path.insert(0, os.path.abspath('../src/leap/keymanager')) -sys.path.insert(0, os.path.abspath('../src/leap/services')) -sys.path.insert(0, os.path.abspath('../src/leap/services/eip')) -sys.path.insert(0, os.path.abspath('../src/leap/util')) +sys.path.insert(0, os.path.abspath('../src/leap/bitmask')) +sys.path.insert(0, os.path.abspath('../src/leap/bitmask/crypto')) +sys.path.insert(0, os.path.abspath('../src/leap/bitmask/keymanager')) +sys.path.insert(0, os.path.abspath('../src/leap/bitmask/services')) +sys.path.insert(0, os.path.abspath('../src/leap/bitmask/services/eip')) +sys.path.insert(0, os.path.abspath('../src/leap/bitmask/util')) sys.path.insert(0, os.path.abspath( os.path.expanduser( @@ -58,17 +59,18 @@ source_suffix = '.rst' master_doc = 'index' # General information about the project. -project = u'LEAP' -copyright = u'2012, The LEAP Encryption Access Project' +project = u'Bitmask' +copyright = u'2012-2013, The LEAP Encryption Access Project' # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the # built documents. # # The short X.Y version. -version = '0.2.1-dev1' +import leap.bitmask +version = leap.bitmask.__short_version__ # The full version, including alpha/beta/rc tags. -release = '0.2.1' +release = leap.bitmask.__version__ # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. diff --git a/src/leap/bitmask/__init__.py b/src/leap/bitmask/__init__.py index e69de29b..ebdd53c4 100644 --- a/src/leap/bitmask/__init__.py +++ b/src/leap/bitmask/__init__.py @@ -0,0 +1,75 @@ +# -*- coding: utf-8 -*- +# __init__.py +# Copyright (C) 2013 LEAP +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +""" +Init file for leap.bitmask + +Initializes version and app info. +""" +import re + +from pkg_resources import parse_version + +from leap.bitmask.util import first + + +def _is_release_version(version): + """ + Helper to determine whether a version is a final release or not. + The release needs to be of the form: w.x.y.z containing only numbers + and dots. + + :param version: the version string + :type version: str + :returns: if the version is a release version or not. + :rtype: bool + """ + parsed_version = parse_version(version) + not_number = 0 + for x in parsed_version: + try: + int(x) + except: + not_number += 1 + + return not_number == 1 + + +__version__ = "unknown" +IS_RELEASE_VERSION = False + +__short_version__ = "unknown" + +try: + from leap.bitmask._version import get_versions + __version__ = get_versions()['version'] + IS_RELEASE_VERSION = _is_release_version(__version__) + del get_versions +except ImportError: + #running on a tree that has not run + #the setup.py setver + pass + +__appname__ = "unknown" +try: + from leap._appname import __appname__ +except ImportError: + #running on a tree that has not run + #the setup.py setver + pass + +__short_version__ = first(re.findall('\d\.\d\.\d', __version__)) +__full_version__ = __appname__ + '/' + str(__version__) diff --git a/src/leap/bitmask/util/__init__.py b/src/leap/bitmask/util/__init__.py index ce8323cd..6dd18bcf 100644 --- a/src/leap/bitmask/util/__init__.py +++ b/src/leap/bitmask/util/__init__.py @@ -15,59 +15,11 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . """ -Initializes version and app info, plus some small and handy functions. +Some small and handy functions. """ import datetime import os -from pkg_resources import parse_version - - -def _is_release_version(version): - """ - Helper to determine whether a version is a final release or not. - The release needs to be of the form: w.x.y.z containing only numbers - and dots. - - :param version: the version string - :type version: str - :returns: if the version is a release version or not. - :rtype: bool - """ - parsed_version = parse_version(version) - not_number = 0 - for x in parsed_version: - try: - int(x) - except: - not_number += 1 - - return not_number == 1 - - -__version__ = "unknown" -IS_RELEASE_VERSION = False - -try: - from leap.bitmask._version import get_versions - __version__ = get_versions()['version'] - IS_RELEASE_VERSION = _is_release_version(__version__) - del get_versions -except ImportError: - #running on a tree that has not run - #the setup.py setver - pass - -__appname__ = "unknown" -try: - from leap._appname import __appname__ -except ImportError: - #running on a tree that has not run - #the setup.py setver - pass - -__full_version__ = __appname__ + '/' + str(__version__) - def first(things): """ diff --git a/src/leap/bitmask/util/leap_argparse.py b/src/leap/bitmask/util/leap_argparse.py index 71f5163d..bc21a9cf 100644 --- a/src/leap/bitmask/util/leap_argparse.py +++ b/src/leap/bitmask/util/leap_argparse.py @@ -14,10 +14,12 @@ # # You should have received a copy of the GNU General Public License # along with this program. If not, see . - +""" +Parses the command line arguments passed to the application. +""" import argparse -from leap.bitmask.util import IS_RELEASE_VERSION +from leap.bitmask import IS_RELEASE_VERSION def build_parser(): -- cgit v1.2.3 From 1782f6328de41a19dfa8e81f30b9fe31c1a0d34c Mon Sep 17 00:00:00 2001 From: Kali Kaneko Date: Wed, 4 Sep 2013 21:37:25 +0200 Subject: Images shuffle --- data/images/favicon.ico | Bin 318 -> 1150 bytes data/images/leap-color-small.png | Bin 10100 -> 0 bytes data/images/mask-small.png | Bin 0 -> 18172 bytes data/images/watermark.png | Bin 22819 -> 0 bytes docs/user/leap-color-small.png | Bin 0 -> 10100 bytes 5 files changed, 0 insertions(+), 0 deletions(-) delete mode 100644 data/images/leap-color-small.png create mode 100644 data/images/mask-small.png delete mode 100644 data/images/watermark.png create mode 100644 docs/user/leap-color-small.png diff --git a/data/images/favicon.ico b/data/images/favicon.ico index b5f3505a..7f41dd1d 100644 Binary files a/data/images/favicon.ico and b/data/images/favicon.ico differ diff --git a/data/images/leap-color-small.png b/data/images/leap-color-small.png deleted file mode 100644 index bc9d4e7f..00000000 Binary files a/data/images/leap-color-small.png and /dev/null differ diff --git a/data/images/mask-small.png b/data/images/mask-small.png new file mode 100644 index 00000000..5f5f1b41 Binary files /dev/null and b/data/images/mask-small.png differ diff --git a/data/images/watermark.png b/data/images/watermark.png deleted file mode 100644 index d8e3f965..00000000 Binary files a/data/images/watermark.png and /dev/null differ diff --git a/docs/user/leap-color-small.png b/docs/user/leap-color-small.png new file mode 100644 index 00000000..bc9d4e7f Binary files /dev/null and b/docs/user/leap-color-small.png differ -- cgit v1.2.3 From 1fd9b7cffaf1063c3a2a23e056556be18ef3848a Mon Sep 17 00:00:00 2001 From: Kali Kaneko Date: Wed, 4 Sep 2013 21:38:02 +0200 Subject: Update intro --- docs/Makefile | 1 + docs/conf.py | 15 +++++++++------ docs/index.rst | 16 +++++++++++----- docs/user/intro.rst | 18 ++++++++++++++---- pkg/requirements-docs.pip | 1 + 5 files changed, 36 insertions(+), 15 deletions(-) create mode 100644 pkg/requirements-docs.pip diff --git a/docs/Makefile b/docs/Makefile index 16aa258b..5c2c4145 100644 --- a/docs/Makefile +++ b/docs/Makefile @@ -4,6 +4,7 @@ # You can set these variables from the command line. SPHINXOPTS = SPHINXBUILD = sphinx-build +#SPHINXBUILD = $(VIRTUAL_ENV)/bin/sphinx-build PAPER = BUILDDIR = _build diff --git a/docs/conf.py b/docs/conf.py index 082b4d67..3c908b2c 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- # -# LEAP documentation build configuration file, created by +# Bitmask documentation build configuration file, created by # sphinx-quickstart on Sun Jul 22 18:32:05 2012. # # This file is execfile()d with the current directory set to its containing dir. @@ -25,10 +25,13 @@ sys.path.insert(0, os.path.abspath('../src/leap/bitmask/services')) sys.path.insert(0, os.path.abspath('../src/leap/bitmask/services/eip')) sys.path.insert(0, os.path.abspath('../src/leap/bitmask/util')) -sys.path.insert(0, os.path.abspath( - os.path.expanduser( - '~/Virtualenvs/leap-client/local/lib/python2.7/' - 'site-packages/leap/common'))) +try: + sys.path.insert(0, os.path.abspath( + os.path.expanduser( + '~/Virtualenvs/leap-bitmask/local/lib/python2.7/' + 'site-packages/leap/common'))) +except: + pass # TODO: should add all the virtualenv site-packages to the path # as a workaround, install all in your path. @@ -130,7 +133,7 @@ html_theme = 'default' # The name of an image file (relative to this directory) to place at the top # of the sidebar. -html_logo = "../data/images/leap-color-small.png" +html_logo = "../data/images/mask-small.png" # The name of an image file (within the static path) to use as favicon of the # docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 diff --git a/docs/index.rst b/docs/index.rst index e3078929..d0b0ff22 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -1,15 +1,20 @@ -.. LEAP documentation master file, created by +.. Bitmask documentation master file, created by sphinx-quickstart on Sun Jul 22 18:32:05 2012. You can adapt this file completely to your liking, but it should at least contain the root `toctree` directive. -LEAP Client +Bitmask ===================================== -Release v\ |version|. (`Impatient? jump to the` :ref:`Installation ` `section!`) +Release v \ |version|. (`Impatient? jump to the` :ref:`Installation ` `section!`) .. if you change this paragraph, change it in user/intro too -The **LEAP Encryption Access Project Client** is a :ref:`GPL3 Licensed ` multiplatform client, written in python using PySide, that supports the features offered by :ref:`the LEAP Platform `. Currently is being tested on Linux, support for OSX and Windows will come soon. +**Bitmask** is the multiplatform desktop client for the services offered by :ref:`the LEAP Platform `. +It is written in python using `PySide`_ and :ref:`licensed under the GPL3 `. +Currently we distribute pre-compiled bundles for Linux and OSX, with Windows +bundles following soon. + +.. _`PySide`: http://qt-project.org/wiki/PySide User Guide ---------- @@ -48,7 +53,6 @@ If you want to contribute to the project, we wrote this for you. .. dev/internals dev/authors dev/todo - dev/workflow Packager Guide --------------- @@ -87,3 +91,5 @@ If you are looking for a reference to specific classes or functions, you are lik :maxdepth: 2 api/leap + + diff --git a/docs/user/intro.rst b/docs/user/intro.rst index 22ad9356..b93df12b 100644 --- a/docs/user/intro.rst +++ b/docs/user/intro.rst @@ -6,26 +6,34 @@ Introduction Bitmask ------- .. if yoy change this, change it also in the index.rst -**Bitmask** is a :ref:`GPL3 Licensed ` multiplatform client, written in python using PySide, that supports the features offered by :ref:`the LEAP Platform `. Currently is being tested on Linux, support for OSX and Windows will come soon. +**Bitmask** is the multiplatform desktop client for the services offered by :ref:`the LEAP Platform `. +It is written in python using `PySide`_ and :ref:`licensed under the GPL3 `. +Currently we distribute pre-compiled bundles for Linux and OSX, with Windows +bundles following soon. Features ^^^^^^^^ Bitmask allows to easily secure communications. -- Provider selection -- User registration +- Provider selection. +- User registration. - Encrypted Internet Proxy support (autoconfigured service using openvpn). +- Encrypted email. Coming soon ^^^^^^^^^^^^ -- Encrypted email +- Encrypted chat. + .. _leapplatform: The LEAP Platform ^^^^^^^^^^^^^^^^^ + +.. image:: leap-color-small.* + The LEAP Provider Platform is the server-side part of LEAP that is run by service providers. It consists of a set of complementary packages and recipes to automate the maintenance of LEAP services in a hardened GNU/Linux environment. Our goal is to make it painless for service providers and ISPs to deploy a secure communications platform. Read `more about the LEAP Platform `_ or `check out the code `_. @@ -97,5 +105,7 @@ Bitmask is released under the terms of the `GNU GPL version 3`_ or later. .. _`GNU GPL version 3`: http://www.gnu.org/licenses/gpl.txt +.. _`PySide`: http://qt-project.org/wiki/PySide + .. ??? include whole version? .. include:: ../COPYING diff --git a/pkg/requirements-docs.pip b/pkg/requirements-docs.pip new file mode 100644 index 00000000..6966869c --- /dev/null +++ b/pkg/requirements-docs.pip @@ -0,0 +1 @@ +sphinx -- cgit v1.2.3 From d25647171fcaea39d28d60ed9b00c89555e8d9c8 Mon Sep 17 00:00:00 2001 From: Kali Kaneko Date: Wed, 4 Sep 2013 22:17:45 +0200 Subject: Update readme * Read the docs * Fix path to gpl image until we switch repos --- README.rst | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/README.rst b/README.rst index 7c415663..5d601578 100644 --- a/README.rst +++ b/README.rst @@ -6,6 +6,13 @@ The LEAP Encryption Access Project Client .. image:: https://pypip.in/v/leap.bitmask/badge.png :target: https://crate.io/packages/leap.bitmask +Read the Docs! +------------------ + +The latest documentation is available at `Read The Docs`_. + +.. _`RTD`: http://bitmask.rtfd.org + Dependencies ------------------ @@ -101,7 +108,7 @@ which the first time should automagically install all the needed dependencies in License ======= -.. image:: https://raw.github.com/leapcode/bitmask/develop/docs/user/gpl.png +.. image:: https://raw.github.com/leapcode/leap_client/develop/docs/user/gpl.png Bitmask is released under the terms of the `GNU GPL version 3`_ or later. -- cgit v1.2.3 From 9d4c219cdfc331286f6650fd746c75fcd3e0ce35 Mon Sep 17 00:00:00 2001 From: Ivan Alejandro Date: Wed, 4 Sep 2013 16:55:37 -0300 Subject: Add install:bundle section. --- docs/user/install.rst | 37 ++++++++++++++++++++++++++++++++----- 1 file changed, 32 insertions(+), 5 deletions(-) diff --git a/docs/user/install.rst b/docs/user/install.rst index da1d914c..2a597c8b 100644 --- a/docs/user/install.rst +++ b/docs/user/install.rst @@ -8,24 +8,51 @@ We assume that you want to get it properly installed before being able to use it .. note:: - The recommended way of installing in the near future will be the standalone bundles, but those are not quite ready yet. Methods described in this page assume you are familiar with python code, and you can find your way through the process of dependencies install. You can refer to the sections :ref:`setting up a working environment ` or :ref:`fetching latest code for testing `. + Methods described in this page assume you are familiar with python code, and you can find your way through the process of dependencies install. You can refer to the sections :ref:`setting up a working environment ` or :ref:`fetching latest code for testing `. +Standalone bundle +----------------- + +You can run Bitmask using the standalone bundle, the recommended way to use Bitmask. + +For the latest bundles and its signatures in https://downloads.leap.se/client/ + +Linux 32 bits: + https://downloads.leap.se/client/linux/Bitmask-linux32-0.3.1.tar.bz2 + + https://downloads.leap.se/client/linux/Bitmask-linux32-0.3.1.tar.bz2.asc + +Linux 64 bits: + https://downloads.leap.se/client/linux/Bitmask-linux64-0.3.1.tar.bz2 + + https://downloads.leap.se/client/linux/Bitmask-linux64-0.3.1.tar.bz2.asc + +OSX: + https://downloads.leap.se/client/osx/Bitmask-OSX-0.3.1.dmg + + https://downloads.leap.se/client/osx/Bitmask-OSX-0.3.1.dmg.asc + +Windows version is delayed right now. + +For the signature verification you can use :: + + $ gpg --verify Bitmask-linux64-0.3.1.tar.bz2.asc + +Asuming that you downloaded the linux 64 bits bundle. Distribute & Pip ---------------- -.. warning:: The package in the cheese shop is from the stable, `0.2.0` release, which is now outdated. You are encouraged to install the development version instead. - Installing Bitmask is as simple as using `pip `_ for the already released versions :: - $ pip install bitmask + $ pip install leap.bitmask Debian package -------------- .. warning:: - The debian package in the leap repositories is from the stable, `0.2.0` release, which is now outdated. You are encouraged to install the development version instead, + The debian package in the leap repositories is from the stable, `0.2.0` release, which is now outdated. You are encouraged to install the development version instead. First, you need to bootstrap your apt-key:: -- cgit v1.2.3 From 7be4076e349568c12ddcd903365b41bd7e88ee74 Mon Sep 17 00:00:00 2001 From: Kali Kaneko Date: Wed, 4 Sep 2013 22:30:35 +0200 Subject: Update checklist with symlinks info --- docs/release_checklist.wiki | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/docs/release_checklist.wiki b/docs/release_checklist.wiki index e766d6f8..5db34329 100644 --- a/docs/release_checklist.wiki +++ b/docs/release_checklist.wiki @@ -1,4 +1,5 @@ = Bitmask Release Checklist (*) = + * [ ] Check that all tests are passing! * [ ] Tag everything * Should be done for the following packages, in order: 1. leap.common @@ -24,10 +25,13 @@ * [ ] git push origin X.Y.Z * [ ] git checkout master && git pull origin master && git merge release-X.Y.Z && git push origin master * [ ] git checkout develop && git pull origin develop && git merge release-X.Y.Z && git push origin develop - * [ ] Build bundles + * [ ] Build and upload bundles * [ ] Use the scripts under pkg// to build the the bundles. * [ ] Sign them with gpg -a * [ ] Upload bundle and signature to web-uploads@salmon.leap.se:~/public/client// + * [ ] Update symbolic link for latest upload and signature: + * [ ] ~/public/client/latest- + * [ ] ~/public/client/latest-.asc * [ ] Announce * [ ] Mail leap@lists.riseup.net -- cgit v1.2.3 From f00463b3dd05d7c060d91d1d6898b1a704090662 Mon Sep 17 00:00:00 2001 From: Kali Kaneko Date: Wed, 4 Sep 2013 23:00:42 +0200 Subject: Reformat links to downloads with symlinks --- docs/release_checklist.wiki | 6 ++--- docs/user/install.rst | 62 ++++++++++++++++++++++++++------------------- 2 files changed, 39 insertions(+), 29 deletions(-) diff --git a/docs/release_checklist.wiki b/docs/release_checklist.wiki index 5db34329..e6467048 100644 --- a/docs/release_checklist.wiki +++ b/docs/release_checklist.wiki @@ -28,10 +28,10 @@ * [ ] Build and upload bundles * [ ] Use the scripts under pkg// to build the the bundles. * [ ] Sign them with gpg -a - * [ ] Upload bundle and signature to web-uploads@salmon.leap.se:~/public/client// + * [ ] Upload bundle and signature to web-uploads@salmon.leap.se:~/public/client//Bitmask--.(tar.bz2,dmg,zip) * [ ] Update symbolic link for latest upload and signature: - * [ ] ~/public/client/latest- - * [ ] ~/public/client/latest-.asc + * [ ] ~/public/client/Bitmask--latest + * [ ] ~/public/client/Bitmask--latest.asc * [ ] Announce * [ ] Mail leap@lists.riseup.net diff --git a/docs/user/install.rst b/docs/user/install.rst index 2a597c8b..37a1713e 100644 --- a/docs/user/install.rst +++ b/docs/user/install.rst @@ -6,53 +6,50 @@ Installation This part of the documentation covers the installation of Bitmask. We assume that you want to get it properly installed before being able to use it. -.. note:: - - Methods described in this page assume you are familiar with python code, and you can find your way through the process of dependencies install. You can refer to the sections :ref:`setting up a working environment ` or :ref:`fetching latest code for testing `. - Standalone bundle ----------------- -You can run Bitmask using the standalone bundle, the recommended way to use Bitmask. +Maybe the quickest way of running Bitmask in your machine is using the standalone bundle. That is the recommended way to use Bitmask for the time being. -For the latest bundles and its signatures in https://downloads.leap.se/client/ +You can get the latest bundles, and their matching signatures at `the downloads page `_. -Linux 32 bits: - https://downloads.leap.se/client/linux/Bitmask-linux32-0.3.1.tar.bz2 +Linux +^^^^^ +- `Linux 32 bits bundle`_ (`signature `_) +- `Linux 64 bits bundle`_ (`signature `_) - https://downloads.leap.se/client/linux/Bitmask-linux32-0.3.1.tar.bz2.asc +OSX +^^^ +- `OSX bundle`_ (`signature `_) -Linux 64 bits: - https://downloads.leap.se/client/linux/Bitmask-linux64-0.3.1.tar.bz2 - - https://downloads.leap.se/client/linux/Bitmask-linux64-0.3.1.tar.bz2.asc - -OSX: - https://downloads.leap.se/client/osx/Bitmask-OSX-0.3.1.dmg +Windows +^^^^^^^ +.. note:: - https://downloads.leap.se/client/osx/Bitmask-OSX-0.3.1.dmg.asc + The release of the bundles for Windows is delayed right now. We should resume + producing them shortly, keep tuned. -Windows version is delayed right now. +Signature verification +^^^^^^^^^^^^^^^^^^^^^^ For the signature verification you can use :: - $ gpg --verify Bitmask-linux64-0.3.1.tar.bz2.asc + $ gpg --verify Bitmask-linux64-latest.tar.bz2.asc Asuming that you downloaded the linux 64 bits bundle. -Distribute & Pip ----------------- - -Installing Bitmask is as simple as using `pip `_ for the already released versions :: - - $ pip install leap.bitmask +.. _`PySide`: http://qt-project.org/wiki/PySide +.. _`Linux 64 bits bundle`: https://downloads.leap.se/client/linux/Bitmask-linux64-latest.tar.bz2 +.. _`Linux 32 bits bundle`: https://downloads.leap.se/client/linux/Bitmask-linux32-latest.tar.bz2 +.. _`OSX bundle`: https://downloads.leap.se/client/osx/Bitmask-OSX-latest.dmg +.. _`Windows bundle`: https://downloads.leap.se/client/osx/Bitmask-windows-latest.zip Debian package -------------- .. warning:: - The debian package in the leap repositories is from the stable, `0.2.0` release, which is now outdated. You are encouraged to install the development version instead. + The debian package that you can currently find in the leap repositories is from the stable, `0.2.0` release, which is now outdated. You are encouraged to install the development version or the standalone bundles while we upload the newest packages. First, you need to bootstrap your apt-key:: @@ -71,6 +68,19 @@ And then you can happily install bitmask:: apt-get install bitmask +Distribute & Pip +---------------- + +.. note:: + + The rest of the methods described below in this page assume you are familiar with python code, and you can find your way through the process of dependencies install. For more insight, you can also refer to the sections :ref:`setting up a working environment ` or :ref:`fetching latest code for testing `. + + +Installing Bitmask is as simple as using `pip `_ for the already released versions :: + + $ pip install leap.bitmask + + Show me the code! ----------------- -- cgit v1.2.3 From e50ff1f5b82f004b3a38cdc366aa021a7e987c23 Mon Sep 17 00:00:00 2001 From: Kali Kaneko Date: Wed, 4 Sep 2013 23:07:16 +0200 Subject: Revert repo names for the moment --- docs/user/install.rst | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/docs/user/install.rst b/docs/user/install.rst index 37a1713e..d6354dab 100644 --- a/docs/user/install.rst +++ b/docs/user/install.rst @@ -4,7 +4,7 @@ Installation ============ This part of the documentation covers the installation of Bitmask. -We assume that you want to get it properly installed before being able to use it. +We assume that you want to get it properly installed before being able to use it. But we can we wrong. Standalone bundle ----------------- @@ -38,11 +38,10 @@ For the signature verification you can use :: Asuming that you downloaded the linux 64 bits bundle. -.. _`PySide`: http://qt-project.org/wiki/PySide .. _`Linux 64 bits bundle`: https://downloads.leap.se/client/linux/Bitmask-linux64-latest.tar.bz2 .. _`Linux 32 bits bundle`: https://downloads.leap.se/client/linux/Bitmask-linux32-latest.tar.bz2 .. _`OSX bundle`: https://downloads.leap.se/client/osx/Bitmask-OSX-latest.dmg -.. _`Windows bundle`: https://downloads.leap.se/client/osx/Bitmask-windows-latest.zip +.. _`Windows bundle`: https://downloads.leap.se/client/windows/Bitmask-windows-latest.zip Debian package -------------- @@ -84,15 +83,16 @@ Installing Bitmask is as simple as using `pip `_ Show me the code! ----------------- +.. XXX UPDATE REPO NAMES AS SOON AS #3417 is DONE + You can get the code from LEAP public git repository :: - $ git clone git://leap.se/bitmask + $ git clone git://leap.se/leap_client Or from the github mirror :: - $ git clone git://github.com/leapcode/bitmask.git + $ git clone git://github.com/leapcode/leap_client.git Once you have grabbed a copy of the sources, you can install it into your site-packages easily :: $ pyton setup.py install - -- cgit v1.2.3 From c33094f4216b4ef21f25bf448904839d8d50a2f0 Mon Sep 17 00:00:00 2001 From: Kali Kaneko Date: Wed, 4 Sep 2013 23:15:11 +0200 Subject: Minor additions --- docs/user/running.rst | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/docs/user/running.rst b/docs/user/running.rst index da83e9ef..0a93204c 100644 --- a/docs/user/running.rst +++ b/docs/user/running.rst @@ -3,7 +3,8 @@ Running ================== -This document covers how to launch Bitmask. +This document covers how to launch Bitmask. Also know as, where the magic +happens. Launching Bitmask ----------------- @@ -11,7 +12,7 @@ After a successful installation, there should be a launcher called `bitmask` som % bitmask -The first time you launch it, it should launch the first run wizard that will guide you through the setup of the LEAP Services. +The first time you launch it, it should launch the first run wizard that will guide you through the mostly automatic configuration of the LEAP Services. .. note:: @@ -37,8 +38,8 @@ If you ask for it, you can also have all that debug info in a beautiful file rea .. If you want to increment the level of verbosity passed to openvpn, you can do:: .. $ bitmask --openvpn-verbosity 4 -Options ------------- +I want all the options! +----------------------- To see all the available command line options:: $ bitmask --help -- cgit v1.2.3 From 261de005c0a2ecbc8ef4a7771cfeb2a853cbc00d Mon Sep 17 00:00:00 2001 From: Kali Kaneko Date: Wed, 4 Sep 2013 23:18:23 +0200 Subject: Add pypi version icon in user/install --- docs/user/install.rst | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docs/user/install.rst b/docs/user/install.rst index d6354dab..b5fb7810 100644 --- a/docs/user/install.rst +++ b/docs/user/install.rst @@ -74,6 +74,9 @@ Distribute & Pip The rest of the methods described below in this page assume you are familiar with python code, and you can find your way through the process of dependencies install. For more insight, you can also refer to the sections :ref:`setting up a working environment ` or :ref:`fetching latest code for testing `. +.. image:: https://pypip.in/v/leap.bitmask/badge.png + :target: https://crate.io/packages/leap.bitmask + Installing Bitmask is as simple as using `pip `_ for the already released versions :: -- cgit v1.2.3 From e497e3bd99020f26dcfae3e0fa815179284a8050 Mon Sep 17 00:00:00 2001 From: Kali Kaneko Date: Wed, 4 Sep 2013 23:26:54 +0200 Subject: Fix README link to rtd --- README.rst | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/README.rst b/README.rst index 5d601578..f8308566 100644 --- a/README.rst +++ b/README.rst @@ -1,17 +1,26 @@ -The LEAP Encryption Access Project Client -========================================= - +Bitmask +======= *your internet encryption toolkit* .. image:: https://pypip.in/v/leap.bitmask/badge.png :target: https://crate.io/packages/leap.bitmask +**Bitmask** is the multiplatform desktop client for the services offered by +`the LEAP Platform`_. +It is written in python using `PySide`_ and licensed under the GPL3. +Currently we distribute pre-compiled bundles for Linux and OSX, with Windows +bundles following soon. + +.. _`PySide`: http://qt-project.org/wiki/PySide +.. _`the LEAP Platform`: https://github.com/leapcode/leap_platform + + Read the Docs! ------------------ The latest documentation is available at `Read The Docs`_. -.. _`RTD`: http://bitmask.rtfd.org +.. _`Read The Docs`: http://bitmask.rtfd.org Dependencies ------------------ @@ -62,7 +71,7 @@ Hacking The Bitmask git repository is available at:: - git://leap.se/bitmask + git://leap.se/leap_client Some steps need to be run when setting a development environment for the first time. -- cgit v1.2.3 From 6a4b2a00b59ac017b05e88812b2eb5ed8341bd66 Mon Sep 17 00:00:00 2001 From: Ivan Alejandro Date: Thu, 5 Sep 2013 14:34:47 -0300 Subject: Fix: Update version location. --- src/leap/bitmask/app.py | 2 +- src/leap/bitmask/gui/mainwindow.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/leap/bitmask/app.py b/src/leap/bitmask/app.py index 0dce5e61..158f1afe 100644 --- a/src/leap/bitmask/app.py +++ b/src/leap/bitmask/app.py @@ -156,7 +156,7 @@ def main(): from leap.bitmask.gui.mainwindow import MainWindow from leap.bitmask.platform_init import IS_MAC from leap.bitmask.platform_init.locks import we_are_the_one_and_only - from leap.bitmask.util import __version__ as VERSION + from leap.bitmask import __version__ as VERSION from leap.bitmask.util.requirement_checker import check_requirements # pylint: avoid unused import diff --git a/src/leap/bitmask/gui/mainwindow.py b/src/leap/bitmask/gui/mainwindow.py index 1fdd0792..706b9c2a 100644 --- a/src/leap/bitmask/gui/mainwindow.py +++ b/src/leap/bitmask/gui/mainwindow.py @@ -58,7 +58,7 @@ from leap.bitmask.services.eip.vpnlaunchers import \ EIPNoPolkitAuthAgentAvailable from leap.bitmask.services.eip.vpnlaunchers import EIPNoTunKextLoaded -from leap.bitmask.util import __version__ as VERSION +from leap.bitmask import __version__ as VERSION from leap.bitmask.util.keyring_helpers import has_keyring from leap.bitmask.util.leap_log_handler import LeapLogHandler -- cgit v1.2.3 From 29b06e7ecd26b9bf567ef9abd7425c342ec440be Mon Sep 17 00:00:00 2001 From: Ivan Alejandro Date: Thu, 5 Sep 2013 12:50:06 -0300 Subject: Update docs for testers and bootstrap script. --- docs/testers/howto.rst | 8 +++--- docs/user/install.rst | 2 ++ pkg/scripts/bitmask_bootstrap.sh | 49 +++++++++++++++++++++++++++++++++++ pkg/scripts/leap_client_bootstrap.sh | 50 ------------------------------------ 4 files changed, 55 insertions(+), 54 deletions(-) create mode 100644 pkg/scripts/bitmask_bootstrap.sh delete mode 100644 pkg/scripts/leap_client_bootstrap.sh diff --git a/docs/testers/howto.rst b/docs/testers/howto.rst index dde893d1..9c6561ed 100644 --- a/docs/testers/howto.rst +++ b/docs/testers/howto.rst @@ -19,7 +19,7 @@ To allow rapid testing in different platforms, we have put together a quick scri .. note:: - In the near future, we will be using ``standalone bundles`` with the ability to self-update. + In the near future, we will be using :ref:`standalone bundles ` with the ability to self-update. Install dependencies ^^^^^^^^^^^^^^^^^^^^ @@ -41,8 +41,8 @@ Download and source the following script in the parent folder where you want you .. code-block:: bash cd /tmp - wget https://raw.github.com/leapcode/bitmask/develop/pkg/scripts/leap_client_bootstrap.sh - source leap_client_bootstrap.sh + wget https://raw.github.com/leapcode/leap_client/develop/pkg/scripts/bitmask_bootstrap.sh + source bitmask_bootstrap.sh Tada! If everything went well, you should be able to run bitmask by typing:: @@ -52,7 +52,7 @@ Noticed that your prompt changed? That was *virtualenv*. Keep reading... Activating the virtualenv ^^^^^^^^^^^^^^^^^^^^^^^^^ -The above bootstrap script has fetched latest code inside a virtualenv, which is an isolated, *virtual* python local environment that avoids messing with your global paths. You will notice you are *inside* a virtualenv because you will see a modified prompt reminding it to you (*leap-client-testbuild* in this case). +The above bootstrap script has fetched latest code inside a virtualenv, which is an isolated, *virtual* python local environment that avoids messing with your global paths. You will notice you are *inside* a virtualenv because you will see a modified prompt reminding it to you (*bitmask-testbuild* in this case). Thus, if you forget to *activate your virtualenv*, bitmask will not run from the local path, and it will be looking for something else in your global path. So, **you have to remember to activate your virtualenv** each time that you open a new shell and want to execute the code you are testing. You can do this by typing:: diff --git a/docs/user/install.rst b/docs/user/install.rst index b5fb7810..81807a43 100644 --- a/docs/user/install.rst +++ b/docs/user/install.rst @@ -6,6 +6,8 @@ Installation This part of the documentation covers the installation of Bitmask. We assume that you want to get it properly installed before being able to use it. But we can we wrong. +.. _standalone-bundle: + Standalone bundle ----------------- diff --git a/pkg/scripts/bitmask_bootstrap.sh b/pkg/scripts/bitmask_bootstrap.sh new file mode 100644 index 00000000..42eb0af9 --- /dev/null +++ b/pkg/scripts/bitmask_bootstrap.sh @@ -0,0 +1,49 @@ +#!/bin/bash + +# Installs requirements, and +# clones the latest leap-client + +# depends on: +# openvpn git-core libgnutls-dev python-dev python-qt4 python-setuptools python-virtualenv + +# Escape code +esc=`echo -en "\033"` + +# Set colors +cc_green="${esc}[0;32m" +cc_yellow="${esc}[0;33m" +cc_blue="${esc}[0;34m" +cc_red="${esc}[0;31m" +cc_normal=`echo -en "${esc}[m\017"` + +echo "${cc_yellow}" +echo "~~~~~~~~~~~~~~~~~~~~~~~" +echo " Bitmask bootstrapping " +echo "~~~~~~~~~~~~~~~~~~~~~~~" +echo "" +echo "${cc_green}Creating virtualenv...${cc_normal}" + +mkdir bitmask-testbuild +virtualenv bitmask-testbuild +source bitmask-testbuild/bin/activate + +echo "${cc_green}Installing bitmask...${cc_normal}" + +# Clone latest git (develop branch) +# change "develop" for any other branch you want. + + +pip install -e 'git://leap.se/leap_client@develop#egg=leap.bitmask' + +cd bitmask-testbuild + +# symlink the pyside libraries to the system libs +./src/leap.bitmask/pkg/postmkvenv.sh + +echo "${cc_green}bitmask installed! =)" +echo "${cc_yellow}" +echo "Launch it with: " +echo "~~~~~~~~~~~~~~~~~~~~~~" +echo "bin/bitmask" +echo "~~~~~~~~~~~~~~~~~~~~~~" +echo "${cc_normal}" diff --git a/pkg/scripts/leap_client_bootstrap.sh b/pkg/scripts/leap_client_bootstrap.sh deleted file mode 100644 index dcde64f9..00000000 --- a/pkg/scripts/leap_client_bootstrap.sh +++ /dev/null @@ -1,50 +0,0 @@ -#!/bin/bash - -# Installs requirements, and -# clones the latest leap-client - -# depends on: -# openvpn git-core libgnutls-dev python-dev python-qt4 python-setuptools python-virtualenv - -# Escape code -esc=`echo -en "\033"` - -# Set colors -cc_green="${esc}[0;32m" -cc_yellow="${esc}[0;33m" -cc_blue="${esc}[0;34m" -cc_red="${esc}[0;31m" -cc_normal=`echo -en "${esc}[m\017"` - -echo "${cc_yellow}" -echo "~~~~~~~~~~~~~~~~~~~~~~" -echo "LEAP " -echo "client bootstrapping " -echo "~~~~~~~~~~~~~~~~~~~~~~" -echo "" -echo "${cc_green}Creating virtualenv...${cc_normal}" - -mkdir leap-client-testbuild -virtualenv leap-client-testbuild -source leap-client-testbuild/bin/activate - -echo "${cc_green}Installing leap client...${cc_normal}" - -# Clone latest git (develop branch) -# change "develop" for any other branch you want. - - -pip install -e 'git://leap.se/leap_client@develop#egg=leap-client' - -cd leap-client-testbuild - -# symlink the pyside libraries to the system libs -./src/leap-client/pkg/postmkvenv.sh - -echo "${cc_green}leap-client installed! =)" -echo "${cc_yellow}" -echo "Launch it with: " -echo "~~~~~~~~~~~~~~~~~~~~~~" -echo "bin/leap-client" -echo "~~~~~~~~~~~~~~~~~~~~~~" -echo "${cc_normal}" -- cgit v1.2.3 From ca1c9e01fecd74150399d5829d3255337be8f10a Mon Sep 17 00:00:00 2001 From: Kali Kaneko Date: Wed, 4 Sep 2013 18:13:19 +0200 Subject: Fix invocation of the helper polkit-agent launcher. Otherwise, we are dumped into a nasty console. --- src/leap/bitmask/services/eip/vpnlaunchers.py | 8 +++++++- src/leap/bitmask/util/polkit_agent.py | 24 ++++++++++++------------ 2 files changed, 19 insertions(+), 13 deletions(-) diff --git a/src/leap/bitmask/services/eip/vpnlaunchers.py b/src/leap/bitmask/services/eip/vpnlaunchers.py index 49edc8eb..a50da8b9 100644 --- a/src/leap/bitmask/services/eip/vpnlaunchers.py +++ b/src/leap/bitmask/services/eip/vpnlaunchers.py @@ -32,6 +32,7 @@ except ImportError: from abc import ABCMeta, abstractmethod from functools import partial +from time import sleep from leap.bitmask.config.leapsettings import LeapSettings @@ -228,7 +229,11 @@ def _try_to_launch_agent(standalone=False): env = { "PYTHONPATH": os.path.abspath('../../../../lib/')} try: - subprocess.call(["python", "-m", "leap.bitmask.util.polkit_agent"], + # We need to quote the command because subprocess call + # will do "sh -c 'foo'", so if we do not quoute it we'll end + # up with a invocation to the python interpreter. And that + # is bad. + subprocess.call(["python -m leap.bitmask.util.polkit_agent"], shell=True, env=env) except Exception as exc: logger.exception(exc) @@ -316,6 +321,7 @@ class LinuxVPNLauncher(VPNLauncher): if _is_pkexec_in_system(): if not _is_auth_agent_running(): _try_to_launch_agent(ProviderConfig.standalone) + sleep(0.5) if _is_auth_agent_running(): pkexec_possibilities = which(kls.PKEXEC_BIN) leap_assert(len(pkexec_possibilities) > 0, diff --git a/src/leap/bitmask/util/polkit_agent.py b/src/leap/bitmask/util/polkit_agent.py index a4650273..6fda2f88 100644 --- a/src/leap/bitmask/util/polkit_agent.py +++ b/src/leap/bitmask/util/polkit_agent.py @@ -24,24 +24,24 @@ import daemon logger = logging.getLogger(__name__) -BASE_PATH = "/usr/lib/policykit-1-gnome/"\ - + "polkit-%s-authentication-agent-1" - -GNOME_PATH = BASE_PATH % ("gnome",) -KDE_PATH = BASE_PATH % ("kde",) +AUTH_FILE = "polkit-%s-authentication-agent-1" +BASE_PATH_GNO = "/usr/lib/policykit-1-gnome/" +BASE_PATH_KDE = "/usr/lib/kde4/libexec/" +GNO_PATH = BASE_PATH_GNO + AUTH_FILE % ("gnome",) +KDE_PATH = BASE_PATH_KDE + AUTH_FILE % ("kde",) def _launch_agent(): logger.debug('Launching polkit auth agent') - print "launching polkit" try: - subprocess.call(GNOME_PATH) + subprocess.call(GNO_PATH) except Exception as exc: - try: - subprocess.call(KDE_PATH) - except Exception as exc: - logger.error('Exception while running polkit authentication agent ' - '%s' % (exc,)) + logger.error('Exception while running polkit authentication agent ' + '%s' % (exc,)) + # XXX fix KDE launch. See: #3755 + #try: + #subprocess.call(KDE_PATH) + #except Exception as exc: def launch(): -- cgit v1.2.3 From 6d2c5a14f51363a791fbc264f7e8d6cb4b69b6d2 Mon Sep 17 00:00:00 2001 From: Ivan Alejandro Date: Thu, 5 Sep 2013 15:54:33 -0300 Subject: Fix test checking is_release_version helper. --- src/leap/bitmask/util/tests/test_is_release_version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/leap/bitmask/util/tests/test_is_release_version.py b/src/leap/bitmask/util/tests/test_is_release_version.py index 088ec66d..0a0093da 100644 --- a/src/leap/bitmask/util/tests/test_is_release_version.py +++ b/src/leap/bitmask/util/tests/test_is_release_version.py @@ -19,7 +19,7 @@ tests for _is_release_version function """ import unittest -from leap.bitmask.util import _is_release_version as is_release_version +from leap.bitmask import _is_release_version as is_release_version from leap.common.testing.basetest import BaseLeapTest -- cgit v1.2.3 From 58420cb3d10cd5eceacbd88a6bc7fdfdc4a85f88 Mon Sep 17 00:00:00 2001 From: Ivan Alejandro Date: Thu, 5 Sep 2013 16:34:20 -0300 Subject: Display the mx status in the system tray. --- changes/feature-3659_display-email-status-in-tray | 1 + src/leap/bitmask/gui/mainwindow.py | 9 +++- src/leap/bitmask/gui/statuspanel.py | 50 +++++++++++++++++------ 3 files changed, 47 insertions(+), 13 deletions(-) create mode 100644 changes/feature-3659_display-email-status-in-tray diff --git a/changes/feature-3659_display-email-status-in-tray b/changes/feature-3659_display-email-status-in-tray new file mode 100644 index 00000000..36469c59 --- /dev/null +++ b/changes/feature-3659_display-email-status-in-tray @@ -0,0 +1 @@ + o Display encrypted mail status in the tray. Closes #3659. diff --git a/src/leap/bitmask/gui/mainwindow.py b/src/leap/bitmask/gui/mainwindow.py index 706b9c2a..0950462b 100644 --- a/src/leap/bitmask/gui/mainwindow.py +++ b/src/leap/bitmask/gui/mainwindow.py @@ -254,14 +254,20 @@ class MainWindow(QtGui.QMainWindow): self._action_eip_provider = QtGui.QAction( self.tr("No default provider"), self) self._action_eip_provider.setEnabled(False) + self._action_eip_status = QtGui.QAction( self.tr("Encrypted internet is OFF"), self) self._action_eip_status.setEnabled(False) - self._status_panel.set_action_eip_status( self._action_eip_status) + self._action_mail_status = QtGui.QAction( + self.tr("Encrypted Mail is OFF"), self) + self._action_mail_status.setEnabled(False) + self._status_panel.set_action_mail_status( + self._action_mail_status) + self._action_eip_startstop = QtGui.QAction( self.tr("Turn OFF"), self) self._action_eip_startstop.triggered.connect( @@ -623,6 +629,7 @@ class MainWindow(QtGui.QMainWindow): systrayMenu.addAction(self._action_eip_provider) systrayMenu.addAction(self._action_eip_status) systrayMenu.addAction(self._action_eip_startstop) + systrayMenu.addAction(self._action_mail_status) systrayMenu.addSeparator() systrayMenu.addAction(self._action_preferences) systrayMenu.addAction(help_action) diff --git a/src/leap/bitmask/gui/statuspanel.py b/src/leap/bitmask/gui/statuspanel.py index 49d7e24a..3a91f08e 100644 --- a/src/leap/bitmask/gui/statuspanel.py +++ b/src/leap/bitmask/gui/statuspanel.py @@ -356,6 +356,16 @@ class StatusPanelWidget(QtGui.QWidget): leap_assert_type(action_eip_status, QtGui.QAction) self._action_eip_status = action_eip_status + def set_action_mail_status(self, action_mail_status): + """ + Sets the action_mail_status to use. + + :param action_mail_status: action_mail_status to be used + :type action_mail_status: QtGui.QAction + """ + leap_assert_type(action_mail_status, QtGui.QAction) + self._action_mail_status = action_mail_status + def set_global_status(self, status, error=False): """ Sets the global status label. @@ -538,6 +548,27 @@ class StatusPanelWidget(QtGui.QWidget): def set_provider(self, provider): self.ui.lblProvider.setText(provider) + def _set_mail_status(self, status, ready=False): + """ + Sets the Encrypted Mail status in the label and in the tray icon. + + :param status: the status text to display + :type status: unicode + :param ready: if mx is ready or not. + :type ready: bool + """ + self.ui.lblMailStatus.setText(status) + + tray_status = self.tr('Encrypted Mail is OFF') + + icon = QtGui.QPixmap(self.MAIL_OFF_ICON) + if ready: + icon = QtGui.QPixmap(self.MAIL_ON_ICON) + tray_status = self.tr('Encrypted Mail is ON') + + self.ui.lblMailIcon.setPixmap(icon) + self._action_mail_status.setText(tray_status) + def _mail_handle_soledad_events(self, req): """ Callback for ... @@ -557,7 +588,7 @@ class StatusPanelWidget(QtGui.QWidget): :param req: Request type :type req: leap.common.events.events_pb2.SignalRequest """ - self.ui.lblMailStatus.setText(self.tr("Starting...")) + self._set_mail_status(self.tr("Starting...")) ext_status = "" @@ -596,7 +627,7 @@ class StatusPanelWidget(QtGui.QWidget): if self._smtp_started and self._imap_started: return - self.ui.lblMailStatus.setText(self.tr("Starting...")) + self._set_mail_status(self.tr("Starting...")) ext_status = "" @@ -644,14 +675,11 @@ class StatusPanelWidget(QtGui.QWidget): ext_status = self.tr("SMTP has started...") self._smtp_started = True if self._smtp_started and self._imap_started: - self.ui.lblMailStatus.setText(self.tr("ON")) - self.ui.lblMailIcon.setPixmap(QtGui.QPixmap(self.MAIL_ON_ICON)) - self.ui.lblMailIcon.setPixmap( - QtGui.QPixmap(":/images/mail-locked.png")) + self._set_mail_status(self.tr("ON"), ready=True) ext_status = "" elif req.event == proto.SMTP_SERVICE_FAILED_TO_START: ext_status = self.tr("SMTP failed to start, check the logs.") - self.ui.lblMailStatus.setText(self.tr("Failed")) + self._set_mail_status(self.tr("Failed")) else: leap_assert(False, "Don't know how to handle this state: %s" @@ -684,19 +712,17 @@ class StatusPanelWidget(QtGui.QWidget): ext_status = self.tr("IMAP has started...") self._imap_started = True if self._smtp_started and self._imap_started: - self.ui.lblMailStatus.setText(self.tr("ON")) - self.ui.lblMailIcon.setPixmap(QtGui.QPixmap(self.MAIL_ON_ICON)) + self._set_mail_status(self.tr("ON"), ready=True) ext_status = "" elif req.event == proto.IMAP_SERVICE_FAILED_TO_START: ext_status = self.tr("IMAP failed to start, check the logs.") - self.ui.lblMailStatus.setText(self.tr("Failed")) + self._set_mail_status(self.tr("Failed")) elif req.event == proto.IMAP_UNREAD_MAIL: if self._smtp_started and self._imap_started: self.ui.lblUnread.setText( self.tr("%s Unread Emails") % (req.content)) self.ui.lblUnread.setVisible(req.content != "0") - self.ui.lblMailStatus.setText(self.tr("ON")) - self.ui.lblMailIcon.setPixmap(QtGui.QPixmap(self.MAIL_ON_ICON)) + self._set_mail_status(self.tr("ON"), ready=True) else: leap_assert(False, "Don't know how to handle this state: %s" -- cgit v1.2.3 From d89d0c79e279ce2103021deabd226f67986e52c1 Mon Sep 17 00:00:00 2001 From: Kali Kaneko Date: Thu, 5 Sep 2013 21:55:52 +0200 Subject: re-add mock as testing dep --- pkg/requirements-testing.pip | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/requirements-testing.pip b/pkg/requirements-testing.pip index 2df5fe56..e789664a 100644 --- a/pkg/requirements-testing.pip +++ b/pkg/requirements-testing.pip @@ -1,6 +1,7 @@ nose nose-exclude nose-progressive +mock unittest2 # TODO we should include this dep only for python2.6 @@ -13,6 +14,5 @@ tox # double reqs # (the client already includes, which gives some errors) # ----------- -# mock # re-add XXX #twisted #zope.interface -- cgit v1.2.3 From 0292e05ea741bea0fd4fe22b799fd2eead0bd67e Mon Sep 17 00:00:00 2001 From: Kali Kaneko Date: Thu, 5 Sep 2013 23:05:00 +0200 Subject: Set keyring version to < 3.0 because of version compat proble --- pkg/requirements.pip | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pkg/requirements.pip b/pkg/requirements.pip index 7d0f79af..b39960b7 100644 --- a/pkg/requirements.pip +++ b/pkg/requirements.pip @@ -18,6 +18,8 @@ qt4reactor python-gnupg python-daemon # this should not be needed for Windows. +keyring<3.0.0 # See #3759 + leap.common>=0.3.0 leap.soledad.client>=0.3.0 leap.keymanager>=0.2.0 -- cgit v1.2.3 From 8429d35de46942dc86be2644df84d785f3b4c48f Mon Sep 17 00:00:00 2001 From: Ivan Alejandro Date: Fri, 6 Sep 2013 12:02:37 -0300 Subject: Hotfix: recursive rm and fetch before checkout. --- pkg/linux/build_bundle.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkg/linux/build_bundle.sh b/pkg/linux/build_bundle.sh index 781884cb..e6a1043f 100755 --- a/pkg/linux/build_bundle.sh +++ b/pkg/linux/build_bundle.sh @@ -9,13 +9,14 @@ DEST=$5 rm $TEMPLATE_BUNDLE/CHANGELOG rm $TEMPLATE_BUNDLE/relnotes.txt rm -rf $TEMPLATE_BUNDLE/apps/leap -rm $TEMPLATE_BUNDLE/lib/leap/{common,keymanager,soledad,mail} +rm -rf $TEMPLATE_BUNDLE/lib/leap/{common,keymanager,soledad,mail} # checkout VERSION in all repos for i in {leap_client,leap_pycommon,soledad,keymanager,leap_mail} do cd $REPOS_ROOT/$i + git fetch git checkout $VERSION done -- cgit v1.2.3 From 869989b3ce7e1aee3f70fbced91d3c76cd27045a Mon Sep 17 00:00:00 2001 From: Kali Kaneko Date: Fri, 6 Sep 2013 18:24:49 +0200 Subject: add x bit --- pkg/scripts/bitmask_bootstrap.sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 pkg/scripts/bitmask_bootstrap.sh diff --git a/pkg/scripts/bitmask_bootstrap.sh b/pkg/scripts/bitmask_bootstrap.sh old mode 100644 new mode 100755 -- cgit v1.2.3 From 1a705bf59367540098438f4303491ac45801cc9f Mon Sep 17 00:00:00 2001 From: Kali Kaneko Date: Fri, 6 Sep 2013 19:28:32 +0200 Subject: bump relnotes to 0.3.2 --- relnotes.txt | 80 +++++++++++++++++++++++++++++++++++++----------------------- 1 file changed, 50 insertions(+), 30 deletions(-) diff --git a/relnotes.txt b/relnotes.txt index 5f711005..349b430c 100644 --- a/relnotes.txt +++ b/relnotes.txt @@ -1,42 +1,57 @@ -ANNOUNCING Bitmask, the internet encryption toolkit, v0.3.0 +ANNOUNCING Bitmask, the internet encryption toolkit, release 0.3.2 The LEAP team is pleased to announce the immediate availability of -version 0.3.0 of Bitmask +version 0.3.2 of Bitmask, the Internet Encryption Toolkit. https://downloads.leap.se/client/ LEAP (LEAP Encryption Access Project) develops a plan to secure everyday communication, breaking down into discrete services. -The client for the current phase gives support to the EIP Service and -the first beta release of Encrypted Mail. -EIP (the Encrypted Internet Proxy) provides circumvention, -location anonymization, and traffic encryption in a hassle-free, -automatically self-configuring fashion. -Encrypted Mail +Bitmask is the desktop client to connect to the services offered +by the LEAP Platform. In the current phase the supported services are +Encrypted Internet Proxy and Encrypted Mail. -You can read the user manual and the developer notes online at: +The Encrypted Internet Proxy provides circumvention, location anonymization, +and traffic encryption in a hassle-free, automatically self-configuring +fashion. -http://bitmask.readthedocs.org/ +Encrypted Mail offers automatic encryption and decryption for both outgoing +and incoming email, adding public key cryptography to your mail without you +ever having to worry about key distribution or signature verification. -WARNING: This is still a beta release of our services, a lot of -testing and audits are still needed so DO NOT use this for strong -security. +You can read about this and many other cool things in the user manual and the +developer notes, which can be found online at: +http://bitmask.rtfd.org/ -WHAT CAN THIS VERSION OF THE CLIENT DO FOR ME? +WARNING: This is still part of a beta release of our software, a lot of testing and +auditing is still needed, so indeed use it, and feed us back, fork it and contribute +to its development, but by any means DO NOT trust your life to it (yet!). -You can connect to the EIP service offered by a provider of your -choice, and enjoy a encrypted internet connection. -The first run wizard allows to register an user with the selected -provider, downloading all the config files needed to connect to the -eip service. There are also some minimal network checks in place. +WHAT CAN THIS VERSION OF BITMASK DO FOR ME? +Bitmask 0.3.2 is mostly a bugfix release, with some minor improvements. Mail +service is a bit more polished, and we are slowly making our potential packagers +happy. Refer to the CHANGELOG for the funny details. -LICENCE +You can connect to the Encrypted Internet Proxy service offered by a provider of +your choice, and enjoy a encrypted internet connection that the spying eyes can only +track back to your provider. -You may use this package under the GNU General Public License, +The Encrypted Mail services will run local SMTP and IMAP proxies that, once you +configure the mail client of your choice, will automatically encrypt and decrypt +your email using GPG encryption under the hood. + +The first run wizard will help you registering an user with your selected +provider, downloading all the config files needed to connect to the various LEAP +services. + + +LICENSE + +You may use Bitmask under the GNU General Public License, version 3 or, at your option, any later version. See the file "COPYING.GPL" for the terms of the GNU General Public License, version 3. @@ -50,15 +65,18 @@ including the two. INSTALLATION -The current version of the LEAP Client has been tested on GNU/Linux -and OSX, but it is likely that you are able to run it under other -systems, specially if you are skillful and patient is one of your +We distribute the current version of Bitmask as standalone bundles +for GNU/Linux and OSX, but it is likely that you are able to run it under +other systems, specially if you are skillful and patience is one of your virtues. Have a look at "docs/user/install.rst". -Packages are provided for debian and ubuntu. OSX and win installers -will be following soon. +Packages will be soon provided for debian and ubuntu, and the release of +windows bundles will be resumed shortly. + +We will love to hear if you are interested in help making packages available for +any other system. BUGS @@ -71,11 +89,13 @@ intensive bug-reeducation program. HACKING You can find us in the #leap-dev channel on the freenode network. -If you are lucky enough, you can spot us sleepless in night trains, -rooftops, rainforests, and beyond any border. + +If you are lucky enough, you can also spot us drinking mate, sleepless in +night trains, rooftops, rainforests, lonely islands and, always, beyond +any border. -The LEAP team. +The LEAP team, -Aug 9, 2013 +Sep 06, 2013 Somewhere in the middle of the intertubes. -- cgit v1.2.3 From e9e0afc4096b4ba054496e39b3f4965262dd44ce Mon Sep 17 00:00:00 2001 From: Ivan Alejandro Date: Fri, 6 Sep 2013 16:17:32 -0300 Subject: Update requirements for 0.3.2 --- changes/VERSION_COMPAT | 7 ------- pkg/requirements.pip | 4 ++-- 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/changes/VERSION_COMPAT b/changes/VERSION_COMPAT index cd6e4ef1..cc00ecf7 100644 --- a/changes/VERSION_COMPAT +++ b/changes/VERSION_COMPAT @@ -8,10 +8,3 @@ # # BEGIN DEPENDENCY LIST ------------------------- # leap.foo.bar>=x.y.z - -leap.common>=0.3.2 -# leap.common.config.get_path_prefix -# -leap.mail>=0.3.2 -# smtp returns factory - diff --git a/pkg/requirements.pip b/pkg/requirements.pip index b39960b7..77cdf17c 100644 --- a/pkg/requirements.pip +++ b/pkg/requirements.pip @@ -20,10 +20,10 @@ python-daemon # this should not be needed for Windows. keyring<3.0.0 # See #3759 -leap.common>=0.3.0 +leap.common>=0.3.2 leap.soledad.client>=0.3.0 leap.keymanager>=0.2.0 -leap.mail>=0.3.0 +leap.mail>=0.3.2 # Remove this when u1db fixes its dependency on oauth oauth -- cgit v1.2.3 From e53894257a8f73ae66836468f140eeb3393ad35e Mon Sep 17 00:00:00 2001 From: Ivan Alejandro Date: Fri, 6 Sep 2013 16:18:04 -0300 Subject: Fold in changes. --- CHANGELOG | 20 ++++++++++++++++++++ .../bug-3582_set-appropiate-message-on-login-cancel | 1 - changes/bug-3595_fix-gateway-selection-problem | 1 - .../bug-3657_display-correct-service-name-in-wiard | 1 - changes/bug-3675_qfiledialog-and-qtreactor-freezes | 1 - .../bug-3717_enable-preferences-option-in-systray | 1 - changes/bug-fail-soledad-when-socketerr | 1 - changes/bug_3450-fix-up-script | 1 - changes/bug_3553_logout-stop-mail | 1 - changes/bug_3554_fix-polkit-auth-agent | 1 - changes/bug_3615-wizard-typo | 1 - changes/bug_3711-warn-with-python3 | 1 - .../feature-3505_preferences-select-gateway-manually | 1 - .../feature-3534_preference-select-enabled-services | 1 - changes/feature-3552_refactor-basic-password-checks | 1 - .../feature-3574_use-dirspec-instead-of-plain-xdg | 1 - changes/feature-3616_remove-last-page-from-wizard | 1 - changes/feature-3659_display-email-status-in-tray | 1 - changes/feature_3504_add_log_silencer | 1 - 19 files changed, 20 insertions(+), 18 deletions(-) delete mode 100644 changes/bug-3582_set-appropiate-message-on-login-cancel delete mode 100644 changes/bug-3595_fix-gateway-selection-problem delete mode 100644 changes/bug-3657_display-correct-service-name-in-wiard delete mode 100644 changes/bug-3675_qfiledialog-and-qtreactor-freezes delete mode 100644 changes/bug-3717_enable-preferences-option-in-systray delete mode 100644 changes/bug-fail-soledad-when-socketerr delete mode 100644 changes/bug_3450-fix-up-script delete mode 100644 changes/bug_3553_logout-stop-mail delete mode 100644 changes/bug_3554_fix-polkit-auth-agent delete mode 100644 changes/bug_3615-wizard-typo delete mode 100644 changes/bug_3711-warn-with-python3 delete mode 100644 changes/feature-3505_preferences-select-gateway-manually delete mode 100644 changes/feature-3534_preference-select-enabled-services delete mode 100644 changes/feature-3552_refactor-basic-password-checks delete mode 100644 changes/feature-3574_use-dirspec-instead-of-plain-xdg delete mode 100644 changes/feature-3616_remove-last-page-from-wizard delete mode 100644 changes/feature-3659_display-email-status-in-tray delete mode 100644 changes/feature_3504_add_log_silencer diff --git a/CHANGELOG b/CHANGELOG index f8def7cb..577bb6ca 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,23 @@ +0.3.2 Sep 9: + o Fix up script in non-bundle linuces. Closes: #3450 + o Logout stops imap and smtp services. Closes: #3553 + o Properly daemonize polkit-gnome-authentication-agent. Closes: #3554 + o Set appropiate error on login cancel. Closes #3582. + o Fix gateway selection problem. Closes 3595. + o Fix typo in wizard: stablish -> establish. Closes #3615. + o Display Encrypted Mail instead of mx in wizard. Closes #3657. + o Fix save logs to file dialog freezing. Closes #3675. + o Complain if setup.py is run with python3. Closes: #3711 + o Enable preferences option in systray. Closes #3717. + o Make soledad emit failed signal for all kinds of socket error. + o Allow to selectively silence logs from different leap components. Closes: #3504 + o Add option to select gateway manually in the preferences panel. Closes #3505. + o Add preferences option to select the enabled services of a provider. Closes #3534. + o Refactor basic password checks. Closes #3552. + o Use dirspec instead of plain xdg. Closes #3574. + o Remove last page from wizard. Closes #3616. + o Display encrypted mail status in the tray. Closes #3659. + 0.3.1 Aug 23: o Replace wizard images with the rainbow mask. Closes #3425. o Update leap.common minimum version needed. diff --git a/changes/bug-3582_set-appropiate-message-on-login-cancel b/changes/bug-3582_set-appropiate-message-on-login-cancel deleted file mode 100644 index 3ad11490..00000000 --- a/changes/bug-3582_set-appropiate-message-on-login-cancel +++ /dev/null @@ -1 +0,0 @@ - o Set appropiate error on login cancel. Closes #3582. diff --git a/changes/bug-3595_fix-gateway-selection-problem b/changes/bug-3595_fix-gateway-selection-problem deleted file mode 100644 index 7225eed0..00000000 --- a/changes/bug-3595_fix-gateway-selection-problem +++ /dev/null @@ -1 +0,0 @@ - o Fix gateway selection problem. Closes 3595. diff --git a/changes/bug-3657_display-correct-service-name-in-wiard b/changes/bug-3657_display-correct-service-name-in-wiard deleted file mode 100644 index 4fe3d0b1..00000000 --- a/changes/bug-3657_display-correct-service-name-in-wiard +++ /dev/null @@ -1 +0,0 @@ - o Display Encrypted Mail instead of mx in wizard. Closes #3657. diff --git a/changes/bug-3675_qfiledialog-and-qtreactor-freezes b/changes/bug-3675_qfiledialog-and-qtreactor-freezes deleted file mode 100644 index fa0ef6a2..00000000 --- a/changes/bug-3675_qfiledialog-and-qtreactor-freezes +++ /dev/null @@ -1 +0,0 @@ - o Fix save logs to file dialog freezing. Closes #3675. diff --git a/changes/bug-3717_enable-preferences-option-in-systray b/changes/bug-3717_enable-preferences-option-in-systray deleted file mode 100644 index 8f9f30d1..00000000 --- a/changes/bug-3717_enable-preferences-option-in-systray +++ /dev/null @@ -1 +0,0 @@ - o Enable preferences option in systray. Closes #3717. diff --git a/changes/bug-fail-soledad-when-socketerr b/changes/bug-fail-soledad-when-socketerr deleted file mode 100644 index 2bb6696a..00000000 --- a/changes/bug-fail-soledad-when-socketerr +++ /dev/null @@ -1 +0,0 @@ - o Make soledad emit failed signal for all kinds of socket error. diff --git a/changes/bug_3450-fix-up-script b/changes/bug_3450-fix-up-script deleted file mode 100644 index 39b3638e..00000000 --- a/changes/bug_3450-fix-up-script +++ /dev/null @@ -1 +0,0 @@ - o Fix up script in non-bundle linuces. Closes: #3450 diff --git a/changes/bug_3553_logout-stop-mail b/changes/bug_3553_logout-stop-mail deleted file mode 100644 index ee898137..00000000 --- a/changes/bug_3553_logout-stop-mail +++ /dev/null @@ -1 +0,0 @@ - o Logout stops imap and smtp services. Closes: #3553 diff --git a/changes/bug_3554_fix-polkit-auth-agent b/changes/bug_3554_fix-polkit-auth-agent deleted file mode 100644 index 9498868b..00000000 --- a/changes/bug_3554_fix-polkit-auth-agent +++ /dev/null @@ -1 +0,0 @@ - o Properly daemonize polkit-gnome-authentication-agent. Closes: #3554 diff --git a/changes/bug_3615-wizard-typo b/changes/bug_3615-wizard-typo deleted file mode 100644 index 89e18174..00000000 --- a/changes/bug_3615-wizard-typo +++ /dev/null @@ -1 +0,0 @@ - o Fix typo in wizard: stablish -> establish. Closes #3615. diff --git a/changes/bug_3711-warn-with-python3 b/changes/bug_3711-warn-with-python3 deleted file mode 100644 index 79271caf..00000000 --- a/changes/bug_3711-warn-with-python3 +++ /dev/null @@ -1 +0,0 @@ - o Complain if setup.py is run with python3. Closes: #3711 diff --git a/changes/feature-3505_preferences-select-gateway-manually b/changes/feature-3505_preferences-select-gateway-manually deleted file mode 100644 index de414e6b..00000000 --- a/changes/feature-3505_preferences-select-gateway-manually +++ /dev/null @@ -1 +0,0 @@ - o Add option to select gateway manually in the preferences panel. Closes #3505. diff --git a/changes/feature-3534_preference-select-enabled-services b/changes/feature-3534_preference-select-enabled-services deleted file mode 100644 index e3376877..00000000 --- a/changes/feature-3534_preference-select-enabled-services +++ /dev/null @@ -1 +0,0 @@ - o Add preferences option to select the enabled services of a provider. Closes #3534. diff --git a/changes/feature-3552_refactor-basic-password-checks b/changes/feature-3552_refactor-basic-password-checks deleted file mode 100644 index 314f5a02..00000000 --- a/changes/feature-3552_refactor-basic-password-checks +++ /dev/null @@ -1 +0,0 @@ - o Refactor basic password checks. Closes #3552. diff --git a/changes/feature-3574_use-dirspec-instead-of-plain-xdg b/changes/feature-3574_use-dirspec-instead-of-plain-xdg deleted file mode 100644 index 9bdc5071..00000000 --- a/changes/feature-3574_use-dirspec-instead-of-plain-xdg +++ /dev/null @@ -1 +0,0 @@ - o Use dirspec instead of plain xdg. Closes #3574. diff --git a/changes/feature-3616_remove-last-page-from-wizard b/changes/feature-3616_remove-last-page-from-wizard deleted file mode 100644 index cc02c02c..00000000 --- a/changes/feature-3616_remove-last-page-from-wizard +++ /dev/null @@ -1 +0,0 @@ - o Remove last page from wizard. Closes #3616. diff --git a/changes/feature-3659_display-email-status-in-tray b/changes/feature-3659_display-email-status-in-tray deleted file mode 100644 index 36469c59..00000000 --- a/changes/feature-3659_display-email-status-in-tray +++ /dev/null @@ -1 +0,0 @@ - o Display encrypted mail status in the tray. Closes #3659. diff --git a/changes/feature_3504_add_log_silencer b/changes/feature_3504_add_log_silencer deleted file mode 100644 index 7c551162..00000000 --- a/changes/feature_3504_add_log_silencer +++ /dev/null @@ -1 +0,0 @@ - o Allow to selectively silence logs from different leap components. Closes: #3504 -- cgit v1.2.3 From 6df266025131673a91ff40bbb715e836aaf1b49a Mon Sep 17 00:00:00 2001 From: Ivan Alejandro Date: Mon, 9 Sep 2013 09:13:30 -0300 Subject: Fix path prefix helper for bundle and add test. --- changes/bug-3778_fix-path-prefix-helper | 1 + src/leap/bitmask/config/leapsettings.py | 12 ++-- src/leap/bitmask/config/tests/test_leapsettings.py | 71 ++++++++++++++++++++++ 3 files changed, 78 insertions(+), 6 deletions(-) create mode 100644 changes/bug-3778_fix-path-prefix-helper create mode 100644 src/leap/bitmask/config/tests/test_leapsettings.py diff --git a/changes/bug-3778_fix-path-prefix-helper b/changes/bug-3778_fix-path-prefix-helper new file mode 100644 index 00000000..e7cec539 --- /dev/null +++ b/changes/bug-3778_fix-path-prefix-helper @@ -0,0 +1 @@ + o Fix path prefix helper for the bundle and add regresion tests. Closes #3778. diff --git a/src/leap/bitmask/config/leapsettings.py b/src/leap/bitmask/config/leapsettings.py index ad67b29e..7d8b5977 100644 --- a/src/leap/bitmask/config/leapsettings.py +++ b/src/leap/bitmask/config/leapsettings.py @@ -75,12 +75,12 @@ class LeapSettings(object): """ Constructor - :param standalone: parameter used to define the location of - the config + :param standalone: parameter used to define the location of the config. :type standalone: bool """ - settings_path = os.path.join( - get_path_prefix(standalone=standalone), "leap", self.CONFIG_NAME) + self._path_prefix = get_path_prefix(standalone=standalone) + settings_path = os.path.join(self._path_prefix, + "leap", self.CONFIG_NAME) self._settings = QtCore.QSettings(settings_path, QtCore.QSettings.IniFormat) @@ -132,8 +132,8 @@ class LeapSettings(object): # other things, not just the directories providers = [] try: - providers_path = os.path.join( - get_path_prefix(), "leap", "providers") + providers_path = os.path.join(self._path_prefix, + "leap", "providers") providers = os.listdir(providers_path) except Exception as e: logger.debug("Error listing providers, assume there are none. %r" diff --git a/src/leap/bitmask/config/tests/test_leapsettings.py b/src/leap/bitmask/config/tests/test_leapsettings.py new file mode 100644 index 00000000..18166923 --- /dev/null +++ b/src/leap/bitmask/config/tests/test_leapsettings.py @@ -0,0 +1,71 @@ +# -*- coding: utf-8 -*- +# test_leapsettings.py +# Copyright (C) 2013 LEAP +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +""" +Tests for leapsettings module. +""" + +try: + import unittest2 as unittest +except ImportError: + import unittest + +import os +import mock + +from leap.common.testing.basetest import BaseLeapTest +from leap.bitmask.config.leapsettings import LeapSettings + + +class LeapSettingsTest(BaseLeapTest): + """Tests for LeapSettings""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def test_get_configured_providers(self): + """ + Test that the config file IS NOT stored under the CWD. + """ + self._leapsettings = LeapSettings() + with mock.patch('os.listdir') as os_listdir: + # use this method only to spy where LeapSettings is looking for + self._leapsettings.get_configured_providers() + args, kwargs = os_listdir.call_args + config_dir = args[0] + self.assertFalse(config_dir.startswith(os.getcwd())) + self.assertFalse(config_dir.endswith('config')) + + def test_get_configured_providers_in_bundle(self): + """ + Test that the config file IS stored under the CWD. + """ + self._leapsettings = LeapSettings(standalone=True) + with mock.patch('os.listdir') as os_listdir: + # use this method only to spy where LeapSettings is looking for + self._leapsettings.get_configured_providers() + args, kwargs = os_listdir.call_args + config_dir = args[0] + self.assertTrue(config_dir.startswith(os.getcwd())) + self.assertFalse(config_dir.endswith('config')) + + +if __name__ == "__main__": + unittest.main() -- cgit v1.2.3 From f72e3c5d02b5d8c2272359b2bd6cd4963ddfe9cb Mon Sep 17 00:00:00 2001 From: Kali Kaneko Date: Wed, 11 Sep 2013 12:41:51 +0200 Subject: catch indexerror on first utility --- changes/bug_fix-first | 1 + src/leap/bitmask/util/__init__.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) create mode 100644 changes/bug_fix-first diff --git a/changes/bug_fix-first b/changes/bug_fix-first new file mode 100644 index 00000000..0ef5188c --- /dev/null +++ b/changes/bug_fix-first @@ -0,0 +1 @@ + o Catch IndexError on `first` utility. diff --git a/src/leap/bitmask/util/__init__.py b/src/leap/bitmask/util/__init__.py index 6dd18bcf..78efcb6e 100644 --- a/src/leap/bitmask/util/__init__.py +++ b/src/leap/bitmask/util/__init__.py @@ -27,7 +27,7 @@ def first(things): """ try: return things[0] - except TypeError: + except (IndexError, TypeError): return None -- cgit v1.2.3 From a114a0003695ed8a31277b83f99dd64a100988ed Mon Sep 17 00:00:00 2001 From: Kali Kaneko Date: Tue, 10 Sep 2013 19:13:15 +0200 Subject: do not try to install globally. --- changes/bug_3803-do-not-install-resolv-update-globally | 1 + setup.py | 10 +++++----- 2 files changed, 6 insertions(+), 5 deletions(-) create mode 100644 changes/bug_3803-do-not-install-resolv-update-globally diff --git a/changes/bug_3803-do-not-install-resolv-update-globally b/changes/bug_3803-do-not-install-resolv-update-globally new file mode 100644 index 00000000..f6e06d5f --- /dev/null +++ b/changes/bug_3803-do-not-install-resolv-update-globally @@ -0,0 +1 @@ + o Do not try to install resolv-update globally. Closes: #3803 diff --git a/setup.py b/setup.py index 5099c1b1..88cb0e40 100755 --- a/setup.py +++ b/setup.py @@ -135,17 +135,17 @@ import platform _system = platform.system() IS_LINUX = True if _system == "Linux" else False +data_files = [] + if IS_LINUX: + # XXX use check_for_permissions to install data + # globally. See #3805 data_files = [ - # ("share/man/man1", - # ["docs/man/bitmask.1"]), ("share/polkit-1/actions", ["pkg/linux/polkit/net.openvpn.gui.leap.policy"]), - ("/etc/leap/", + ("etc/leap/", ["pkg/linux/resolv-update"]), ] -else: - data_files = [] setup( name="leap.bitmask", -- cgit v1.2.3 From 899d4d74c93016f907d43551972e66fcb7b86262 Mon Sep 17 00:00:00 2001 From: Kali Kaneko Date: Wed, 11 Sep 2013 17:14:33 +0200 Subject: Fix the format for the keyring requirement --- pkg/requirements.pip | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/requirements.pip b/pkg/requirements.pip index 77cdf17c..7fc2a75e 100644 --- a/pkg/requirements.pip +++ b/pkg/requirements.pip @@ -18,7 +18,7 @@ qt4reactor python-gnupg python-daemon # this should not be needed for Windows. -keyring<3.0.0 # See #3759 +keyring<=2.9 # See #3759 leap.common>=0.3.2 leap.soledad.client>=0.3.0 -- cgit v1.2.3 From 9568093138c85212e15d50ade5d5fc7dcec9ff6e Mon Sep 17 00:00:00 2001 From: Kali Kaneko Date: Thu, 12 Sep 2013 13:50:18 +0200 Subject: remove duplicated dependency --- pkg/requirements.pip | 1 - 1 file changed, 1 deletion(-) diff --git a/pkg/requirements.pip b/pkg/requirements.pip index 7fc2a75e..081f3ba9 100644 --- a/pkg/requirements.pip +++ b/pkg/requirements.pip @@ -9,7 +9,6 @@ argparse requests srp>=1.0.2 pyopenssl -keyring python-dateutil psutil ipaddr -- cgit v1.2.3 From 3e6dcdb705795110a10574d03bb74b13b542538f Mon Sep 17 00:00:00 2001 From: Kali Kaneko Date: Thu, 12 Sep 2013 14:32:13 +0200 Subject: update to 0.3.2 --- debian/changelog | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/debian/changelog b/debian/changelog index a52d6c96..1d5f1eb0 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +bitmask (0.3.2) unstable; urgency=low + + * Merge master for 0.3.2 release. + + -- Ben Carrillo Thu, 12 Sep 2013 14:30:01 +0200 + bitmask (0.3.1) unstable; urgency=low [ Ben Carrillo ] -- cgit v1.2.3