paho.mqtt.python icon indicating copy to clipboard operation
paho.mqtt.python copied to clipboard

DeprecationWarning: ssl.PROTOCOL_TLS is deprecated

Open maranov opened this issue 3 years ago • 2 comments

Per Python ssl docs, the PROTOCOL_TLS has been deprecated, replaced with PROTOCOL_TLS_CLIENT/SERVER. This setting is used in the client at: https://github.com/eclipse/paho.mqtt.python/blob/9782ab81fe7ee3a05e74c7f3e1d03d5611ea4be4/src/paho/mqtt/client.py#L791

From what I understood, the PROTOCOL_TLS_CLIENT should be the correct replacement (for client connections), but it has some side effects:

The protocol enables CERT_REQUIRED and check_hostname by default.

Looking at the client code, this seems to be the defaults for tls_set as well. Replacing the PROTOCOL_TLS with PROTOCOL_TLS_CLIENT, while using PROTOCOL_TLS as a fallback for Python 2.7 should remove the deprecation warning.

maranov avatar Mar 22 '22 17:03 maranov

I could open a PR if the proposed solution sounds like a good idea.

maranov avatar Mar 22 '22 17:03 maranov

@maranov sounds good to me. Would love to see this warning disappear. 👍

timhaines avatar Jun 10 '22 04:06 timhaines

As PR #665 has now been merged I believe this issue can be closed. Note that there are a few other related issues that will remain open (the documentation does not really match the code).

Note: This is part of an exercise to clean up old issues so that the project can move forwards. Due to the number of issues being worked through mistakes will be made; please feel free to reopen this issue (or comment) if you believe it's been closed in error.

MattBrittan avatar Jan 08 '24 09:01 MattBrittan