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

jed*_*atu 7 homebrew aws-cli

我正在尝试在Mac上运行AWS CLI.我正在尝试使用iot-data 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
Run Code Online (Sandbox Code Playgroud)

这是AWS版本.

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

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

$ python -c 'import ssl; print ssl.OPENSSL_VERSION'
OpenSSL 1.0.2f  28 Jan 2016
Run Code Online (Sandbox Code Playgroud)

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

但是,由于我实际上可以检索阴影状态,因此错误必须归因于其他原因.

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

更新时间:2016-09-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" "$@"
Run Code Online (Sandbox Code Playgroud)

gre*_*ory 2

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

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

brew update
brew install openssl
brew link openssl --force 

brew install python --with-brewed-openssl
Run Code Online (Sandbox Code Playgroud)