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

use_ssl: True broken on Python 3.10 and later #1484

Closed
pquentin opened this issue May 9, 2022 · 0 comments · Fixed by #1493
Closed

use_ssl: True broken on Python 3.10 and later #1484

pquentin opened this issue May 9, 2022 · 0 comments · Fixed by #1493
Assignees
Labels
bug Something's wrong
Milestone

Comments

@pquentin
Copy link
Member

pquentin commented May 9, 2022

@lhuet reported us an issue where the following command:

esrally race --track http_logs --pipeline=benchmark-only --target-hosts="<snip>.elastic-cloud.com:9243" \
   --client-options="timeout:60,use_ssl:true,verify_certs:false,basic_auth_user:'elastic',basic_auth_password:'mypassword'"

failed like this:

elasticsearch.exceptions.SSLError: ConnectionError(Cannot create a client socket with a PROTOCOL_TLS_SERVER context
(_ssl.c:801)) caused by: SSLError(Cannot create a client socket with a PROTOCOL_TLS_SERVER context (_ssl.c:801))

The issue is in esrally/client:py:

rally/esrally/client.py

Lines 138 to 142 in 609a043

# ssl.Purpose.CLIENT_AUTH allows presenting client certs and can only be enabled during instantiation
# but can be disabled via the verify_mode property later on.
self.ssl_context = ssl.create_default_context(
ssl.Purpose.CLIENT_AUTH, cafile=self.client_options.pop("ca_certs", certifi.where())
)

Even though literally everyone thinks the comment is true at first, it's wrong. For a client socket, ssl.Purpose.SERVER_AUTH should be used, with or without client certs. Everyone agrees that ssl.Purpose is super confusing, see python/cpython#73996. Anyway, in 3.10 making this mistake isn't possible anymore: python/cpython#26646.

However, just using SERVER_AUTH is not enough, because it activates more checks. When fixing this we need to make sure that:

@pquentin pquentin added the bug Something's wrong label May 9, 2022
@pquentin pquentin added this to the 2.5.0 milestone May 9, 2022
@pquentin pquentin self-assigned this May 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something's wrong
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant