Browse Source

MQTT Client initialized incorrectly with paho-mqtt tls_insecure_set(True)

master
B.J. Dweck 1 year ago
parent
commit
16085fd594
1 changed files with 8 additions and 9 deletions
  1. +8
    -9
      torch_agent/torch_agent.py

+ 8
- 9
torch_agent/torch_agent.py View File

@ -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…
Cancel
Save