Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SL validation failed for https://sts.amazonaws.com/ EOF occurred in violation of protocol (_ssl.c:618) #5744

Closed
2 tasks done
andrealai75 opened this issue Nov 23, 2020 · 12 comments
Labels
configuration guidance Question that needs advice or information.

Comments

@andrealai75
Copy link

Confirm by changing [ ] to [x] below to ensure that it's a bug:

Describe the bug
We upgraded from 1.18.173 to 1.18.183 and now when we execute 'aws sts get-caller-identity' we get the following error: "SSL validation failed for https://sts.amazonaws.com/ EOF occurred in violation of protocol (_ssl.c:618)"

SDK version number
aws-cli/1.18.183 Python/2.7.5 Linux/3.10.0-1160.6.1.el7.x86_64 botocore/1.19.23
Python 2.7.5
pip 8.1.2 from /usr/lib/python2.7/site-packages (python 2.7)

Platform/OS/Hardware/Device
Red Hat Enterprise Linux Server release 7.7 (Maipo)

To Reproduce (observed behavior)
Using 1.18.183 just run 'aws sts get-caller-identity'. We also get the same error running for example 'aws s3 ls'.

If we downgrade using 'pip install --upgrade awscli==1.18.173' works fine on the same machine and user.

Expected behavior
'aws sts get-caller-identity' should work.

Logs/output

2020-11-23 14:53:52,987 - MainThread - awscli.clidriver - DEBUG - Exception caught in main()
Traceback (most recent call last):
File "/usr/lib/python2.7/site-packages/awscli/clidriver.py", line 217, in main
return command_table[parsed_args.command](remaining, parsed_args)
File "/usr/lib/python2.7/site-packages/awscli/clidriver.py", line 358, in call
return command_table[parsed_args.operation](remaining, parsed_globals)
File "/usr/lib/python2.7/site-packages/awscli/clidriver.py", line 530, in call
call_parameters, parsed_globals)
File "/usr/lib/python2.7/site-packages/awscli/clidriver.py", line 650, in invoke
client, operation_name, parameters, parsed_globals)
File "/usr/lib/python2.7/site-packages/awscli/clidriver.py", line 662, in _make_client_call
**parameters)
File "/usr/lib/python2.7/site-packages/botocore/client.py", line 357, in _api_call
return self._make_api_call(operation_name, kwargs)
File "/usr/lib/python2.7/site-packages/botocore/client.py", line 663, in _make_api_call
operation_model, request_dict, request_context)
File "/usr/lib/python2.7/site-packages/botocore/client.py", line 682, in _make_request
return self._endpoint.make_request(operation_model, request_dict)
File "/usr/lib/python2.7/site-packages/botocore/endpoint.py", line 102, in make_request
return self._send_request(request_dict, operation_model)
File "/usr/lib/python2.7/site-packages/botocore/endpoint.py", line 137, in _send_request
success_response, exception):
File "/usr/lib/python2.7/site-packages/botocore/endpoint.py", line 256, in _needs_retry
caught_exception=caught_exception, request_dict=request_dict)
File "/usr/lib/python2.7/site-packages/botocore/hooks.py", line 356, in emit
return self._emitter.emit(aliased_event_name, **kwargs)
File "/usr/lib/python2.7/site-packages/botocore/hooks.py", line 228, in emit
return self._emit(event_name, kwargs)
File "/usr/lib/python2.7/site-packages/botocore/hooks.py", line 211, in _emit
response = handler(**kwargs)
File "/usr/lib/python2.7/site-packages/botocore/retryhandler.py", line 183, in call
if self._checker(attempts, response, caught_exception):
File "/usr/lib/python2.7/site-packages/botocore/retryhandler.py", line 251, in call
caught_exception)
File "/usr/lib/python2.7/site-packages/botocore/retryhandler.py", line 277, in _should_retry
return self._checker(attempt_number, response, caught_exception)
File "/usr/lib/python2.7/site-packages/botocore/retryhandler.py", line 317, in call
caught_exception)
File "/usr/lib/python2.7/site-packages/botocore/retryhandler.py", line 223, in call
attempt_number, caught_exception)
File "/usr/lib/python2.7/site-packages/botocore/retryhandler.py", line 359, in _check_caught_exception
raise caught_exception
SSLError: SSL validation failed for https://sts.amazonaws.com/ EOF occurred in violation of protocol (_ssl.c:618)
2020-11-23 14:53:52,988 - MainThread - awscli.clidriver - DEBUG - Exiting with rc 255

SSL validation failed for https://sts.amazonaws.com/ EOF occurred in violation of protocol (_ssl.c:618)

Additional context

