Setting of cipher suite string happens too late in Client.set_tls
#736
Labels
Status: Available
No one has claimed responsibility for resolving this issue.
Type: Enhancement
A new feature for a minor or major release.
Hi,
I need to connect to an MQTT broker that is not under my control and might not be configured so that modern TLS security standards are met.
I need to use TLS client cert authentication with an RSA key length of only 1024 bits. OpenSSL is everything but happy about this when trying to connect:
I encountered a similar issue with
mosquitto_sub
where it complained about the wrong outdated set of ciphers being used. To fix it there, I passed the cipher suiteDEFAULT@SECLEVEL=0
to it, and OpenSSL finally established a TLS session.I tried doing the same when using paho:
However, the error remained. After checking the code where all of this is handled, I found out that the keys are loaded first (which caused the error) and THEN the cipher suite is set: https://github.com/eclipse/paho.mqtt.python/blob/master/src/paho/mqtt/client.py#L794-L809
After moving lines 808-809 directly below line 792 where the context is created, the issue was fixed.
However, I don't know if this has any other side-effects like not being able to specify all cipher suites at this time, otherwise I already would've created a PR. Is there a reason why the call to this function happens so late? If not, moving these lines up might be in order to fix issues like this.
Again, I know that I should update my key length and reconfigure my MQTT broker. The issue is, it is not my server, so I can't. I need to connect to this broker, no matter if it's secure right now or not, so being able to overwrite the default behaviour using the cipher suite string is the only way I can connect to it.
The text was updated successfully, but these errors were encountered: