Skip to content

allow providing a custom certificate store - #297

Closed
bdegomme wants to merge 2 commits into
WinRb:mainfrom
bdegomme:allow_provide_cert_store
Closed

bdegomme wants to merge 2 commits into
WinRb:mainfrom
bdegomme:allow_provide_cert_store

Conversation

@bdegomme

@bdegomme bdegomme commented Apr 24, 2025

Copy link
Copy Markdown

I recently has an issue with a customer having a valid certificate chain, but nevertheless the viewpoint gem raised error certificate verify failed (unable to get local issuer certificate) (OpenSSL::SSL::SSLError) when trying to access their server. Their certificate was generated with Let's Encrypt.

I fixed this error by providing the default certificate store for use by EWSClient, like this

cert_store = OpenSSL::X509::Store.new
cert_store.set_default_paths
Viewpoint::EWSClient.new(url, username, password, http_opts: { cert_store: })

I'm not sure why Viewpoint doesn't use the system certificate store by default, and there may be a more elegant fix to this, but I thought I would put this out there.

pcai added a commit that referenced this pull request Sep 15, 2026
Add an opt-in :cert_store option to Viewpoint::EWS::Connection#initialize (also reachable through EWSClient's :http_opts). When given an OpenSSL::X509::Store, it is assigned directly to the HTTPClient SSL config and the :trust_ca handling is skipped.

In some environments the default certificate store fails to verify an otherwise valid chain (e.g. "certificate verify failed (unable to get local issuer certificate)" against a Let's Encrypt-issued server cert), leaving monkeypatching as the only recourse. This gives those users a supported escape hatch without changing any default behavior.

Supersedes #297, reimplemented from current main.
@pcai

pcai commented Sep 15, 2026

Copy link
Copy Markdown
Contributor

Reimplemented from current main as #304 and merged — closing this as superseded. @bdegomme thank you

@pcai pcai closed this Sep 15, 2026
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.

2 participants