summaryrefslogtreecommitdiff
path: root/service/pixelated/bitmask_libraries/smtp.py
diff options
context:
space:
mode:
authorBruno Wagner <bwgpro@gmail.com>2015-06-18 17:07:51 -0300
committerBruno Wagner <bwgpro@gmail.com>2015-06-18 17:07:51 -0300
commit89c9a1e1836098e2e55a225943d29e6d6474c240 (patch)
tree504a30363891ed568965f96fee5347a849530c50 /service/pixelated/bitmask_libraries/smtp.py
parentf5480053276dd211fd182da7ad6574b7636a8b7d (diff)
SMTP should be getting up properly again
The latest changes on the platform caused the user agent to be unable to download the smtp client certificate, receiving a 401 in response. I added the authorization header to the call on the user agent so that is fixed.
Diffstat (limited to 'service/pixelated/bitmask_libraries/smtp.py')
-rw-r--r--service/pixelated/bitmask_libraries/smtp.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/service/pixelated/bitmask_libraries/smtp.py b/service/pixelated/bitmask_libraries/smtp.py
index 759a2920..3e2d1b21 100644
--- a/service/pixelated/bitmask_libraries/smtp.py
+++ b/service/pixelated/bitmask_libraries/smtp.py
@@ -26,11 +26,12 @@ logger = logging.getLogger(__name__)
class LeapSmtp(object):
- def __init__(self, provider, username, session_id, keymanager=None):
+ def __init__(self, provider, username, session_id, user_token, keymanager=None):
self.local_smtp_port_number = random.randrange(12000, 16000)
self._provider = provider
self.username = username
self.session_id = session_id
+ self.user_token = user_token
self._keymanager = keymanager
self._remote_hostname, self._remote_port = self._discover_remote_smtp_server()
self._local_smtp_service_socket = None
@@ -58,12 +59,14 @@ class LeapSmtp(object):
cert_url = '%s/%s/cert' % (self._provider.api_uri, self._provider.api_version)
cookies = {"_session_id": self.session_id}
-
+ headers = {}
+ headers["Authorization"] = 'Token token="{0}"'.format(self.user_token)
response = requests.get(
cert_url,
verify=LeapCertificate(self._provider).provider_api_cert,
cookies=cookies,
- timeout=self._provider.config.timeout_in_s)
+ timeout=self._provider.config.timeout_in_s,
+ headers=headers)
response.raise_for_status()
client_cert = response.content