【发布时间】:2015-05-18 16:37:19
【问题描述】:
我已将我的安全节点服务器设置为:
var HTTPSOptions = {
hostname: config.hostname,
cert: fs.readFileSync(config.ssl.cert_path),
key: fs.readFileSync(config.ssl.key_path),
requestCert: true,
rejectUnauthorized: false,
passphrase: config.ssl.ca_key_password
};
HTTPSOptions.agent = new https.Agent(HTTPSOptions);
var httpsServer = https.createServer(HTTPSOptions, app).listen(config.https_port, function () {
console.info("HTTPS server running on %d", config.https_port);
});
我还为我的一个客户生成了client.key、client.crt 和client.csr,并使用服务器的.key 和.crt 对其进行了签名。
现在,我想从客户端连接到我的 API。阅读了 cURL 的工作原理,我使用了:
curl --key client.key --cert client.crt:clientPassword mySecureSite.com\api\call
这很好用,除了如果我提供任何密钥/证书或任何密码,或者即使我不提供任何密钥/证书,相同的代码也可以工作!
谁能赐教?
【问题讨论】: