Workbench loads CA certs on Red Hat.
authorBrett Smith <brett@curoverse.com>
Wed, 3 Feb 2016 10:37:42 +0000 (05:37 -0500)
committerBrett Smith <brett@curoverse.com>
Wed, 3 Feb 2016 10:37:42 +0000 (05:37 -0500)
This has the same rationale and logic as #6432 and
9b910084faf3db6fa2071af604620e7d45d12a6c, applied to Workbench.

Changing from `/etc/ssl/certs` to `/etc/ssl/certs/ca-certificates.crt`
is safe, because add_trust_ca accepts either a directory with hashed
certs, or a file with multiple certs.  On Debian, the latter path is a
single file built from the hashed certs in the former, so this is
functionally identical there, and more predictable on Red Hat (where I
don't know what it's doing).

No issue #.

apps/workbench/app/models/arvados_api_client.rb

index 4d549d194728eb00a9f3a2a01fd097d84955a16e..13d4a24c69cc5f7e687c47c0e95ed715ab9f5fa2 100644 (file)
@@ -89,7 +89,10 @@ class ArvadosApiClient
           @api_client.ssl_config.verify_mode = OpenSSL::SSL::VERIFY_NONE
         else
           # Use system CA certificates
-          @api_client.ssl_config.add_trust_ca('/etc/ssl/certs')
+          ["/etc/ssl/certs/ca-certificates.crt",
+           "/etc/pki/tls/certs/ca-bundle.crt"]
+            .select { |ca_path| File.readable?(ca_path) }
+            .each { |ca_path| @api_client.ssl_config.add_trust_ca(ca_path) }
         end
         if Rails.configuration.api_response_compression
           @api_client.transparent_gzip_decompression = true