MQTT Client initialized incorrectly with paho-mqtt tls_insecure_set(True)
This commit is contained in:
parent
5a2ac0c3dc
commit
16085fd594
|
@ -77,17 +77,16 @@ def main():
|
|||
client = mqtt.Client()
|
||||
protocol = "mqtt"
|
||||
|
||||
if mqtt_require_certificate:
|
||||
client.tls_set(
|
||||
ca_certs=mqtt_ca_file,
|
||||
certfile=mqtt_cert_file,
|
||||
keyfile=mqtt_key_file,
|
||||
cert_reqs=ssl.CERT_REQUIRED)
|
||||
protocol = "mqtts"
|
||||
|
||||
if mqtt_broker_host.endswith(".onion"):
|
||||
client.proxy_set(proxy_type=socks.SOCKS5, proxy_addr="localhost", proxy_port=tor_proxy_port)
|
||||
client.tls_insecure_set(True)
|
||||
else:
|
||||
if mqtt_require_certificate:
|
||||
protocol = "mqtts"
|
||||
client.tls_set(
|
||||
ca_certs=mqtt_ca_file,
|
||||
certfile=mqtt_cert_file,
|
||||
keyfile=mqtt_key_file,
|
||||
cert_reqs=ssl.CERT_REQUIRED)
|
||||
|
||||
client.connect(mqtt_broker_host, mqtt_broker_port, 60)
|
||||
client.publish(mqtt_topic, json.dumps(payload))
|
||||
|
|
Loading…
Reference in New Issue
Block a user