summaryrefslogtreecommitdiff
path: root/service/pixelated/bitmask_libraries/provider.py
diff options
context:
space:
mode:
authorBruno Wagner <bwagner@riseup.net>2015-11-03 19:41:34 -0200
committerPixelated <pixelated@pix-poa-1>2015-11-03 19:47:35 -0200
commit20962bdea85b9e0ac04ab9f714853ca8516cd7f4 (patch)
tree595bea74597a2147b57afe4fde59a7ab1318018f /service/pixelated/bitmask_libraries/provider.py
parent0f84c6354a116fd53628b23a56c1528c5dd3e8ef (diff)
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
Diffstat (limited to 'service/pixelated/bitmask_libraries/provider.py')
-rw-r--r--service/pixelated/bitmask_libraries/provider.py15
1 files changed, 15 insertions, 0 deletions
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 <http://www.gnu.org/licenses/>.
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")