Conversation
The Tornado server was failing to extract client certificates during TLS handshake, resulting in 401 Unauthorized errors. The root causes were: 1. M2IOStream.initialize imported m2_wrap_socket at module load time, so late patching didn't affect the bound reference 2. The peer certificate was lost when close_fd() cleared the socket after handshake completion 3. read_from_fd returning 0 was treated as EOF, causing premature stream closure Fixes applied: - Replace M2IOStream.initialize with version that imports m2_wrap_socket at runtime - Patch _do_ssl_handshake to store peer cert/chain before socket cleanup - Patch read_from_fd to return None instead of 0 to prevent premature closure - Patch get_ssl_certificate/get_ssl_certificate_chain to use stored cert - Patch HTTPServerRequest to delegate to stream's certificate methods
fstagni
force-pushed
the
m2crypto50_tornado
branch
from
September 15, 2026 12:28
b65ccf4 to
9fdeb2a
Compare
Member
|
This definitely isn't the solution. We'll need another tornado_m2crypto release for the real fix. |
Member
|
I think the real fix is DIRACGrid/tornado_m2crypto#10 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The Tornado server was failing to extract client certificates during TLS handshake, resulting in 401 Unauthorized errors. The root causes were:
Fixes applied:
BEGINRELEASENOTES
Thank you for writing the text to appear in the release notes. It will show up
exactly as it appears between the two bold lines
Please follow the template:
*Subsystem
NEW/CHANGE/FIX: explanation
For examples look into release.notes
ENDRELEASENOTES