fix insecure SSL check on mqtts:// configurations (#825)

This commit is contained in:
Chris Caron 2023-02-18 20:21:19 -05:00 committed by GitHub
parent 58f9e64843
commit 7bcb0647c0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 3 deletions

View File

@ -324,7 +324,7 @@ class NotifyMQTT(NotifyBase):
ciphers=None) ciphers=None)
# Set our TLS Verify Flag # Set our TLS Verify Flag
self.client.tls_insecure_set(self.verify_certificate) self.client.tls_insecure_set(not self.verify_certificate)
# Establish our connection # Establish our connection
if self.client.connect( if self.client.connect(

View File

@ -252,7 +252,7 @@ def test_plugin_mqtt_tls_connect_success(mqtt_client_mock):
tls_version=ssl.PROTOCOL_TLS, tls_version=ssl.PROTOCOL_TLS,
ciphers=None, ciphers=None,
), ),
call.tls_insecure_set(True), call.tls_insecure_set(False),
call.connect('localhost', port=8883, keepalive=30), call.connect('localhost', port=8883, keepalive=30),
call.loop_start(), call.loop_start(),
call.is_connected(), call.is_connected(),
@ -299,7 +299,7 @@ def test_plugin_mqtt_tls_no_verify_success(mqtt_client_mock):
# Verify the right calls have been made to the MQTT client object. # Verify the right calls have been made to the MQTT client object.
# Let's only validate the single call of interest is present. # Let's only validate the single call of interest is present.
# Everything else is identical with `test_plugin_mqtt_tls_connect_success`. # Everything else is identical with `test_plugin_mqtt_tls_connect_success`.
assert call.tls_insecure_set(False) in mqtt_client_mock.mock_calls assert call.tls_insecure_set(True) in mqtt_client_mock.mock_calls
def test_plugin_mqtt_session_client_id_success(mqtt_client_mock): def test_plugin_mqtt_session_client_id_success(mqtt_client_mock):