1
0
Fork 0
mirror of https://github.com/puma/puma.git synced 2022-11-09 13:48:40 -05:00
puma--puma/test/config/ssl_config.rb
Michael Herold 5a92683afd
Allow mutual TLS CA to be set using ssl_bind DSL
When using mutual TLS, you must specify the CA certificate chain to use
for verifying the peer. Using Puma's `ssl_bind` DSL did not give you the
option of doing so, which lead to confusing errors when attempting to
use it.

Now, when specifying the `verify_mode` as either `peer` or `force_peer`,
you can use the DSL to set the `ca` value as needed within the `Binder`.
This allows you to use the DSL instead of falling back to the default
`bind` syntax via the URI-style configuration pattern.
2019-02-20 14:27:00 -06:00

13 lines
419 B
Ruby

key = File.expand_path "../../examples/puma/puma_keypair.pem", __FILE__
cert = File.expand_path "../../examples/puma/cert_puma.pem", __FILE__
ca = File.expand_path "../../examples/puma/client-certs/ca.crt", __FILE__
ssl_bind "0.0.0.0", 9292, :cert => cert, :key => key, :verify_mode => "peer", :ca => ca
app do |env|
[200, {}, ["embedded app"]]
end
lowlevel_error_handler do |err|
[200, {}, ["error page"]]
end