Flask-MQTT icon indicating copy to clipboard operation
Flask-MQTT copied to clipboard

Add example for TLS connection

Open stlehmann opened this issue 7 years ago • 4 comments

stlehmann avatar May 22 '17 12:05 stlehmann

I've managed to configure the TLS version to connect to the message broker provided by Amazon Web Services. Connectivity to AWS checks out fine with openssl command line test, however the test application only reports sending CONNECT.

How can I determine the packet payload based on the debug output of sample application? 16 Sending CONNECT (u0, p0, wr0, wq0, wf0, c1, k60) client_id=b'simplewebapp'

henri-marais avatar Feb 18 '18 22:02 henri-marais

Under the hood Flask-MQTT uses Paho-MQTT. Mqtt.client gives you a reference to the paho client. You can use this to analyze your packet payload.

stlehmann avatar Feb 19 '18 12:02 stlehmann

I can't get mine connected, if I set TLS on True it says [SSL: TLSV1_ALERT_PROTOCOL_VERSION] tlsv1 alert protocol version

luuknnh avatar Jan 04 '23 18:01 luuknnh

I can't get mine connected, if I set TLS on True it says [SSL: TLSV1_ALERT_PROTOCOL_VERSION] tlsv1 alert protocol version

Same here


Edit: This did the trick for me (I'm using a HiveMQ Cloud MQTT Broker).

from flask_mqtt import Mqtt, ssl

app.config['MQTT_TLS_ENABLED'] = True
app.config['MQTT_TLS_VERSION'] = ssl.PROTOCOL_TLSv1_2 # <---- SEE HERE

see https://github.com/stlehmann/Flask-MQTT/pull/117/files#diff-ab6c33fcbdc57dd3f74676467ec075a309f7e8c8dc97a80150cf069e9034d18bR38

rubenhoenle avatar Aug 29 '23 17:08 rubenhoenle