如何在 Node 中使用 TLS 连接到没有证书的 RabbitMQ 服务器
我需要使用 Node.js 连接到带有 TLS 的 RabbitMQ 的帮助。
客户端向我们提供了连接到其 RabbitMQ 服务器的凭据。
他们说我们不需要任何 TLS 连接证书,而且我正在使用 NodeJS。
我们收到这个错误。 OperationalError: 证书已过期
我们正在尝试使用此 Node 客户端库 https: //github.com/amqp-node/amqplib 及其 SSL 指南(https://amqp-node.github.io/amqplib/ssl.html)上面写着
If you're not going to use a client certificate, you need only to make sure you will trust the server certificate:
var opts = {
ca: [fs.readFileSync('cacert.pem')]
};
这是我们当前的代码
const conn = await connect({
hostname: process.env.RABBITMQ_HOST,
port: Number(process.env.RABBITMQ_PORT),
username: process.env.RABBITMQ_USER,
password: process.env.RABBITMQ_PASSWORD,
vhost: process.env.RABBITMQ_VHOST,
protocol: 'amqps',
}
I need help connecting to RabbitMQ with TLS using Node.
The client gave us credentials for connecting to their RabbitMQ server.
They say we don’t need any certificates for TLS connection, and I’m using NodeJS.
We’re getting this error.OperationalError: certificate has expired
We’re trying to use this Node client library https://github.com/amqp-node/amqplib and in their SSL guide(https://amqp-node.github.io/amqplib/ssl.html) it’s written
If you're not going to use a client certificate, you need only to make sure you will trust the server certificate:
var opts = {
ca: [fs.readFileSync('cacert.pem')]
};
this is our current code
const conn = await connect({
hostname: process.env.RABBITMQ_HOST,
port: Number(process.env.RABBITMQ_PORT),
username: process.env.RABBITMQ_USER,
password: process.env.RABBITMQ_PASSWORD,
vhost: process.env.RABBITMQ_VHOST,
protocol: 'amqps',
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论