Hi team!
Thank you for developing and maintaining RabbitMQ! I have a .NET Core 3.1 web API application that uses RabbitMQ.Client NuGet (6.2.1) to connect and use RabbitMQ (3.8.11).
I am running an application in a Windows Container; RabbitMQ is installed as a standalone locally on Windows 2019.
Docker version:
Client: Mirantis Container Runtime
Version: 19.03.14
API version: 1.40
Go version: go1.13.15
Git commit: e820475
Built: 12/17/2020 19:30:16
OS/Arch: windows/amd64
Experimental: false
Server: Mirantis Container Runtime
Engine:
Version: 19.03.14
API version: 1.40 (minimum version 1.24)
Go version: go1.13.15
Git commit: 57e3a05525
Built: 12/17/2020 19:29:00
OS/Arch: windows/amd64
Experimental: false
A part of the C# code, where we connect to the RabbitMQ:
_factory = new ConnectionFactory()
{
HostName = _cfg.RabbitMqHost,
VirtualHost =
_cfg.RabbitMqVHost,
Port =
_cfg.RabbitMqPort,
UserName = "",
Password = "",
Ssl = new SslOption()
{
Enabled = true,
Certs = new X509CertificateCollection {
_cfg.GetRabbitMqCertificate() },
Version =
_cfg.GetSslProtocol(),
ServerName =
_cfg.RabbitMqHost
}
};
_factory.AuthMechanisms.Clear();
_factory.AuthMechanisms.Add(new ExternalMechanismFactory());
_connection = _factory.CreateConnection();
_session = _connection.CreateModel();
Here is a RabbitMQ config:
log.console = true
log.console.level = debug
loopback_users.guest = false
listeners.tcp = none
listeners.ssl.default = 5671
ssl_options.cacertfile = C:\Certs\ca_certificate.pem
ssl_options.certfile = C:\Certs\server_certificate.pem
ssl_options.keyfile = C:\Certs\server_key.pem
ssl_options.fail_if_no_peer_cert = true
ssl_options.verify = verify_peer
auth_mechanisms.1 = EXTERNAL
ssl_cert_login_from = common_name
ssl_options.versions.1 = tlsv1.2
ssl_options.password = mypass
Here is a docker-compose.yml
version: '3.8'
services:
myapp:
container_name: myapp
ports:
- '5018:80'
- '9059:9059'
image: myimage
I've generated certificates with the tls-gen (basic), and I think I've set up things correctly (I've used Server alt name as 192.168.3.111 when generating the certs). I am using PFX as a client, which is also installed in the user and machine cert store on the Win 2019. I've also checked, and the generated CA is also in the cert store.
If I run my Web API locally without docker containers, the authentication, and app work.
I do not use usernames and passwords, only TLS cert for auth and encryption.
{inet_error,{tls_alert,{unknown_ca,"TLS server: In state connection received CLIENT ALERT: Fatal - Unknown CA\n"}}}
I do not want to use AcceptablePolicyErrors = SslPolicyErrors.RemoteCertificateChainErrors in my client code.
Also, another thing. If I am using MassTransit, there is also no error.
Any hint would be great. Thank you!