summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKali Kaneko <kali@leap.se>2015-09-21 15:51:34 -0400
committerKali Kaneko <kali@leap.se>2015-09-21 16:59:42 -0400
commitf292d910ae8bf98448dd02cd26e9e4f2ed8f6339 (patch)
tree234e7c37fe402e94e917d535e57ffcf8ec1e6293
parentce63b5a0277b3ff062d04a17af9e9a927b7d9b87 (diff)
[bug] add compatibility mode for platform < 0.8
there was a bug in plaform that made webapp not serve correctly the smtp certificates. with this fallback, we try to support platforms < 0.8, although we should deprecate this behavior in bitmask 0.10
-rw-r--r--src/leap/bitmask/services/mail/smtpbootstrapper.py25
1 files changed, 22 insertions, 3 deletions
diff --git a/src/leap/bitmask/services/mail/smtpbootstrapper.py b/src/leap/bitmask/services/mail/smtpbootstrapper.py
index a1b520ef..a577509e 100644
--- a/src/leap/bitmask/services/mail/smtpbootstrapper.py
+++ b/src/leap/bitmask/services/mail/smtpbootstrapper.py
@@ -18,6 +18,9 @@
SMTP bootstrapping
"""
import os
+import warnings
+
+from requests.exceptions import HTTPError
from leap.bitmask.config.providerconfig import ProviderConfig
from leap.bitmask.crypto.certs import download_client_cert
@@ -99,9 +102,25 @@ class SMTPBootstrapper(AbstractBootstrapper):
check_and_fix_urw_only(client_cert_path)
return
- download_client_cert(self._provider_config,
- client_cert_path,
- self._session, kind="smtp")
+ try:
+ download_client_cert(self._provider_config,
+ client_cert_path,
+ self._session, kind="smtp")
+ except HTTPError as exc:
+ if exc.message.startswith('403 Client Error'):
+ logger.debug(
+ 'Auth problem downloading smtp certificate... '
+ 'It might be a provider problem, will try '
+ 'fetching from vpn pool')
+ warnings.warn(
+ 'Compatibility hack for platform 0.7 not fully '
+ 'supporting smtp certificates. Will be deprecated in '
+ 'bitmask 0.10')
+ download_client_cert(self._provider_config,
+ client_cert_path,
+ self._session, kind="vpn")
+ else:
+ raise
def _start_smtp_service(self):
"""