Skip to content
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

Binder refactor #1989

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions History.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

* Bugfixes
* Fix Errno::EINVAL when SSL is enabled and browser rejects cert (#1564)
* Fix an issue where SSL binds to port 0 were not reported correctly (#1989)

## 4.2.1 / 2019-10-07

Expand Down
43 changes: 21 additions & 22 deletions examples/puma/client-certs/generate.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,28 +5,27 @@
case ARGV[0]

when "s"

app = proc {|env|
p env['puma.peercert']
[200, {}, [ env['puma.peercert'] ]]
}
events = Puma::Events.new($stdout, $stderr)
server = Puma::Server.new(app, events)

context = Puma::MiniSSL::Context.new
context.key = "certs/server.key"
context.cert = "certs/server.crt"
context.ca = "certs/ca.crt"
#context.verify_mode = Puma::MiniSSL::VERIFY_NONE
#context.verify_mode = Puma::MiniSSL::VERIFY_PEER
context.verify_mode = Puma::MiniSSL::VERIFY_PEER | Puma::MiniSSL::VERIFY_FAIL_IF_NO_PEER_CERT

server.add_ssl_listener("127.0.0.1", 4000, context)

server.run
sleep
#server.stop(true)

# TODO: rewrite to use new binders
# app = proc {|env|
# p env['puma.peercert']
# [200, {}, [ env['puma.peercert'] ]]
# }
# events = Puma::Events.new($stdout, $stderr)
# server = Puma::Server.new(app, events)
#
# context = Puma::MiniSSL::Context.new
# context.key = "certs/server.key"
# context.cert = "certs/server.crt"
# context.ca = "certs/ca.crt"
# #context.verify_mode = Puma::MiniSSL::VERIFY_NONE
# #context.verify_mode = Puma::MiniSSL::VERIFY_PEER
# context.verify_mode = Puma::MiniSSL::VERIFY_PEER | Puma::MiniSSL::VERIFY_FAIL_IF_NO_PEER_CERT
#
# server.bind("127.0.0.1", 4000, context)
#
# server.run
# sleep
# server.stop(true)
when "g"

def issue_cert(dn, key, serial, not_before, not_after, extensions, issuer, issuer_key, digest)
Expand Down