-
Notifications
You must be signed in to change notification settings - Fork 99
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
SSL "Certificate verify failed" when running trivial test program #10
Comments
Thanks for reporting. Let me re-produce it locally and debug ASAP. |
FYI: Under 0.4.0, no change. |
Probably the compiled package cannot use the certificates on the system and it doesn't have any included. You could use something like this gem https://github.com/liveeditor/net_http_ssl_fix to fix the issue. |
@yourivdlans I mean, I would really like the Ruby deployment story to be better. So I tried this with a simple program and it didn't work. So I gave up on it, nearly a year ago. Which is presumably not what you want people to do. |
@andy-twosticks I fully agree, its not ideal. Compiled programs not using https will probably run fine. I assume the developers hadn't seen this edge case before. Last resort could also be to disable the certificate verification, but also not an ideal solution. |
Can you run:
and:
If these are not the same directory then we need to tweak openssl configuration. I think you can work around the problem by setting |
This is my output:
|
I think |
I've done a bit of testing and come to the following conclusions:
Possible solution: Would it be an idea to download a certification or copy from the local disk during the build process and placing it in the work dir, then pointing openssl to that dir? Although then there is the possibility the certification will get outdated and the app will break. Not sure what the best solution is here. |
Setting |
That would be ok for people wanting to compile a package. But then when the package gets distributed and other systems don't have the certifications in |
I had a look at
So I assume they package root certificates which allows any system / user to run the package regardless of their own certificates installed on the system. I'd suggest |
If we bundle certificates then when CA certificates expire or are revoked rubyc must be recompiled, then users must fetch rubyc, then recompile their application, then distribute their application. Users can be vulnerable to connection hijacking even when the site they're connecting to doesn't use certificates signed by that CA (although the CA was revoked, it is still included thus still trusted). It will mean a CVE for rubyc if they're bundled inside rubyc, so I don't want to bundle them inside ruby-packer as the maintenance burden is far too high. Omnibus can download and install the bundle from curl which removes the need to recompile and distribute rubyc, but not the need to recompile the user's application. This is OK, but leaves the expiration and revocation maintenance burden on the application packager and they may not be aware of it. I prefer to have the packager manage certificates in an informed way. I think it is OK to allow users to make the choice to bundle certificates inside their executable, but it should come with warnings about and protections for the security risks. As a first pass I would prefer to make the openssl dir configurable so packagers can instruct users in how to configure their CA certificate list. Other applications they deploy may already be configured to use the same store, so this may be a no-op. (Homebrew on macOS allows easy installation and maintenance of CA certificates and I believe most linux distributions have the same. We don't compile OpenSSL on Windows yet, but eventually we'll need to point to someone's method of adding CA certificates for Windows.) A follow-up may allow users to place trusted CA certificates in a directory that ruby-packer will package into their executable. This should allow users to balance their vulnerability exposure. RubyGems follows this pattern and bundles only the CA certificates for the servers it connects to to limit vulnerability upon revocation of unrelated CA certificates. |
Very good point.
Alright yeah, thats a good first step.
Really like this idea! Thanks for the clear explanation. I'll try and create a pull request for that first step today :) |
I'm running into this issue as well... any hopes of seeing a solution for this? |
Here's my trivial test program:
This program works when I run it using ruby. But the compiled (gcc) version does this:
Not sure what is going on here; I'm far from clever with SSL.
If change 'https://' to 'http://' in the code, then there is no change: it still retrieves the headlines in ruby, and still returns the exact same error message when compiled.
The text was updated successfully, but these errors were encountered: