-
Notifications
You must be signed in to change notification settings - Fork 177
Closed
Description
Hi, I have some code that was retrieving the string contents of a certificate from a database (so "-----BEGIN CERTIFICATE..."
) and setting it to the ca_file
property with OpenSSL. This works for OpenSSL 1.1.1, but on OpenSSL 3.0.9 raises SSL_CTX_load_verify_file: system lib (OpenSSL::SSL::SSLError)
. From what I've read I'm guessing this might have always been unsupported behaviour with OpenSSL 1.1.1, but I was wondering if this was an intentional breaking change, or if there is an alternative way to pass the contents of a certificate to OpenSSL.
I have a set of minimal reproduction steps based of the wget sample below:
OpenSSL 1.1.1
docker run -it ruby:3.1-bullseye
require 'net/https'
pem_contents = File.read(OpenSSL::X509::DEFAULT_CERT_FILE)
uri = URI.parse("https://github.com/ruby/openssl")
h = Net::HTTP.new(uri.host, uri.port)
h.use_ssl = true
h.ca_file = pem_contents
path = uri.path.empty? ? "/" : uri.path
h.get2(path)
# returns <Net::HTTPOK 200 OK readbody=true>
OpenSSL 3.0.9
docker run -it ruby:3.1-bookworm
require 'net/https'
pem_contents = File.read(OpenSSL::X509::DEFAULT_CERT_FILE)
uri = URI.parse("https://github.com/ruby/openssl")
h = Net::HTTP.new(uri.host, uri.port)
h.use_ssl = true
h.ca_file = pem_contents
path = uri.path.empty? ? "/" : uri.path
h.get2(path)
# raises SSL_CTX_load_verify_file: system lib (OpenSSL::SSL::SSLError)
full stacktrace
/usr/local/lib/ruby/3.1.0/net/http.rb:1081:in `initialize': SSL_CTX_load_verify_file: system lib (OpenSSL::SSL::SSLError)
from /usr/local/lib/ruby/3.1.0/net/http.rb:1081:in `new'
from /usr/local/lib/ruby/3.1.0/net/http.rb:1081:in `connect'
from /usr/local/lib/ruby/3.1.0/net/http.rb:995:in `do_start'
from /usr/local/lib/ruby/3.1.0/net/http.rb:984:in `start'
from /usr/local/lib/ruby/3.1.0/net/http.rb:1564:in `request'
from /usr/local/lib/ruby/3.1.0/net/http.rb:1474:in `request_get'
from (irb):10:in `<main>'
from /usr/local/lib/ruby/gems/3.1.0/gems/irb-1.4.1/exe/irb:11:in `<top (required)>'
from /usr/local/bin/irb:25:in `load'
from /usr/local/bin/irb:25:in `<main>'
Metadata
Metadata
Assignees
Labels
No labels