Skip to content

Commit ea39237

Browse files
authored
Merge branch 'main' into ct-drop-38
2 parents 06673b8 + b399e98 commit ea39237

6 files changed

Lines changed: 16 additions & 6 deletions

File tree

azure-iot-device/azure/iot/device/common/http_transport.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ def _create_ssl_context(self):
6969
This method creates the SSLContext object used to authenticate the connection. The generated context is used by the http_client and is necessary when authenticating using a self-signed X509 cert or trusted X509 cert
7070
"""
7171
logger.debug("creating a SSL context")
72-
ssl_context = ssl.SSLContext(protocol=ssl.PROTOCOL_TLSv1_2)
72+
ssl_context = ssl.SSLContext(protocol=ssl.PROTOCOL_TLS_CLIENT)
7373

7474
if self._server_verification_cert:
7575
ssl_context.load_verify_locations(cadata=self._server_verification_cert)

azure-iot-device/azure/iot/device/common/mqtt_transport.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,7 @@ def _create_ssl_context(self):
321321
This method creates the SSLContext object used by Paho to authenticate the connection.
322322
"""
323323
logger.debug("creating a SSL context")
324-
ssl_context = ssl.SSLContext(protocol=ssl.PROTOCOL_TLSv1_2)
324+
ssl_context = ssl.SSLContext(protocol=ssl.PROTOCOL_TLS_CLIENT)
325325

326326
if self._server_verification_cert:
327327
logger.debug("configuring SSL context with custom server verification cert")

tests/e2e/iothub_e2e/aio/conftest.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,10 @@ async def brand_new_client(device_identity, client_kwargs, service_helper, devic
7070
# Keep this here. It is useful to see this info inside the inside devops pipeline test failures.
7171
logger.info(
7272
"Connecting device_id={}, module_id={}, to hub={} at {} (UTC)".format(
73-
device_id, module_id, test_env.IOTHUB_HOSTNAME, datetime.datetime.utcnow()
73+
device_id,
74+
module_id,
75+
test_env.IOTHUB_HOSTNAME,
76+
datetime.datetime.now(datetime.timezone.utc),
7477
)
7578
)
7679

tests/e2e/iothub_e2e/sync/conftest.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,10 @@ def brand_new_client(device_identity, client_kwargs, service_helper, device_id,
2020
# Keep this here. It is useful to see this info inside the inside devops pipeline test failures.
2121
logger.info(
2222
"Connecting device_id={}, module_id={}, to hub={} at {} (UTC)".format(
23-
device_id, module_id, test_env.IOTHUB_HOSTNAME, datetime.datetime.utcnow()
23+
device_id,
24+
module_id,
25+
test_env.IOTHUB_HOSTNAME,
26+
datetime.datetime.now(datetime.timezone.utc),
2427
)
2528
)
2629

tests/unit/common/test_http_transport.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,9 @@ def test_configures_tls_context(self, mocker):
105105
HTTPTransport(hostname=fake_hostname)
106106
# Verify correctness of TLS/SSL Context
107107
assert mock_ssl_context_constructor.call_count == 1
108-
assert mock_ssl_context_constructor.call_args == mocker.call(protocol=ssl.PROTOCOL_TLSv1_2)
108+
assert mock_ssl_context_constructor.call_args == mocker.call(
109+
protocol=ssl.PROTOCOL_TLS_CLIENT
110+
)
109111
assert mock_ssl_context.check_hostname is True
110112
assert mock_ssl_context.verify_mode == ssl.CERT_REQUIRED
111113

tests/unit/common/test_mqtt_transport.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,9 @@ def test_configures_tls_context(self, mocker):
267267

268268
# Verify correctness of TLS/SSL Context
269269
assert mock_ssl_context_constructor.call_count == 1
270-
assert mock_ssl_context_constructor.call_args == mocker.call(protocol=ssl.PROTOCOL_TLSv1_2)
270+
assert mock_ssl_context_constructor.call_args == mocker.call(
271+
protocol=ssl.PROTOCOL_TLS_CLIENT
272+
)
271273
assert mock_ssl_context.check_hostname is True
272274
assert mock_ssl_context.verify_mode == ssl.CERT_REQUIRED
273275

0 commit comments

Comments
 (0)