OctoPrint/OctoPrint-MQTT

Unable to use TLS - Advanced TLS options errors when trying to set (save) and/or get (when OctoPrint starts)

ernestgwilsonii opened this issue · 0 comments

What were you doing?

Cannot get this plugin to use TLS with MQTT.
Unable to use TLS - Advanced TLS options errors when trying to set (save) and/or get (when OctoPrint starts).
Note: Using this plugin without TLS, it works just fine with MQTT.
The issue occurs only when attempting to use TLS and as a result unable to use TLS.

What did you expect to happen?

1. Expected Advanced TLS options to be able to be set without getting an error in the log.
2. Expected the plugin to be able to use Advanced TLS options when OctoPrint starts and not get an error in the log.

What happened instead?

A. Error when trying to save Advanced TLS options:

2022-05-01 11:13:34,400 - octoprint.plugins.mqtt - INFO - Settings changed (broker_diff={'tls': {'certfile': '/home/pi/certs/mqtt/octopi.crt', 'keyfile': '/home/pi/certs/mqtt/octopi.key'}}, lw_diff={}), reconnecting to broker
2022-05-01 11:13:35,419 - octoprint.server.api.settings - ERROR - Could not save settings for plugin MQTT (0.8.12)
Traceback (most recent call last):
  File "/home/pi/oprint/lib/python3.7/site-packages/octoprint/server/api/settings.py", line 1114, in _saveSettings
    plugin.on_settings_save(data["plugins"][plugin_id])
  File "/home/pi/oprint/lib/python3.7/site-packages/octoprint/util/__init__.py", line 1737, in wrapper
    return f(*args, **kwargs)
  File "/home/pi/oprint/lib/python3.7/site-packages/octoprint_mqtt/__init__.py", line 162, in on_settings_save
    self.mqtt_connect()
  File "/home/pi/oprint/lib/python3.7/site-packages/octoprint_mqtt/__init__.py", line 311, in mqtt_connect
    self._mqtt.tls_set(**tls_args)
  File "/home/pi/oprint/lib/python3.7/site-packages/paho/mqtt/client.py", line 809, in tls_set
    context.set_ciphers(ciphers)
ssl.SSLError: ('No cipher can be selected.',)

B. Error when OctoPrint starts:

2022-05-01 11:27:50,366 - octoprint.plugin - ERROR - Error while calling plugin mqtt
Traceback (most recent call last):
  File "/home/pi/oprint/lib/python3.7/site-packages/octoprint/plugin/__init__.py", line 271, in call_plugin
    result = getattr(plugin, method)(*args, **kwargs)
  File "/home/pi/oprint/lib/python3.7/site-packages/octoprint/util/__init__.py", line 1737, in wrapper
    return f(*args, **kwargs)
  File "/home/pi/oprint/lib/python3.7/site-packages/octoprint_mqtt/__init__.py", line 83, in on_startup
    self.mqtt_connect()
  File "/home/pi/oprint/lib/python3.7/site-packages/octoprint_mqtt/__init__.py", line 311, in mqtt_connect
    self._mqtt.tls_set(**tls_args)
  File "/home/pi/oprint/lib/python3.7/site-packages/paho/mqtt/client.py", line 809, in tls_set
    context.set_ciphers(ciphers)
ssl.SSLError: ('No cipher can be selected.',)

Version of OctoPrint

OctoPrint 1.7.3 Python 3.7.3 OctoPi 0.18.0

Version of the MQTT plugin

MQTT (0.8.12) = /home/pi/oprint/lib/python3.7/site-packages/octoprint_mqtt

Used MQTT broker and its version

mosquitto version 2.0.13