sslrabbitmqrabbitmq-c

Rabbitmq-c "SSL peer cert verification failed"


I'm trying to connect to RabbitMQ server using SSL but i'm getting this error "SSL peer cert verification failed".

I check the certificate using openssl like so: openssl s_client -connect host:port -CAfile cacert.pem

And got "Verify return code: 0 (ok)" so i believe that the certificate is OK.

I'm trying to use the amqps_bind.c example in here.

I only need server verification so I removed the amqp_ssl_socket_set_key().

The code is failing in amqp_socket_open().

Also i have a C# code that can connect to the same server using SSL without any errors.


Solution

  • I have found my issue.

    The cacert.pem file that I provided was all the chain of certificates.

    After extracting only the root certificate I can connect to the sever.