diff options
author | Ivan Alejandro <ivanalejandro0@gmail.com> | 2013-09-18 12:34:31 -0300 |
---|---|---|
committer | Ivan Alejandro <ivanalejandro0@gmail.com> | 2013-09-18 12:34:31 -0300 |
commit | 9f0968da51cc9a16577c563887ae336066ddc0eb (patch) | |
tree | 7f0e744a12e0b67fab2818216a353b54bc8ba730 /src/leap/bitmask/services/mail/smtpconfig.py | |
parent | 735111cee1c28ccc07c87d806bc5412aaffcedf7 (diff) | |
parent | 13f5d8fcee038f441dd91ef16dfdb254e1f0dd3f (diff) |
Merge remote-tracking branch 'kali/bug/start_smtp_without_eip' into develop
Diffstat (limited to 'src/leap/bitmask/services/mail/smtpconfig.py')
-rw-r--r-- | src/leap/bitmask/services/mail/smtpconfig.py | 36 |
1 files changed, 32 insertions, 4 deletions
diff --git a/src/leap/bitmask/services/mail/smtpconfig.py b/src/leap/bitmask/services/mail/smtpconfig.py index 20041c30..74c9bc94 100644 --- a/src/leap/bitmask/services/mail/smtpconfig.py +++ b/src/leap/bitmask/services/mail/smtpconfig.py @@ -14,25 +14,28 @@ # # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. - """ SMTP configuration """ import logging +import os +from leap.bitmask.config.providerconfig import ProviderConfig +from leap.bitmask.services import ServiceConfig from leap.bitmask.services.mail.smtpspec import get_schema -from leap.common.config.baseconfig import BaseConfig +from leap.common.check import leap_assert, leap_assert_type logger = logging.getLogger(__name__) -class SMTPConfig(BaseConfig): +class SMTPConfig(ServiceConfig): """ SMTP configuration abstraction class """ + _service_name = "smtp" def __init__(self): - BaseConfig.__init__(self) + ServiceConfig.__init__(self) def _get_schema(self): """ @@ -47,3 +50,28 @@ class SMTPConfig(BaseConfig): def get_locations(self): return self._safe_get_value("locations") + + def get_client_cert_path(self, + providerconfig=None, + about_to_download=False): + """ + Returns the path to the certificate used by smtp + """ + + leap_assert(providerconfig, "We need a provider") + leap_assert_type(providerconfig, ProviderConfig) + + cert_path = os.path.join(self.get_path_prefix(), + "leap", + "providers", + providerconfig.get_domain(), + "keys", + "client", + "smtp.pem") + + if not about_to_download: + leap_assert(os.path.exists(cert_path), + "You need to download the certificate first") + logger.debug("Using SMTP cert %s" % (cert_path,)) + + return cert_path |