Skip to content

Commit f0aa2ce

Browse files
committed
Release of version 1.4.6
1 parent bdc113b commit f0aa2ce

File tree

3 files changed

+23
-10
lines changed

3 files changed

+23
-10
lines changed

AWSIoTPythonSDK/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
__version__ = "1.4.5"
1+
__version__ = "1.4.6"
22

33

AWSIoTPythonSDK/core/greengrass/discovery/providers.py

+18-9
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
from AWSIoTPythonSDK.exception.AWSIoTExceptions import DiscoveryTimeoutException
2222
from AWSIoTPythonSDK.exception.AWSIoTExceptions import DiscoveryFailure
2323
from AWSIoTPythonSDK.core.greengrass.discovery.models import DiscoveryInfo
24+
from AWSIoTPythonSDK.core.protocol.connection.alpn import SSLContextBuilder
2425
import re
2526
import sys
2627
import ssl
@@ -249,15 +250,23 @@ def _create_ssl_connection(self, sock):
249250
ssl_protocol_version = ssl.PROTOCOL_SSLv23
250251

251252
if self._port == 443:
252-
ssl.set_alpn_protocols(['x-amzn-http-ca'])
253-
#note: ALPN is a TLS 1.2 and later feature
254-
255-
ssl_sock = ssl.wrap_socket(sock,
256-
certfile=self._cert_path,
257-
keyfile=self._key_path,
258-
ca_certs=self._ca_path,
259-
cert_reqs=ssl.CERT_REQUIRED,
260-
ssl_version=ssl_protocol_version)
253+
ssl_context = SSLContextBuilder()\
254+
.with_ca_certs(self._ca_path)\
255+
.with_cert_key_pair(self._cert_path, self._key_path)\
256+
.with_cert_reqs(ssl.CERT_REQUIRED)\
257+
.with_check_hostname(True)\
258+
.with_ciphers(None)\
259+
.with_alpn_protocols(['x-amzn-http-ca'])\
260+
.build()
261+
ssl_sock = ssl_context.wrap_socket(sock, server_hostname=self._host, do_handshake_on_connect=False)
262+
ssl_sock.do_handshake()
263+
else:
264+
ssl_sock = ssl.wrap_socket(sock,
265+
certfile=self._cert_path,
266+
keyfile=self._key_path,
267+
ca_certs=self._ca_path,
268+
cert_reqs=ssl.CERT_REQUIRED,
269+
ssl_version=ssl_protocol_version)
261270

262271
self._logger.debug("Matching host name...")
263272
if sys.version_info[0] < 3 or (sys.version_info[0] == 3 and sys.version_info[1] < 2):

CHANGELOG.rst

+4
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22
CHANGELOG
33
=========
44

5+
1.4.6
6+
=====
7+
* bugfix: Use non-deprecated ssl API to specify ALPN when doing Greengrass discovery
8+
59
1.4.5
610
=====
711
* improvement: Added validation to mTLS arguments in basicDiscovery

0 commit comments

Comments
 (0)