rabbitmq-c SSL peer cert verification failed

476 Views Asked by At

I'm trying to connect using SSL, SSL is enabled on the server but I'm not able to connect using the rabbitmq-c client.

I took the amqps_connect_timeout.c example and this is the error that I'm getting at amqp_socket_open_noblock.

SSL peer cert verification failed

When using OpenSSL the connection and verification succeed.

openssl verify -CAfile cacert.pem cert.pem
cert.pem: OK

openssl s_client -connect www.example.com:25586 -CAfile cacert.pem
Verify return code: 0 (ok)

If I disable certificate verification the connection succeed.

amqp_ssl_socket_set_verify_peer(socket, 0);

What am I doing wrong?

1

There are 1 best solutions below

0
Amir Rossert On

I have found what was wrong, my CAfile was missing the intermediate certificate. Probably openssl s_client is ignoring this by default.

After fixing the cacert file the connection was established from the rabbitmq-c library.