@andrealai75 andrealai75 added the needs-triage This issue or PR still needs to be triaged. label Nov 23, 2020
@kdaily kdaily added investigating This issue is being investigated and/or work is in progress to resolve the issue. and removed needs-triage This issue or PR still needs to be triaged. labels Nov 23, 2020
@kdaily
Copy link
Member

kdaily commented Nov 23, 2020

Hi @andrealai75,

Are you using a proxy?

I note that the urllib3 version was bumped in the AWS CLI dependency botocore between the versions you mentioned, related to this issue: urllib3/urllib3#1850.

@kdaily kdaily added response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. and removed investigating This issue is being investigated and/or work is in progress to resolve the issue. labels Nov 23, 2020
@andrealai75
Copy link
Author

Yes we are behind proxy with endpoint restrictions. The .amazonaws.com domain is allowed.

@github-actions github-actions bot removed the response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. label Nov 24, 2020
@kdaily
Copy link
Member

kdaily commented Nov 24, 2020

Can you provide how you are configuring the proxy? It's likely that the urllib3 change is the culprit. As noted in the urllib3 issue linked above, if you are using a plaintext HTTP connection to the proxy you need to specify the proxy as such using http.

@kdaily kdaily added configuration guidance Question that needs advice or information. response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. and removed response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. labels Nov 24, 2020
@andrealai75
Copy link
Author

We only set the usual proxy environment variables:
export http_proxy=http://x.x.x.x:3128
export https_proxy=http://x.x.x.x:3128
export no_proxy=127.0.0.1,localhost,169.254.169.254
export no_proxy_aws=169.254.169.254

@andrealai75
Copy link
Author

andrealai75 commented Nov 25, 2020

You are right we are contacting the proxy over HTTP. I read urllib3/urllib3#1850 and it looks I should be getting a Warning and not a failure.

@julb
Copy link

julb commented Nov 25, 2020

Hello,
I confirm I have the exact same issue with a version a bit earlier than @andrealai75 :

$ aws --version
aws-cli/1.18.178 Python/3.6.8 Linux/3.10.0-1127.19.1.el7.x86_64 botocore/1.19.18

We are behind a corporate proxy, configured with http_proxy and https_proxy env variables.

The exact same job is however working with a previous version:

$ aws --version
aws-cli/1.18.160 Python/3.6.8 Linux/3.10.0-1127.19.1.el7.x86_64 botocore/1.19.0

@github-actions github-actions bot removed the response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. label Nov 25, 2020
@sonnyhui98
Copy link

I reverted to version 1.18.165 and it‘s working fine for me.

@kdaily
Copy link
Member

kdaily commented Dec 2, 2020

@andrealai75 -

If you go back in the debug traceback, you should see an error from urllib3 like the following:

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "botocore/httpsession.py", line 263, in send
File "urllib3/connectionpool.py", line 756, in urlopen
File "urllib3/util/retry.py", line 506, in increment
File "urllib3/packages/six.py", line 734, in reraise
File "urllib3/connectionpool.py", line 696, in urlopen
File "urllib3/connectionpool.py", line 964, in prepare_proxy
File "urllib3/connection.py", line 359, in connect
File "urllib3/connection.py", line 502, in connect_tls_proxy
File "urllib3/util/ssl.py", line 421, in ssl_wrap_socket
File "urllib3/util/ssl.py", line 464, in _ssl_wrap_socket_impl
File "ssl.py", line 412, in wrap_socket
File "ssl.py", line 853, in _create
File "ssl.py", line 1117, in do_handshake
urllib3.exceptions.SSLError: EOF occurred in violation of protocol (_ssl.c:1056)

We're capturing the output of that error that you see, but it's coming from urllib3.

@sonnyhui98, @julb - the change was made in botocore==1.19.17, which was used for awscli==1.18.177.

@nateprewitt
Copy link
Member

As an extra note, if you install urllib3 < 1.26 you can continue installing newer versions of the AWS CLI for the time being. That will support the old proxy configuration. However, we'd highly recommend reviewing the proxy setup you're using since there are security concerns that prompted urllib3 to change this behavior starting in 1.26.

@kdaily
Copy link
Member

kdaily commented Dec 3, 2020

Thanks @nateprewitt! I think this is resolved. I've discussed with our doc writers and we will review the user guide for configuring a proxy to be sure it reflects any changes with this.

@kdaily kdaily closed this as completed Dec 3, 2020
@github-actions
Copy link

github-actions bot commented Dec 3, 2020

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please open a new issue that references this one. If you wish to keep having a conversation with other community members under this issue feel free to do so.

@huangtouge
Copy link

Remember to set ca bundle for the awscli
https://docs.aws.amazon.com/sdkref/latest/guide/setting-global-ca_bundle.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
configuration guidance Question that needs advice or information.
Projects
None yet
Development

No branches or pull requests

6 participants