Skip to content

Commit

Permalink
Make httpclient respect system SSL configuration
Browse files Browse the repository at this point in the history
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
  • Loading branch information
stanhu committed Jul 15, 2019
1 parent 96277bb commit a6c0f95
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
5 changes: 5 additions & 0 deletions changelogs/unreleased/sh-fix-httpclient-ssl.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
title: Make httpclient respect system SSL configuration
merge_request: 30749
author:
type: fixed
18 changes: 18 additions & 0 deletions config/initializers/httpclient_patch.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# frozen_string_literal: true

# 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
# https://github.com/nahi/httpclient/pull/386 is merged, we work around
# this limitation by forcing the HTTPClient SSL store to use the default
# system configuration.
module HTTPClient::SSLConfigDefaultPaths
def initialize(client)
super

set_default_paths
end
end

HTTPClient::SSLConfig.prepend HTTPClient::SSLConfigDefaultPaths

0 comments on commit a6c0f95

Please sign in to comment.