2019-10-20 21:35:15 -04:00
|
|
|
module SSLHelper
|
|
|
|
def ssl_query
|
|
|
|
@ssl_query ||= if Puma.jruby?
|
2020-08-07 17:34:24 -04:00
|
|
|
@keystore = File.expand_path "../../examples/puma/keystore.jks", __dir__
|
2020-06-06 18:27:38 -04:00
|
|
|
@ssl_cipher_list = "TLS_DHE_RSA_WITH_AES_128_CBC_SHA,TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256"
|
2020-08-07 17:31:36 -04:00
|
|
|
"keystore=#{@keystore}&keystore-pass=jruby_puma&ssl_cipher_list=#{@ssl_cipher_list}"
|
2019-10-20 21:35:15 -04:00
|
|
|
else
|
2020-08-07 17:34:24 -04:00
|
|
|
@cert = File.expand_path "../../examples/puma/cert_puma.pem", __dir__
|
|
|
|
@key = File.expand_path "../../examples/puma/puma_keypair.pem", __dir__
|
2019-10-20 21:35:15 -04:00
|
|
|
"key=#{@key}&cert=#{@cert}"
|
|
|
|
end
|
|
|
|
end
|
2020-11-27 10:40:26 -05:00
|
|
|
|
|
|
|
# sets and returns an opts hash for use with Puma::DSL.ssl_bind_str
|
|
|
|
def ssl_opts
|
|
|
|
@ssl_opts ||= if Puma.jruby?
|
|
|
|
@ssl_opts = {}
|
|
|
|
@ssl_opts[:keystore] = File.expand_path '../../examples/puma/keystore.jks', __dir__
|
|
|
|
@ssl_opts[:keystore_pass] = 'jruby_puma'
|
|
|
|
@ssl_opts[:ssl_cipher_list] = 'TLS_DHE_RSA_WITH_AES_128_CBC_SHA,TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256'
|
|
|
|
else
|
|
|
|
@ssl_opts = {}
|
|
|
|
@ssl_opts[:cert] = File.expand_path '../../examples/puma/cert_puma.pem', __dir__
|
|
|
|
@ssl_opts[:key] = File.expand_path '../../examples/puma/puma_keypair.pem', __dir__
|
|
|
|
end
|
|
|
|
end
|
2019-10-20 21:35:15 -04:00
|
|
|
end
|