我目前在 Rails 应用程序中使用以下选项来通过 WEBrick 启用 HTTPS:
{
:Port => 3000,
:environment => (ENV['RAILS_ENV'] || "development").dup,
:daemonize => false,
:debugger => false,
:pid => File.expand_path("tmp/pids/server.pid"),
:config => File.expand_path("config.ru"),
:SSLEnable => true,
:SSLVerifyClient => OpenSSL::SSL::VERIFY_NONE,
:SSLPrivateKey => OpenSSL::PKey::RSA.new(
File.open("certificates/https/key.pem").read),
:SSLCertificate => OpenSSL::X509::Certificate.new(
File.open("certificates/https/cert.pem").read),
:SSLCertName => [["CN", WEBrick::Utils::getservername]]
}
我将如何指定中间证书?
经过额外一个小时的谷歌搜索关键词后,我终于找到了答案。以下是定义中间证书的选项:
:SSLExtraChainCert => [
OpenSSL::X509::Certificate.new(
File.open("certificates/intermediate.crt").read)]
请注意,该选项需要Array
对象,允许您根据需要包含多个证书。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)