File tree Expand file tree Collapse file tree 2 files changed +7
-5
lines changed Expand file tree Collapse file tree 2 files changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -414,9 +414,6 @@ def process_arguments() -> Configuration:
414
414
config .mqtt_transport_protocol = TransportProtocol .TLS
415
415
if args .tls_server_cert_path :
416
416
config .tls_server_cert_path = args .tls_server_cert_path
417
- else :
418
- msg = f"No server certificate authority file provided for TLS MQTT URI { args .mqtt_uri } "
419
- raise SystemExit (msg )
420
417
else :
421
418
msg = f"Invalid MQTT URI scheme: { parse_result .scheme } , use tcp or ws"
422
419
raise SystemExit (msg )
Original file line number Diff line number Diff line change @@ -50,14 +50,19 @@ async def connect(self) -> None:
50
50
)
51
51
else :
52
52
self .client .set_auth_credentials (username = self .configuration .mqtt_user )
53
+
53
54
if self .transport_protocol .with_tls :
54
55
cert_uri = self .configuration .tls_server_cert_path
55
56
LOG .debug (
56
57
f"Configuring network encryption and authentication options for MQTT using { cert_uri } "
57
58
)
58
59
ssl_context = ssl .SSLContext ()
59
- ssl_context .load_verify_locations (cafile = cert_uri )
60
- ssl_context .check_hostname = False
60
+ if cert_uri :
61
+ ssl_context .load_verify_locations (cafile = cert_uri )
62
+ ssl_context .check_hostname = False
63
+ else :
64
+ LOG .debug (f"Custom certificate chain not provided, using default" )
65
+ ssl_context = True # Use default SSL context if no cert is provided
61
66
else :
62
67
ssl_context = None
63
68
await self .client .connect (
You can’t perform that action at this time.
0 commit comments