Closed dark4archon closed 7 years ago
Does the value False
rather than None
yield any different result?
Hi, I'm one of the SleekXMPP maintainers -- is there a way for me to get a errbot setup to point to the Openfire server your testing against? That will help me figure out where the issue is without having to learn how to setup Openfire myself
thanks
As far as I know there isn't an openfire server we have. However, quickly poking around there seem to be some Docker containers that seem to help quickly bootstrapping an Openfire box. I've personally never used any of them.
@sijis ah, I thought the bug submitter would have one they could point me at - the place where this error is happening is early enough in the XMPP auth handshake I can test against without having an account on it.
@bear Ah gotcha. My apologies there.
@zoni
Does the value False rather than None yield any different result?
Same result. Tried it with ssl.PROTOCOL_TLSv1, ssl.PROTOCOL_SSLv23, and ssl.PROTOCOL_SSLv3,
I set this in config.py: XMPP_CA_CERT_FILE = False;
Using SSLv23:
13:18:40 DEBUG sleekxmpp.features.featur Starting TLS 13:18:40 INFO sleekxmpp.xmlstream.xmlst Negotiating TLS 13:18:40 INFO sleekxmpp.xmlstream.xmlst SSL field: 2 13:18:40 INFO sleekxmpp.xmlstream.xmlst Using SSL version: SSL 2/3 13:18:40 ERROR sleekxmpp.xmlstream.xmlst CERT: Invalid certificate trust chain. 13:18:40 DEBUG sleekxmpp.xmlstream.xmlst Event triggered: session_end 13:18:40 DEBUG sleekxmpp.xmlstream.xmlst Event triggered: disconnected
Using TLS 1.0
13:19:39 DEBUG sleekxmpp.features.featur Starting TLS 13:19:39 INFO sleekxmpp.xmlstream.xmlst Negotiating TLS 13:19:39 INFO sleekxmpp.xmlstream.xmlst SSL field: 3 13:19:39 INFO sleekxmpp.xmlstream.xmlst Using SSL version: TLS 1.0 13:19:39 ERROR sleekxmpp.xmlstream.xmlst CERT: Invalid certificate trust chain. 13:19:39 DEBUG sleekxmpp.xmlstream.xmlst Event triggered: session_end 13:19:39 DEBUG sleekxmpp.xmlstream.xmlst Event triggered: disconnected
@bear This Openfire server is behind a corporate firewall. However, I have full access to errbot and can set up any testing against this Openfire. Would this work?
Could this have anything to do with the missing ssl.PROTOCOL_SSLv2? If I set that value manually in xmlstream.py, I get the following error in errbot:
AttributeError: 'module' object has no attribute 'PROTOCOL_SSLv2' 13:47:53 ERROR errbot.bootstrap Unable to load or configure the backend. Traceback (most recent call last): File "/usr/local/lib/python3.4/dist-packages/errbot/bootstrap.py", line 135, in setup_bot bot = backendpm.get_plugin_by_name(backend_name) File "/usr/local/lib/python3.4/dist-packages/errbot/specific_plugin_manager.py", line 86, in get_plugin_by_name raise Exception('Error loading plugin %s:\nError:\n%s\n' % (name, formatted_error)) Exception: Error loading plugin XMPP: Error: <class 'AttributeError'>: File "/usr/local/lib/python3.4/dist-packages/yapsy/PluginManager.py", line 512, in loadPlugins plugin_info.plugin_object = self.instanciateElement(element) File "/usr/local/lib/python3.4/dist-packages/errbot/specific_plugin_manager.py", line 59, in instanciateElement return element(self._config) File "/usr/local/lib/python3.4/dist-packages/errbot/backends/xmpp.py", line 398, in init self.conn = self.create_connection() File "/usr/local/lib/python3.4/dist-packages/errbot/backends/xmpp.py", line 421, in create_connection bot=self File "/usr/local/lib/python3.4/dist-packages/errbot/backends/xmpp.py", line 316, in init self.client = ClientXMPP(jid, password, plugin_config={'feature_mechanisms': feature}) File "/usr/local/lib/python3.4/dist-packages/sleekxmpp/clientxmpp.py", line 70, in init BaseXMPP.init(self, jid, 'jabber:client', kwargs) File "/usr/local/lib/python3.4/dist-packages/sleekxmpp/basexmpp.py", line 59, in init XMLStream.init(self, kwargs) File "/usr/local/lib/python3.4/dist-packages/sleekxmpp/xmlstream/xmlstream.py", line 126, in init self.ssl_version = ssl.PROTOCOL_SSLv2
@bear I printed out the values from xmlstream.py right before the call to ssl.wrap_socket. It is hitting the except condition to print the invalid certificate error.
14:01:01 DEBUG sleekxmpp.features.featur Starting TLS 14:01:01 INFO sleekxmpp.xmlstream.xmlst Negotiating TLS 14:01:01 INFO sleekxmpp.xmlstream.xmlst Using SSL version: SSL 2/3 14:01:01 INFO sleekxmpp.xmlstream.xmlst self.ssl_version: 2 14:01:01 INFO sleekxmpp.xmlstream.xmlst self.certfile: None 14:01:01 INFO sleekxmpp.xmlstream.xmlst self.keyfile: None 14:01:01 INFO sleekxmpp.xmlstream.xmlst self.ca_certs: None 14:01:01 INFO sleekxmpp.xmlstream.xmlst cert_policy: 0 14:01:01 INFO sleekxmpp.xmlstream.xmlst do_handshake_on_connect: False 14:01:01 INFO sleekxmpp.xmlstream.xmlst self.socket: <socket.socket fd=9, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=0, laddr=('13.60.10.2', 49729), raddr=('13.122.30.11', 5222)> 14:01:01 ERROR sleekxmpp.xmlstream.xmlst CERT: Invalid certificate trust chain.
it's possible - i'm going to get some sort of simple test code going that will then get my brain into the proper mood to debug the hell that is TLS. I should be able to get to this tomorrow to be honest.
@bear I added the following code after line 873 in xmlstream.py:
` error_msg = "Could not connect to %s:%s. Socket Error #%s: %s"
self.event('socket_error', serr, direct=True)
log.error(error_msg, self.address[0], self.address[1],
serr.errno, serr.strerror)`
Here is what showed up in the logs. Does this help?
21:37:38 ERROR sleekxmpp.xmlstream.xmlst Could not connect to 13.122.30.11:5222. Socket Error #1: [SSL: SSL_NEGATIVE_LENGTH] dh key too small (_ssl.c:600)
The python 3.4 documentation says that the SSLError is from the underlying SSL implementation. My OpenSSL version is 1.0.1f.
I suspect the server you're connecting to is using too small diffie hellman parameters (likely <1024 bit
). Modern OpenSSL versions outright reject connecting to such servers.
@zoni Is there a way to skip the SSL/TLS to try a non-encrypted connection with this server? Curious to see what would happen.
I tested chatbot2 (PHP-based), and it connected immediately to the XMPP server and joined the chatroom. However, I would like to get errbot to work (much better feature set).
My current testing was against Openfire 3.6.3. I am trying to set up a newer Openfire, and will will post results.
I am going to close this issue. I found out that there were certificate issues on this Openfire 3.6.3 server. I will continue testing against Openfire 4.1 and open another issue if needed. Thank you everyone.
@dark4archon Try set xmpp.auth.anonymous to true in openfire, which would ignore the TLS auth
Found this on https://github.com/robertklep/nefit-easy-http-server/blob/master/README.md which works for me
The solution is mentioned here: edit the file /etc/ssl/openssl.cnf and change the following keys to these values:
MinProtocol = None CipherString = DEFAULT
In order to let us help you better, please fill out the following fields as best you can:
I am...
I am running...
Issue description
I cannot Errbot to connect to an OpenFire XMPP server. I have already set XMPP_CA_CERT_FILE to None in config.py. Yet, I still get a "Invalid certificate trust chain".
The SSL version defaults to ssl.PROTOCOL_TLSv1 in xmlstream.py. I have manually tried other values (ssl.PROTOCOL_SSLv23, ssl.PROTOCOL_SSLv3 , ssl.PROTOCOL_TLSv1_1, and ssl.PROTOCOL_TLSv1_2), but I get the same invalid certificate trust error. I was unable to set ssl.PROTOCOL_SSLv2 (object has no attribute error).
What am I missing? Thoughts and ideas welcome. Thanks!
Steps to reproduce
errbot from the CLI.
Additional info
None.