YWC*_*llo 10 rack openssl webrick ruby-on-rails-3
我目前在我的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]]
}
Run Code Online (Sandbox Code Playgroud)
我如何指定中间证书?
YWC*_*llo 13
经过一段时间的谷歌搜索关键词后,我设法找到答案.以下是定义中间证书的选项:
:SSLExtraChainCert => [
OpenSSL::X509::Certificate.new(
File.open("certificates/intermediate.crt").read)]
Run Code Online (Sandbox Code Playgroud)
请注意,该选项需要一个Array对象,允许您在需要时包含多个证书.