Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add options fields to avoid ssl certificate problem #14

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -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,**安装并信任**,否则您的组件可能工作失败。
Expand Down
2 changes: 1 addition & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down