-
Notifications
You must be signed in to change notification settings - Fork 167
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
Support SSL_CTX_use_certificate_chain_file for providing certificate chains #254
Comments
I also want this. |
We should add some specs/tests for this. |
I've added a very basic test 10afb35 |
I'm playing around with this too:
|
Thank you! Our current workaround: mongodb/mongo-ruby-driver@1f64d64#diff-ed625ecdabf4aeff5d1a5fc04b958a3a |
rhenium
added a commit
to rhenium/ruby-openssl
that referenced
this issue
May 13, 2020
Let's revert the changes for now, as it cannot be included in the 2.2.0 release. My comment on ruby#257: > A blocker is OpenSSL::SSL::SSLContext#add_certificate_chain_file. It > has a pending change and I don't want to include it in an incomplete > state. > > The initial implementation in commit 46e4bdb was not really > useful. The issue is described in ruby#305. ruby#309 extended it > to take the corresponding private key together. However, the new > implementation was incompatible on Windows and was reverted by ruby#320 to > the initial one. > > (The prerequisite to implement it in) an alternative way is ruby#288, and > it's still cooking. This effectively reverts the following commits: - dacd089 ("ssl: suppress test failure with SSLContext#add_certificate_chain_file", 2020-03-09) - 46e4bdb ("Add support for SSL_CTX_use_certificate_chain_file. Fixes ruby#254.", 2019-06-13)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Use case: providing certificates to servers where certificates are signed by intermediate certificates, not root CAs (root CA -> intermediate -> client cert).
ruby-openssl currently uses SSL_CTX_use_certificate_file to add a certificate file to the SSL context. This works when the certificate is signed directly by a CA specified in the CA file, but does not work when the client certificate is signed by an intermediate certificate which is signed by the CA certificate.
OpenSSL appears to provide SSL_CTX_use_certificate_chain_file method (https://linux.die.net/man/3/ssl_ctx_use_certificate_chain_file) which adds the entire certificate chain to the context. As far as I can tell ruby-openssl does not reference this method anywhere in the source. An argument to this method is path to a bundle file, i.e. file which sequentially contains the client certificate and any intermediate certificates needed to get to the root CA cert.
One possible workaround to use certificates signed by intermediate certs is to take the bundle file, split it manually in the application into the separate certificates, and then use
extra_chain_cert
option on the context to add the intermediate certificates to the context. This is done in venuenext/ruby-kafka@9495f5d (zendesk/ruby-kafka#633) for ruby-kafka. However, manually splitting certificate bundle files seems error prone, especially given that OpenSSL natively can handle the bundles.Is there a way to directly pass a certificate bundle to ruby-openssl such that the bundle will then be sent to the server during TLS handshake, and if not, can support for SSL_CTX_use_certificate_chain_file be added please?
The text was updated successfully, but these errors were encountered: