简体   繁体   English

NodeJs tls.createServer是否等效于Apache SSLCertificateChainFile?

[英]NodeJs tls.createServer equivalent to Apache SSLCertificateChainFile?

I have an Apache config for SSL like so: 我有一个SSL的Apache配置,如下所示:

SSLCertificateFile ~/certs/server.crt
SSLCertificateKeyFile ~/certs/server.key
SSLCertificateChainFile ~/certs/bundle.crt

Now in my NodeJs server, I am using grunt with grunt-connect as the server. 现在在我的NodeJs服务器中,我将grunt-connectgrunt-connect一起用作服务器。

The documentation for grunt-connect says that it can be configured using the following syntax. grunt-connect文档指出,可以使用以下语法对其进行配置。

grunt.initConfig({
  connect: {
    server: {
      options: {
        protocol: 'https',
        port: 8443,
        key: grunt.file.read('server.key').toString(),
        cert: grunt.file.read('server.crt').toString(),
        ca: grunt.file.read('ca.crt').toString()
      },
    },
  },
});

I need this configuration to match my Apache configurations. 我需要此配置来匹配我的Apache配置。 It has a certificate file, and a key file, and also a bundle file. 它具有一个证书文件,一个密钥文件以及一个捆绑文件。

Looking at the documentation for the tls.createServer in NodeJs, I do not see an option that looks like it could be equivalent to SSLCertificateChainFile . NodeJs中查看tls.createServer的文档时,我看不到一个选项可能看起来等同于SSLCertificateChainFile

How can I make my NodeJs connect server mirror the same SSL configuration as my Apache server? 如何使我的NodeJ连接服务器镜像与我的Apache服务器相同的SSL配置?


EDIT 编辑

I will also award the bounty to someone who can do this: 我还将把赏金授予能够做到这一点的人:

Create a SSCCE Gruntfile that demonstrates how to configure connect to accept a server certificate and bundle certificate. 创建一个SSCCE Gruntfile ,演示如何配置connect以接受服务器证书捆绑包证书。

You may try concatenating server.crt and ca.crt files in one file and using result in cert option. 您可以尝试将server.crt和ca.crt文件合并为一个文件,并在cert选项中使用result。 Don't use ca option, as per docs it is needed only 'if the client uses the self-signed certificate'. 不要使用ca选项,根据文档 ,仅在“如果客户端使用自签名证书”才需要。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM