SSL 端口 5671 处的 RabbitMQ 无法访问,但可以通过 telnet 访问

问题描述 投票:0回答:1

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

在此过程结束时,RabbitMQ 已转移到 TLS 协议(甚至是管理插件),并且通过尝试 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()));

有人遇到过类似问题或者知道解决办法吗?

c# ssl rabbitmq
1个回答
0
投票

#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

已连接= true

Rabbitmq ssl/tls status

© www.soinside.com 2019 - 2024. All rights reserved.