comparison sat/core/xmpp.py @ 3044:691283719bb2

core (patches): updated TLS patches: - updated patches to handle TLS after implementation in Twisted 19.7.0. A patch is still needed for Wokkel. - minimum required version of Twisted is now 19.7.0
author Goffi <goffi@goffi.org>
date Tue, 01 Oct 2019 22:49:10 +0200
parents fee60f17ebac
children aa728dc7b0ce
comparison
equal deleted inserted replaced
3043:3df611adb598 3044:691283719bb2
24 from functools import partial 24 from functools import partial
25 from sat.core.i18n import _ 25 from sat.core.i18n import _
26 from sat.core.constants import Const as C 26 from sat.core.constants import Const as C
27 from sat.memory import cache 27 from sat.memory import cache
28 from twisted.internet import defer, error as internet_error 28 from twisted.internet import defer, error as internet_error
29 from twisted.internet import ssl
29 from twisted.words.protocols.jabber.xmlstream import XMPPHandler 30 from twisted.words.protocols.jabber.xmlstream import XMPPHandler
30 from twisted.words.protocols.jabber import xmlstream 31 from twisted.words.protocols.jabber import xmlstream
31 from twisted.words.protocols.jabber import error 32 from twisted.words.protocols.jabber import error
32 from twisted.words.protocols.jabber import jid 33 from twisted.words.protocols.jabber import jid
33 from twisted.words.xish import domish 34 from twisted.words.xish import domish
713 ) 714 )
714 715
715 self.check_certificate = host_app.memory.getParamA( 716 self.check_certificate = host_app.memory.getParamA(
716 "check_certificate", "Connection", profile_key=profile) 717 "check_certificate", "Connection", profile_key=profile)
717 718
719 if self.check_certificate:
720 tls_required, configurationForTLS = True, None
721 else:
722 tls_required = False
723 configurationForTLS = ssl.CertificateOptions(trustRoot=None)
724
718 wokkel_client.XMPPClient.__init__( 725 wokkel_client.XMPPClient.__init__(
719 self, user_jid, password, host or None, port or C.XMPP_C2S_PORT, 726 self, user_jid, password, host or None, port or C.XMPP_C2S_PORT,
720 # check_certificate = self.check_certificate # FIXME: currently disabled with Python 3 port 727 tls_required=tls_required, configurationForTLS=configurationForTLS
721 ) 728 )
722 SatXMPPEntity.__init__(self, host_app, profile, max_retries) 729 SatXMPPEntity.__init__(self, host_app, profile, max_retries)
723 730
724 if not self.check_certificate: 731 if not self.check_certificate:
725 msg = (_("Certificate validation is deactivated, this is unsecure and " 732 msg = (_("Certificate validation is deactivated, this is unsecure and "