-
Notifications
You must be signed in to change notification settings - Fork 788
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
Root certs from keychain not installed when using Homebrew's openssl #380
Comments
Perhaps Homebrew should take care of bootstrapping a cert file after installation. We'd almost certainly accept a patch to the openssl formula to enable this. |
@jacknagel Agreed Homebrew could do this. However it's not an immediate enough solution for our needs. We need to push out a ruby-build release fast to help people who are installing on OS X and already have openssl installed through Homebrew. A patch to Homebrew wouldn't help them. @sferik Let's be crazy and reckless and actually create |
@mislav I think that's reasonable. Based on @jacknagel's comment above, I think it is fine to create the |
If this is the prevailing feeling then let’s make the change in
Why wouldn’t a patch to It seems easier to: brew update
brew upgrade openssl versus: brew update
brew upgrade ruby-build
rbenv install 2.0.0-p247 What am I missing? |
I foresee two problems for us if we fix it in Homebrew:
|
Good question. Perhaps we could bump the version number to Alternately, we could instruct users to: brew update
brew rm openssl
brew install openssl
We could update the wiki, suggesting that users make sure they have the latest version of both |
Other distros use a separate package for root certs, like Ubuntu's Perhaps the best option here is to have |
I am working on enabling "revisions" for formula that will allow us to force upgrades, but it will be a while before it lands in core; in the meantime I am a moderately strong -1 on forcing a rebuild of openssl just to run a few shell commands, I think it would be just as easy for ruby-build to do this temporarily.
I would advise against this; placing untrusted (Homebrew doesn't do any sort of signature verification on this package) certs into the default location is asking for trouble. |
Good point @jacknagel. Check out how ruby-build avoids this by extracting the certs from the keychain. Perhaps a homebrew "package" could do as much. |
That is what I am advocating and have proposed in Homebrew/legacy-homebrew#21065. To summarize, my suggestion is:
|
I would suggest ruby-build generates Then homebrew would (somehow) update and maintain If the user chooses to point the Homebrew and ruby-build can both emit a warning/message about the pre-existing symlink. We don't want to clobber an existing |
I have changed my mind about being "crazy and reckless". I'm less convinced now that we should be installing root certs on the behalf of the user when we link against an openssl we are not in charge of (such as Homebrew's). This screws up users that care about security. I'm more in favor of a warning + suggested line of action for the user in the output after compiling Ruby. |
@mislav 👍 Want to write this up? |
It seems like a friendly default would be for ruby-build to always build it's own OpenSSL (including certs file from the Mac Keychain). Advanced users can specify that they want to use Homebrew's OpenSSL if they want. For those looking for a quick workaround: |
"It seems like a friendly default would be [...]" — this is what ruby-build does currently @balexand 😁 |
@jeremy I apologize in advance if I'm being a bone head, but unfortunately, that's not what I'm experiencing. If I have openssl installed via Homebrew, then ruby-build doesn't build a bundled version of openssl. If I uninstall Homebrew's openssl and then reinstall Ruby, then ruby-build does build the bundled openssl and everything works with no fiddling. The code responsible for this is in ae6a837. I'm proposing that ruby-build should build the bundled openssl regardless of whether Homebrew's openssl is installed. That way, we get a no-fiddling-required, Just WorksTM experience. And developers who want to use Homebrew's openssl can explicitly set the |
Basically, I'm proposing that the |
@balexand righto - I'm out of date 👍 |
@balexand (that's how it used to work, fwiw, but it came with its own headaches: check out old issues to review.) |
ruby-build used to build a separate openssl for each Ruby 2.0 on OS X. We're now detecting Homebrew openssl and using that instead, unless overridden. The CA certs will be installed automatically with On other systems there is no magic behavior. |
Thanks @mislav. I must have had an old version of openssl from Homebrew, since it didn't have certs installed. |
@balexand Yeah, that's the downside of this transition period. But it'll get fixed as people go forward. Note to allIf you have issues with missing certificates and you use Homebrew, try:
This will set up your certificates correctly in Homebrew's OpenSSL using Apple's CA Root certificates. |
Closing since this is now handled in Homebrew Homebrew/legacy-homebrew@0a5b437 |
``` /Users/michal/.rbenv/versions/3.2.2/lib/ruby/3.2.0/net/protocol.rb:46:in `connect_nonblock': SSL_connect returned=1 errno=0 peeraddr=84.16.68.210:443 state=error: wrong signature type (OpenSSL::SSL::SSLError) ``` Tried to fix with following without success: - rbenv/ruby-build#2061 - rbenv/ruby-build#380
I found a regression after my commit ae6a837 that landed in the latest release.
When we built openssl for every Ruby 2.x, we also extracted root certs from system keychain and put them in the openssl directory under ruby's prefix. That enabled users to easily make HTTPS requests from Ruby with VERIFY_PEER enabled, like they could with a Ruby version that was linked with OS X's openssl.
Now, Ruby 2 versions are linked against Homebrew openssl which doesn't have a default
/usr/local/etc/openssl/cert.pem
and we don't create the file either, since we're not in charge of setting up openssl anymore. That means Ruby 2/Homebrew users will experience HTTPS failures from their code.I've created my
cert.pem
like so:pem_file="$(ruby -ropenssl -e 'puts OpenSSL::X509::DEFAULT_CERT_FILE')"
Then I ran the two
find-certificate
commands from the above link. This is a one-time operation to set up one's Homebrew-installed openssl. The question is: do we do that for people from ruby-build? It feels intrusive to their environment. However, in the current state people will think their Ruby 2 installs are broken.The text was updated successfully, but these errors were encountered: