Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

RabbitMQ .NET Client Not Working with TLS v1.2

Trying to get RabbitMQ wired up to play nice with TLS v1.2. Working with both a Java client and a .NET Core client. The Java client is working but the .NET one is pushing back. Here are my factory settings:

var factory = new ConnectionFactory
{
   HostName = hostName,
   VirtualHost = vHost,
   UserName = username,
   Password = password,
   Port = 5671,
   Ssl = {Enabled = true}
};

I’m getting this exception: System.Security.Authentication.AuthenticationException: A call to SSPI failed, see inner exception. ---> Interop+OpenSsl+SslException: SSL Handshake failed with OpenSSL error - SSL_ERROR_SSL. ---> Interop+Crypto+OpenSslCryptographicException: error:1409442E:SSL routines:SSL3_READ_BYTES:tlsv1 alert protocol version

Looking at the very tail end of the exception message it appears that the TLS version might be old but I have the latest version of RabbitMQ installed – 4.1.1

Dug into the RabbitMQ source for the ConnectionFactory class but cannot find anything relating to setting the TLS version. In my Java app it works thusly: factory.useSslProtocol("TLSv1.2");

Saw in another SO thread that an old version of Erlang might be the cause but I have the latest version (8.1) installed.

Any pointers on where to look next?

UPDATE: Foound the way to set the TLS property: factory.Ssl.Version = SslProtocols.Tls12;

But now I'm getting a System.Security.Authentication.AuthenticationException: The remote certificate is invalid exception.

like image 819
GDB Avatar asked Nov 24 '16 05:11

GDB


1 Answers

this worked for me:

Ssl = new SslOption
{
    Version = SslProtocols.Tls12,
    Enabled = true,
}
like image 131
roger Avatar answered Nov 07 '22 07:11

roger