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

Context.set_verify: allow omission of callback #933

Merged
merged 3 commits into from
Aug 8, 2020

Conversation

mhils
Copy link
Member

@mhils mhils commented Aug 7, 2020

This PR allows it to call set_verify without specifying an explicit callback:

If no verify_callback is specified, the default callback will be used. Its return value is identical to preverify_ok, so that any verification failure will lead to a termination of the TLS/SSL handshake with an alert message, if SSL_VERIFY_PEER is set.

This simplifies the most common case to context.set_verify(SSL.VERIFY_PEER). Now that OpenSSL has builtin hostname validation, it's probably a good thing to discourage people from writing custom certificate verification.

@reaperhulk
Copy link
Member

Based on the tests this appears to be true for every openssl in our CI. Do you happen to know when OpenSSL started defaulting to this behavior?

@mhils
Copy link
Member Author

mhils commented Aug 7, 2020

I don't, but going by the docs this has been the case since at least 1.0.2: https://www.openssl.org/docs/man1.0.2/man3/SSL_CTX_set_verify.html
The next pyOpenSSL release is supposed to drop 1.0.1, so we should be good here?

@reaperhulk
Copy link
Member

Yep, 1.0.2 is minimum supported going forward so that’s fine.

CHANGELOG.rst Outdated Show resolved Hide resolved
@reaperhulk reaperhulk merged commit 79b9c79 into pyca:master Aug 8, 2020
@mhils
Copy link
Member Author

mhils commented Aug 8, 2020

Thanks for the super quick merge! ❤️

@mhils mhils deleted the set-verify-no-cb branch August 8, 2020 01:09
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 7, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants