From 011f98faeae8a0e7de33865539635d9aea4c981b Mon Sep 17 00:00:00 2001 From: liujiawei Date: Fri, 29 Nov 2019 12:19:20 +0800 Subject: [PATCH 1/2] Add options to ignore self signed ssl certificate --- src/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/index.js b/src/index.js index 19fe213..615ec8c 100644 --- a/src/index.js +++ b/src/index.js @@ -203,7 +203,7 @@ function CertManager(options) { .listen(port); // do not use node.http to test the cert. Ref: https://github.com/nodejs/node/issues/4175 - const testCmd = `curl https://${DOMAIN_TO_VERIFY_HTTPS}:${port}`; + const testCmd = options.ignoreSslVerify ? `curl -k https://${DOMAIN_TO_VERIFY_HTTPS}:${port}` : `curl https://${DOMAIN_TO_VERIFY_HTTPS}:${port}`; exec(testCmd, { timeout: 1000 }, (error, stdout, stderr) => { server.close(); if (error) { From 763f4ce1fcf3b8e2c391ccd6973af90f7752c575 Mon Sep 17 00:00:00 2001 From: liujiawei Date: Fri, 29 Nov 2019 12:24:20 +0800 Subject: [PATCH 2/2] update readme.md --- readme.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/readme.md b/readme.md index 68f2eae..09b215e 100644 --- a/readme.md +++ b/readme.md @@ -41,6 +41,9 @@ crtMgr.generateRootCA(rootOptions); 默认情况下,证书都会生成在 `{USER_HOME}/.node_easy_certs/`。 如果配置了`rootDirPath`, 那么所有的证书都会生成在该目录下。 +### ignoreSslVerify +是否忽略证书检验,默认为false。防止信任自签证书时调用 `ifRootCATrusted` 方法失败 。 + ## 方法 ### generateRootCA(options, callback(error, keyPath, crtPath)) 在证书根目录下面生成根证书rootCA.crt 和 rootCA.key。生成后,请选择rootCA.crt,**安装并信任**,否则您的组件可能工作失败。