gpt4 book ai didi

c# - SSL 端口 5671 上的 RabbitMQ 无法访问,但可在 telnet 上访问

转载 作者:行者123 更新时间:2023-12-04 22:43:45 25 4
gpt4 key购买 nike

我正在尝试使用 SSL(为本地主机创建开发 ssl)连接到远程机器上的 RabbitMQ。我正在使用 EasyNetQ,并且我遵循了有关注册和配置证书 (https://liquidwarelabs.zendesk.com/hc/en-us/articles/360019562832-Disable-cleartext-authentication-option-in-RabbitMQ) 的所有程序。这个想法是“修复” AMPQ 明文身份验证问题(由某些安全工具报告)。我还在两台机器上安装了受信任的 .pfx 证书。

在这个过程结束时,RabbitMQ 被传输到 TLS 协议(protocol)(甚至是管理插件),并且通过尝试 telnet 端口 5671 是开放的并且可以在远程机器上访问。但是,以下代码返回错误:没有指定的端点是可访问的(捕获的 DoNothingLogger 中的消息)

                    var connection = new ConnectionConfiguration();

connection.Port = 5671;
connection.UserName = "admin";
connection.Password = "****";
connection.Product = "localhost";
connection.VirtualHost = "StageDev";


var host1 = new HostConfiguration();
host1.Host = "skl-igor-naum1";
host1.Port = 5671;
host1.Ssl.Enabled = true;
host1.Ssl.ServerName = "localhost";
host1.Ssl.CertPath = "C:\\tmp\\ProfileUnity.pfx";
//host1.Ssl.CertPassphrase = "admin";
////host1.Ssl.Version = System.Security.Authentication.SslProtocols.Tls12 | System.Security.Authentication.SslProtocols.Tls11;


connection.Hosts = new List<HostConfiguration> { host1 };

connection.Validate();




MessageBusConnection = RabbitHutch.CreateBus(connection, services => services.Register<IEasyNetQLogger>(logger => new DoNothingLogger()));

有没有人有类似的问题或知道解决方案?

最佳答案

你好兄弟,你可以试试这个
#EasyNetQ 3.5.1

private ConnectionConfiguration GetConnectionConfiguration(ushort prefetchCount)
{
var cnn = new ConnectionConfiguration
{
Name = "111.1.1.11",/*rabbitmq ip*/
VirtualHost = "/",
UserName = "user",
Password = "pass",
PrefetchCount = prefetchCount,
Port = 5671
};

var host = new HostConfiguration
{
Host = "111.1.1.11",/*rabbitmq ip*/,
Port = 5671
};

host.Ssl.AcceptablePolicyErrors = SslPolicyErrors.RemoteCertificateNameMismatch | SslPolicyErrors.RemoteCertificateChainErrors | SslPolicyErrors.RemoteCertificateNotAvailable;
host.Ssl.Enabled = true;
host.Ssl.Version = System.Security.Authentication.SslProtocols.Tls12 | System.Security.Authentication.SslProtocols.Tls11 | System.Security.Authentication.SslProtocols.Tls;
host.Ssl.ServerName = "111.1.1.11",/*rabbitmq ip*/;

cnn.Hosts = new List<HostConfiguration> { host };

return cnn ;
}
创建总线
    var mybus = RabbitHutch.CreateBus(GetConnectionConfiguration(1), x =>
{
x.Register<IConventions, AttributeBasedConventions>();
x.EnableMessageVersioning();
});
see reuslt
已连接 = 真
Rabbitmq ssl/tls status

关于c# - SSL 端口 5671 上的 RabbitMQ 无法访问,但可在 telnet 上访问,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54443901/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com