rebus-org / Rebus.RabbitMq

:bus: RabbitMQ transport for Rebus
https://mookid.dk/category/rebus
Other
63 stars 44 forks source link

SSL certificate validation problem after upgrading to v5.0.1 #42

Closed tioma18 closed 5 years ago

tioma18 commented 5 years ago

Hello!

I have an ASP.NET Core 2.2 project. After upgrading package from v4.4.2 to v5.0.1 I have an error with SSL: Rebus.Injection.ResolutionException: Could not resolve Rebus.Bus.IBus with decorator depth 0 - registrations: Rebus.Injection.Injectionist+Handler ---> RabbitMQ.Client.Exceptions.BrokerUnreachableException: None of the specified endpoints were reachable ---> System.AggregateException: One or more errors occurred. (The remote certificate is invalid according to the validation procedure.) ---> System.Security.Authentication.AuthenticationException: The remote certificate is invalid according to the validation procedure.

In a project I use RabbitMQ.Client v5.1.0. The certificate is self-assigned for developing process. With Rebus.RabbitMq v4.4.2 it still works good, but I have to use new features from v5.0.1.

How I configure transport:

internal static void UseRabbitMq(StandardConfigurer<ITransport> t, QueueSettings settings)
        {
            var builder = t.UseRabbitMq(settings.ConnectionString.ToString(), settings.Name)
                .ExchangeNames(settings.DirectExchange, settings.TopicsExchange)
                .Prefetch(settings.Prefetch)
                .CustomizeConnectionFactory(factory => new HelthCheckConnectionFactory(factory));

            if (settings.Ssl != null)
            {
                builder.Ssl(new SslSettings(true, settings.Ssl.ServerName,
                    acceptablePolicyErrors: SslPolicyErrors.RemoteCertificateChainErrors |
                                            SslPolicyErrors.RemoteCertificateNameMismatch |
                                            SslPolicyErrors.RemoteCertificateNotAvailable));
            }
        }

Thank you!

mookid8000 commented 5 years ago

Hey there, did you figure it out?

tioma18 commented 5 years ago

Yes, the problem was in my implementation of HelthCheckConnectionFactory. Sorry

mookid8000 commented 5 years ago

Ah, good. Happy to hear you figured it out 👍