-
Notifications
You must be signed in to change notification settings - Fork 107
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
puma-dev cert not accepted by ruby http libraries #90
Comments
This is fixed in the upcoming release v0.11 |
@evanphx could you elaborate on this? I just tried the current |
@evanphx when is that release happening? I am running into this problem now, and it's a show stopper for me. |
Any updates on this issue? Keep hitting this same problem in local environments. |
Still running into this now also on a Rails app. I just dumped this into an initializer and it's generally fine: Excon.defaults[:ssl_verify_peer] = false if Rails.env.development? But it would be good to know if there's a fix. |
Which commit fixed this? I'd like to be able to check there has not been a regression, because I and several co-workers experience the same error message with puma-dev 0.15.2 on macOS with Net::HTTP. What is the correct way to verify puma-dev's TLS certificate with Net::HTTP ? |
You must specify where to find CA certs for ruby to use them. # create /tmp/cert.pem containing puma-dev CA and all default CAs
cat $(ruby -e "require 'net/http'; puts OpenSSL::X509::DEFAULT_CERT_FILE") \
$HOME/Library/Application\ Support/io.puma.dev/cert.pem \
> /tmp/cert.pem # configure Net::HTTP to use the CA bundle including puma-dev's CA
require 'open-uri'
require 'net/http'
module Net
class HTTP
alias_method :original_use_ssl=, :use_ssl=
def use_ssl=(flag)
self.ca_file = "/tmp/cert.pem"
self.verify_mode = OpenSSL::SSL::VERIFY_PEER
self.original_use_ssl = flag
end
end
end
uri = URI('https://localhost:9283/events')
Net::HTTP.start(uri.host, uri.port, use_ssl: true) do |http|
request = Net::HTTP::Get.new uri
request["User-Agent"] = "net::http"
request["Host"] = "puma-dev"
response = http.request(request)
puts response.body
end |
Common Ruby HTTP libraries like Net::HTTP and Excon will not verify puma-dev's generated certificate on my install. I'm running a fresh MacOS Sierra with homebrew's openssl, and I've moved the puma-dev cert to the System keychain, per #84 (comment).
Examples
Excon provides a helpful error:
Net::HTTP does not:
The text was updated successfully, but these errors were encountered: