From 20962bdea85b9e0ac04ab9f714853ca8516cd7f4 Mon Sep 17 00:00:00 2001 From: Bruno Wagner Date: Tue, 3 Nov 2015 19:41:34 -0200 Subject: Issue #499 Moved remote smtp configuration We removed the common parts from the bitmask libraries smtp and adapted the tests. We also advanced the new mail sender implementation, but it is coupled to the twisted.mail.smtp.User currently and we need to adapt leap mail to remove this dependency --- service/pixelated/bitmask_libraries/provider.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'service/pixelated/bitmask_libraries/provider.py') diff --git a/service/pixelated/bitmask_libraries/provider.py b/service/pixelated/bitmask_libraries/provider.py index b7f82f8a..071b0bbf 100644 --- a/service/pixelated/bitmask_libraries/provider.py +++ b/service/pixelated/bitmask_libraries/provider.py @@ -14,6 +14,7 @@ # You should have received a copy of the GNU Affero General Public License # along with Pixelated. If not, see . import json +import os from leap.common.certs import get_digest import requests @@ -95,6 +96,13 @@ class LeapProvider(object): if fingerprint.strip() != digest: raise Exception('Certificate fingerprints don\'t match! Expected [%s] but got [%s]' % (fingerprint.strip(), digest)) + def smtp_info(self): + json_data = self.fetch_smtp_json() + hosts = json_data['hosts'] + hostname = hosts.keys()[0] + host = hosts[hostname] + return host['hostname'], host['port'] + def _validated_get(self, url): session = requests.session() try: @@ -130,3 +138,10 @@ class LeapProvider(object): def address_for(self, username): return '%s@%s' % (username, self.domain) + + def _client_cert_path(self): + return os.path.join( + self.config.leap_home, + "providers", + self.domain, + "keys", "client", "smtp.pem") -- cgit v1.2.3