如何配置 WEBrick 以通过 HTTPS 使用中间证书?
我当前在 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]]
}
我将如何指定中间证书?
I am currently using the following options in my Rails app to enable HTTPS with WEBrick:
{
: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]]
}
How would I go about specifying an intermediate certificate?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
经过额外一个小时的谷歌搜索关键词后,我终于找到了答案。以下是定义中间证书的选项:
请注意,该选项需要一个
Array
对象,允许您根据需要包含多个证书。I managed to find an answer after an extra hour of googling for keywords. Here is the option to define an intermediate certificate:
Note that the option requires an
Array
object, allowing to you include multiple certificates if needed.如果您使用的是 Rails 3,则将 script/rails 文件修改为
上面的代码是根据 将 WEBrick 配置为在 Rails 3 中使用 SSL。这对我有用。
If you are using rails 3, then modify the script/rails file as
The above code was modified from the example in Configuring WEBrick to use SSL in Rails 3. This worked for me.