Skip to content

Conversation

@mikz
Copy link

@mikz mikz commented Feb 27, 2018

OpenSSL provides default certificate file and directory in:

  • OpenSSL::X509::DEFAULT_CERT_FILE
  • OpenSSL::X509::DEFAULT_CERT_DIR

Those defaults can be loaded by OpenSSL::X509::Store#set_default_paths.

On platforms that do not have this set up properly HTTPClient::SSLContext#working_openssl_platform? can be made to return false and trigger the old behaviour.

Closes #369

Also fixes failing build due to expired certificate in the test suite. New certificate will expire in 10 years.

test/test_ssl.rb Outdated

private

def set_x509_const(name, value)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd use a block here and ensure after yield

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

mikz and others added 4 commits February 27, 2018 13:31
respect SSL_CERT_DIR and SSL_CERT_FILE environment variables
* do not rely on distributed cacer.pem file
* respect SSL_CERT_DIR and SSL_CERT_FILE
* working OpenSSL platform has working default paths
* disable coverage tracking unless on CI
@mikz mikz changed the title [openssl] respect OpenSSL default certificate store and SSL_CERT_FILE environment Respect OpenSSL default certificate store and SSL_CERT_FILE environment Feb 27, 2018
@mumumu
Copy link

mumumu commented Feb 27, 2018

Also fixes failing build due to expired certificate in the test suite. New certificate will expire in 10 years.

👍

mikz added a commit to 3scale/zync that referenced this pull request Feb 28, 2018
* the git sha no longer exists
* nahi/httpclient#386
@PikachuEXE
Copy link

Will this be merged soon?

mumumu added a commit to mumumu/httpclient that referenced this pull request Sep 17, 2018
@febeling
Copy link

febeling commented Dec 31, 2018

It would be interesting to be able to use the system or any OpenSSL CA with httpclient, still I don't think it's a good idea to change casually for such a widely used lib.

httpclient's policy was to bundle a CA, and that is well-documented. It might be the reason why some people use it. It's the same thing that Java does. It's also different from what net/http and most other ruby http clients do.

So adding an option might be fine, changing basic policies for this I'd warn against - at least without a major version bump.

@stanhu
Copy link

stanhu commented Jul 15, 2019

A few users of GitLab are running into this issue while trying to get OpenID working with a self-signed certificate. Could we get this branch merged and released?

tigefa4u pushed a commit to tigefa4u/gitlabhq that referenced this pull request Jul 15, 2019
By default, httpclient (and hence anything that uses rack-oauth2)
ignores the system-wide SSL certificate configuration in favor of its
own `cacert.pem`. This makes it impossible to use custom certificates
without patching that file. Until
nahi/httpclient#386 is merged, we work around
this limitation by forcing the `HTTPClient` SSL store to use the default
system configuration.

Closes https://gitlab.com/charts/gitlab/issues/1436
tigefa4u pushed a commit to tigefa4u/gitlabhq that referenced this pull request Jul 15, 2019
By default, httpclient (and hence anything that uses rack-oauth2)
ignores the system-wide SSL certificate configuration in favor of its
own `cacert.pem`. This makes it impossible to use custom certificates
without patching that file. Until
nahi/httpclient#386 is merged, we work around
this limitation by forcing the `HTTPClient` SSL store to use the default
system configuration.

Closes https://gitlab.com/charts/gitlab/issues/1436
@floh96
Copy link

floh96 commented Mar 3, 2025

@mikz could you please resolve conflicts?

@mikz
Copy link
Author

mikz commented Mar 3, 2025

@floh96 no unfortunately, I no longer hold the context if this change is necessary or needed. Closing the PR.

@mikz mikz closed this Mar 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SSL_CERT_FILE environment variable is not honoured

7 participants