如何使用 AWS CLI IoT API 修复 OpenSSL 错误



我正在尝试在Mac上运行AWS CLI。我正在尝试使用物联网数据 API 读取/写入影子状态。 该命令实际上工作正常,但它每次都会抛出 OpenSSL/TLS 错误。

$ aws iot-data get-thing-shadow --thing-name "my-thing-20160209" my-thing-20160209.json
/usr/local/Cellar/awscli/1.10.1/libexec/vendor/lib/python2.7/site-packages/botocore/handlers.py:574: UnsupportedTLSVersionWarning: Currently installed openssl version: OpenSSL 0.9.8zg 14 July 2015 does not support TLS 1.2, which is required for use of iot-data. Please use python installed with openssl version 1.0.1 or higher.
  UnsupportedTLSVersionWarning

这是AWS版本。

aws-cli/1.10.1 Python/2.7.10 Darwin/14.5.0 botocore/1.3.23

如您所见,我使用自制软件来安装所有内容。 OpenSSL和Python链接正确。 我在我的系统上找不到任何引用OpenSSL 0.9.8zg的内容,并且Python加载了正确的OpenSSL版本。

$ python -c 'import ssl; print ssl.OPENSSL_VERSION'
OpenSSL 1.0.2f  28 Jan 2016

有迹象表明,其他因素可能会触发该错误:https://forums.aws.amazon.com/thread.jspa?messageID=690051#690051

但是,由于我实际上可以检索阴影状态,因此错误一定是由于其他原因造成的。

任何想法可能导致此错误的原因?

更新时间:2016 年 9 月 15 日 包括 Python 信息

$ head $(which aws)
#!/bin/bash
PYTHONPATH="/usr/local/Cellar/awscli/1.10.51/libexec/lib/python2.7/site-packages:/usr/local/Cellar/awscli/1.10.51/libexec/vendor/lib/python2.7/site-packages" exec "/usr/local/Cellar/awscli/1.10.51/libexec/bin/aws" "$@"

由于OS X有自己的python和openssl lib,因此awscli似乎引用的是它们而不是您的酿造版本。 我猜 (a) 自制的 sym 链接确实不正确,或者 (b) 自制的 python 没有绑定到酿造的 openssl 版本(所以 awscli 会选择系统 openssl lib,但是当你手动导入库时,你会得到更新的版本)。

我会更新OpenSSL,强制其链接并重新安装python,如下所示:

brew update
brew install openssl
brew link openssl --force 
brew install python --with-brewed-openssl

最新更新