Reputation: 226
I'm trying to use pika to connect to RabbitMQ using SSL (self signed).
The problem is that the connect not failing if I do not give the certificate file to pika.
This is my code:
import pika
import urllib
connection = pika.BlockingConnection(pika.URLParameters("amqps://guest:[email protected]:25585"))
channel = connection.channel()
channel.queue_declare(queue='hello')
channel.basic_publish(exchange='',
routing_key='hello',
body='Hello World!')
print(" [x] Sent 'Hello World!'")
connection.close()
And this is my rabbitmq.config:
{tcp_listeners, []},
{ssl_listeners, [25585]},
{ssl_options, [{cacertfile, "/etc/rabbitmq/certs/cacert.pem"},
{certfile, "/etc/rabbitmq/certs/cert.pem"},
{keyfile, "/etc/rabbitmq/certs/key.pem"},
{verify, verify_peer},
{versions, ['tlsv1.2', 'tlsv1.1', 'tlsv1']},
{fail_if_no_peer_cert, false}]},
I have disabled TCP connection and enabled the SSL, why is the connection not failing?
Upvotes: 1
Views: 8940
Reputation: 1
It's because of this configuration in the server: {fail_if_no_peer_cert, false}
Change it to : {fail_if_no_peer_cert, true}
It means drop the connection if there is no certificate presented by Client.
Upvotes: 0