MTLS - 为 nodejs 客户端生成证书
MTLS - generate certificate to nodejs client side
我们需要通过相互 TLS 在我们的 ec2 服务器和我们的客户服务器之间进行通信。
请求从我们的服务器发送到我们的客户服务器 - 所以我们是这里的客户。
我读了 this post,谈论如何生成文件。
The first step is to create a certificate authority (CA) that both the
client and server trust. The CA is just a public and private key with
the public key wrapped up in a self-signed X.509 certificate.
我们的证书和他们的证书 - 应该从同一个根 CA 签署?谁应该提供?
我这边的代码应该是这样的:
const req = https.request(
{
hostname: 'myserver.internal.net',
port: 443,
path: '/',
method: 'GET',
cert: fs.readFileSync('client.crt'),
key: fs.readFileSync('client.key'),
ca: fs.readFileSync('ca.crt')
},
res => {
res.on('data', function(data) {
// do something with response
});
}
);
那我们应该互相提供什么呢?我们不完全了解,他们没有提供更多细节,只是要求我们给他们一个证书...
Our cert and their cert - should be signed from the same root CA? who should provide it?
由于客户端证书的控制是在 TLS 服务器端(即在客户处)完成的,因此这完全取决于他们的期望。他们可能需要一个公开签名的证书,他们可能需要一个由他们自己的 CA 签名的证书。或者他们可能只是检查是否使用了特定的证书,并且也会为此接受自签名证书。
我们需要通过相互 TLS 在我们的 ec2 服务器和我们的客户服务器之间进行通信。 请求从我们的服务器发送到我们的客户服务器 - 所以我们是这里的客户。
我读了 this post,谈论如何生成文件。
The first step is to create a certificate authority (CA) that both the client and server trust. The CA is just a public and private key with the public key wrapped up in a self-signed X.509 certificate.
我们的证书和他们的证书 - 应该从同一个根 CA 签署?谁应该提供?
我这边的代码应该是这样的:
const req = https.request(
{
hostname: 'myserver.internal.net',
port: 443,
path: '/',
method: 'GET',
cert: fs.readFileSync('client.crt'),
key: fs.readFileSync('client.key'),
ca: fs.readFileSync('ca.crt')
},
res => {
res.on('data', function(data) {
// do something with response
});
}
);
那我们应该互相提供什么呢?我们不完全了解,他们没有提供更多细节,只是要求我们给他们一个证书...
Our cert and their cert - should be signed from the same root CA? who should provide it?
由于客户端证书的控制是在 TLS 服务器端(即在客户处)完成的,因此这完全取决于他们的期望。他们可能需要一个公开签名的证书,他们可能需要一个由他们自己的 CA 签名的证书。或者他们可能只是检查是否使用了特定的证书,并且也会为此接受自签名证书。