-
Notifications
You must be signed in to change notification settings - Fork 4
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
Working towards nginx support #12
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll pick this up again tomorrow but thought I might as well share the comments I had from the first small chunk (I stopped after the first 5 commits this go).
rustls-libssl/src/entry.rs
Outdated
OPENSSL_NPN_NO_OVERLAP | ||
} else { | ||
0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This feels like it should be NPN_NO_OVERLAP
in both cases 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have changed these all to NPN_NO_OVERLAP, and also cleared out
and out_len
for cases we can't write something sensible.
Entertainingly OpenSSL's versions explodes in the error cases we're dealing with here:
==281210== Invalid read of size 1
==281210== at 0x48A1C8D: SSL_select_next_proto (in /usr/lib/x86_64-linux-gnu/libssl.so.3)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
😨
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Finished a pass through the rest of the commits. Nice work! A lot of the intermediate commits were stubs that were quick reviews.
I'm a little fuzzy on the ex_data
portions and feel least confident in my review of that area, but I didn't see anything that gave me particular pause: just want to call that out as an area that could use more scrutiny in the future.
Rework ALPN parsing to use an iterator.
Future callbacks will be necessary from rustls trait implementations (like certificate verifier & session store callbacks). For this reason, this commit introduces an indirect storage style for obtaining the original *SSL object pointer. This uses thread-local storage.
(NPN was abandoned in 2011 and replaced with ALPN.)
`SSL_CTX_set_tlsext_servername_callback` is a define to `SSL_CTX_callback_ctrl`. `SSL_CTX_set_tlsext_servername_arg` is a define to `SSL_CTX_ctrl`.
But don't actually implement the limit. Justification: verifiers limiting the chain length is best accomplished by _issuer_ certs instead specifying a path length constraint, and/or not issuing valid but long chains. Theoretically we could implement this inside `webpki`, or even do it ourselves by supplying a `verify_path` callback to it.
We can definitely do these, but not for an MVP.
rustls currently could support these with stateless resumption.
Definitely could implement this with some conversions: it is the same concept as `ClientCertVerifier::root_hint_subjects()`
This one seems unlikely.
We could implement this.
This just returns NULL forever, because rustls does not do compression. That's the same behaviour as OpenSSL built with OPENSSL_NO_COMP.
Will be needed for verify callback support.
This provides: - `SSL_CTX_set_min_proto_version` - `SSL_CTX_set_max_proto_version` - `SSL_CTX_get_min_proto_version` - `SSL_CTX_get_max_proto_version` - `SSL_set_min_proto_version` - `SSL_set_max_proto_version` - `SSL_get_min_proto_version` - `SSL_get_max_proto_version` (All of those functions are routed into `SSL_CTX_ctrl` & `SSL_ctrl`.)
Later commits will implement this, and session resumption more generally.
This uses the system nginx (assumed to be available) to start a server, then grabs a small html file and a larger 5MB download with the system curl (using system openssl).
This PR demonstrates nginx (1.18.0-6ubuntu14.4) support working.
The testing is very light; there is notably zero coverage of TLS downstreams (ie, nginx acting as a TLS client). The ideal for testing would be to get the nginx test suite (at least suites with names starting
ssl
) to pass. However, that seems a few steps away from here.Things this PR leaves undone: