如何配置WEBrick以将中间证书与HTTPS一起使用? [英] How do I configure WEBrick to use an intermediate certificate with HTTPS?

查看:131
本文介绍了如何配置WEBrick以将中间证书与HTTPS一起使用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前在我的Rails应用程序中使用以下选项来启用带有WEBrick的HTTPS:

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?

推荐答案

在搜索了一个多小时的关键字后,我设法找到了答案.这是定义中间证书的选项:

I managed to find an answer after an extra hour of googling for keywords. Here is the option to define an intermediate certificate:

:SSLExtraChainCert => [
    OpenSSL::X509::Certificate.new(
      File.open("certificates/intermediate.crt").read)]

请注意,该选项需要一个Array对象,允许您在需要时包含多个证书.

Note that the option requires an Array object, allowing to you include multiple certificates if needed.

这篇关于如何配置WEBrick以将中间证书与HTTPS一起使用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