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:
414414 config .mqtt_transport_protocol = TransportProtocol .TLS
415415 if args .tls_server_cert_path :
416416 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 )
420417 else :
421418 msg = f"Invalid MQTT URI scheme: { parse_result .scheme } , use tcp or ws"
422419 raise SystemExit (msg )
Original file line number Diff line number Diff line change @@ -50,14 +50,19 @@ async def connect(self) -> None:
5050 )
5151 else :
5252 self .client .set_auth_credentials (username = self .configuration .mqtt_user )
53+
5354 if self .transport_protocol .with_tls :
5455 cert_uri = self .configuration .tls_server_cert_path
5556 LOG .debug (
5657 f"Configuring network encryption and authentication options for MQTT using { cert_uri } "
5758 )
5859 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
6166 else :
6267 ssl_context = None
6368 await self .client .connect (
You can’t perform that action at this time.
0 commit comments