"Insufficient security" getting you down? Read for more details

3,608 views
Skip to first unread message

Luke Bakken

unread,
Oct 24, 2017, 5:12:29 PM10/24/17
to rabbitmq-users
Hello RabbitMQ users,

If you limit the cipher suites available for RabbitMQ to use when establishing an SSL/TLS session, you may run into this not-very-helpful error:

SSL: hello: tls_handshake.erl:178:Fatal error: insufficient security - no_suitable_ciphers

This may be due to the keyUsage extension's value in your server certificate. After doing a bit of digging, I found that some cipher suite combinations require the digitalSignature and keyEncipherment values to be present for keyUsage. You can read more in this PR's summary: [link]

The relevant RabbitMQ documentation will also be updated here: http://www.rabbitmq.com/ssl.html

Thank you for using RabbitMQ and participating in this user community -
Luke Bakken

--
Staff Software Engineer
Pivotal / RabbitMQ

Darijan

unread,
Jul 30, 2019, 11:44:16 AM7/30/19
to rabbitmq-users
Hi Luke,

We have a similar issue to the one you're referring when establishing a tls/ssl connection using the relatively new RabbitMQ version 3.7.15 with Erlang version 22.0.5.

When testing the connection using openssl with command:
openssl s_client -connect <hostname>:5671 -debug -tls1_2

and configuration:
# SSL settings
listeners.ssl.1 = 5671
num_acceptors.ssl = 8
ssl_options.cacertfile = /cacert-path.pem
ssl_options.certfile   = /cert-path.pem
ssl_options.keyfile    = /key-path.pem
ssl_options.verify     = verify_peer
ssl_options.fail_if_no_peer_cert = false
ssl_options.versions.1 = tlsv1.3
ssl_options.versions.2 = tlsv1.2


we receive the following error:
CONNECTED(00000124)
---
no peer certificate available
---
No client certificate CA names sent
---
SSL handshake has read 7 bytes and written 0 bytes
---
New, (NONE), Cipher is (NONE)
Secure Renegotiation IS NOT supported
Compression: NONE
Expansion: NONE
No ALPN negotiated
SSL-Session:
    Protocol  : TLSv1.2
    Cipher    : 0000
    Session-ID:
    Session-ID-ctx:
    Master-Key:
    Key-Arg   : None
    PSK identity: None
    PSK identity hint: None
    SRP username: None
    Start Time: 1564500521
    Timeout   : 7200 (sec)
    Verify return code: 0 (ok)
---
8512:error:1409442F:SSL routines:ssl3_read_bytes:tlsv1 alert insufficient security:s3_pkt.c:1498:SSL alert number 71
8512:error:1409E0E5:SSL routines:ssl3_write_bytes:ssl handshake failure:s3_pkt.c:659:

Unfortunately the server logs at the debug level do not provide much more information:
2019-07-30 15:11:14.201 [debug] <0.372.1> User 'guest' authenticated successfully by backend rabbit_auth_backend_internal
2019-07-30 15:11:16.521 [debug] <0.387.1> Supervisor {<0.387.1>,rabbit_connection_sup} started rabbit_connection_helper_sup:start_link() at pid <0.388.1>
2019-07-30 15:11:16.521 [debug] <0.387.1> Supervisor {<0.387.1>,rabbit_connection_sup} started rabbit_reader:start_link(<0.388.1>, {acceptor,{0,0,0,0,0,0,0,0},5671}) at pid <0.389.1>
2019-07-30 15:11:19.121 [debug] <0.397.1> User 'guest' authenticated successfully by backend rabbit_auth_backend_internal

Java client would fail with a similar error:
Caused by: javax.net.ssl.SSLHandshakeException: Received fatal alert: insufficient_security
        at java.base/sun.security.ssl.Alert.createSSLException(Alert.java:131)
        at java.base/sun.security.ssl.Alert.createSSLException(Alert.java:117)
        at java.base/sun.security.ssl.TransportContext.fatal(TransportContext.java:308)
        at java.base/sun.security.ssl.Alert$AlertConsumer.consume(Alert.java:285)
        at java.base/sun.security.ssl.TransportContext.dispatch(TransportContext.java:181)
        at java.base/sun.security.ssl.SSLTransport.decode(SSLTransport.java:164)
        at java.base/sun.security.ssl.SSLSocketImpl.decode(SSLSocketImpl.java:1152)
        at java.base/sun.security.ssl.SSLSocketImpl.readHandshakeRecord(SSLSocketImpl.java:1063)
        at java.base/sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:402)
        at java.base/sun.security.ssl.SSLSocketImpl.ensureNegotiated(SSLSocketImpl.java:716)
        at java.base/sun.security.ssl.SSLSocketImpl$AppOutputStream.write(SSLSocketImpl.java:970)
        at java.base/java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:81)
        at java.base/java.io.BufferedOutputStream.flush(BufferedOutputStream.java:142)
        at java.base/java.io.DataOutputStream.flush(DataOutputStream.java:123)
        at com.rabbitmq.client.impl.SocketFrameHandler.sendHeader(SocketFrameHandler.java:147)
        at com.rabbitmq.client.impl.SocketFrameHandler.sendHeader(SocketFrameHandler.java:153)
        at com.rabbitmq.client.impl.AMQConnection.start(AMQConnection.java:303)
        at com.rabbitmq.client.ConnectionFactory.newConnection(ConnectionFactory.java:1104)
        at com.rabbitmq.client.ConnectionFactory.newConnection(ConnectionFactory.java:1054)
        at com.rabbitmq.client.ConnectionFactory.newConnection(ConnectionFactory.java:994)
        at org.springframework.amqp.rabbit.connection.AbstractConnectionFactory.createBareConnection(AbstractConnectionFactory.java:462)

System configuration:
- RabbitMQ server version 3.7.15
- Erlang 22.0.5
- Operating system version: Amazon Linux 2 (CentOS 7.x)
- RabbitMQ plugins:
      * rabbitmq_management
      * rabbitmq_consistent_hash_exchange
      * rabbitmq_shovel_management
      * rabbitmq_shovel

Any suggestions on this before we open an issue?

Dne torek, 24. oktober 2017 22.12.29 UTC+1 je oseba Luke Bakken napisala:

Luke Bakken

unread,
Jul 30, 2019, 12:04:46 PM7/30/19
to rabbitmq-users
Hi Darijan,

In the future, please start a new discussion instead of replying to an old one.

You have an issue with your configuration or certificates. Please do not open an issue on GitHub as there is no evidence of a bug with RabbitMQ.

I assume that the configuration you provided is the complete contents of /etc/rabbitmq/rabbitmq.conf and that you are not using any other configuration via advanced.config or environment variables.

Please provide information about how you installed Erlang and RabbitMQ. What packages did you use and what commands to install them?

Please ensure that the rabbitmq user can read the pem files you have on your server.

Try a simpler configuration and test with openssl. Do not limit TLS version -

listeners.ssl.1 = 5671
num_acceptors.ssl = 8
ssl_options.cacertfile = /cacert-path.pem
ssl_options.certfile   = /cert-path.pem
ssl_options.keyfile    = /key-path.pem
ssl_options.verify     = verify_none
ssl_options.fail_if_no_peer_cert = false

Then run:

openssl s_client -connect <hostname>:5671 -debug

Finally, see these instructions for enabling the complete list of cipher suites:


Thanks,
Luke

Michael Klishin

unread,
Jul 31, 2019, 3:38:49 PM7/31/19
to rabbitmq-users
[1] is worth mentioning. It doesn't matter what the issue is, narrowing it down usually involves the same set of tools
and a process of elimination ;)

Darijan

unread,
Aug 1, 2019, 5:51:15 AM8/1/19
to rabbitmq-users
Apologies and thanks for answering Luke. We are not using advanced.config or setting environment variables.

Complete content of the rabbitmq.conf is the following:

cluster_formation.peer_discovery_backend = rabbit_peer_discovery_classic_config

cluster_formation.classic_config.nodes.1 = rabbit@<hostname1>
cluster_formation.classic_config.nodes.2 = rabbit@<hostname2>
cluster_formation.classic_config.nodes.3 = rabbit@<hostname3>


# guest user access outside of localhost
loopback_users = none
# listeners.tcp.default = 5672


# SSL settings
listeners.ssl.1 = 5671
num_acceptors.ssl = 8
ssl_options.cacertfile = /cacert-path.pem
ssl_options.certfile   = /cert-path.pem
ssl_options.keyfile    = /key-path.pem
ssl_options.verify     = verify_peer
ssl_options.fail_if_no_peer_cert = false
ssl_options.versions.1 = tlsv1.3
ssl_options.versions.2 = tlsv1.2

ssl_options.ciphers.1 = ECDHE-ECDSA-AES256-GCM-SHA384
ssl_options.ciphers.2 = ECDHE-RSA-AES256-GCM-SHA384
ssl_options.ciphers.3 = ECDHE-ECDSA-AES256-SHA384
ssl_options.ciphers.4 = ECDHE-RSA-AES256-SHA384
ssl_options.ciphers.5 = ECDH-ECDSA-AES256-GCM-SHA384
ssl_options.ciphers.6 = ECDH-RSA-AES256-GCM-SHA384
ssl_options.ciphers.7 = ECDH-ECDSA-AES256-CBC-SHA384
ssl_options.ciphers.8 = ECDH-RSA-AES256-CBC-SHA384
ssl_options.ciphers.9 = DHE-RSA-AES256-GCM-SHA384
ssl_options.ciphers.10 = DHE-DSS-AES256-GCM-SHA384
ssl_options.ciphers.11 = DHE-RSA-AES256-SHA256
ssl_options.ciphers.12 = DHE-DSS-AES256-CBC-SHA256
ssl_options.ciphers.13 = ECDHE-ECDSA-AES128-GCM-SHA256
ssl_options.ciphers.14 = ECDHE-RSA-AES128-GCM-SHA256
ssl_options.ciphers.15 = ECDHE-ECDSA-AES128-SHA256
ssl_options.ciphers.16 = ECDHE-RSA-AES128-SHA256
ssl_options.ciphers.17 = ECDH-ECDSA-AES128-GCM-SHA256
ssl_options.ciphers.18 = ECDH-RSA-AES128-GCM-SHA256
ssl_options.ciphers.19 = ECDH-ECDSA-AES128-CBC-SHA256
ssl_options.ciphers.20 = ECDH-RSA-AES128-CBC-SHA256
ssl_options.ciphers.21 = DHE-RSA-AES128-GCM-SHA256
ssl_options.ciphers.22 = DHE-DSS-AES128-GCM-SHA256
ssl_options.ciphers.23 = DHE-RSA-AES128-SHA256
ssl_options.ciphers.24 = DHE-DSS-AES128-CBC-SHA256
ssl_options.ciphers.25 = ECDHE-ECDSA-AES256-SHA
ssl_options.ciphers.26 = ECDHE-RSA-AES256-SHA
ssl_options.ciphers.27 = DHE-RSA-AES256-SHA
ssl_options.ciphers.28 = DHE-DSS-AES256-CBC-SHA
ssl_options.ciphers.29 = ECDH-ECDSA-AES256-CBC-SHA
ssl_options.ciphers.30 = ECDH-RSA-AES256-CBC-SHA
ssl_options.ciphers.31 = ECDHE-ECDSA-AES128-SHA
ssl_options.ciphers.32 = ECDHE-RSA-AES128-SHA
ssl_options.ciphers.33 = DHE-RSA-AES128-SHA
ssl_options.ciphers.34 = DHE-DSS-AES128-CBC-SHA
ssl_options.ciphers.35 = ECDH-ECDSA-AES128-CBC-SHA
ssl_options.ciphers.36 = ECDH-RSA-AES128-CBC-SHA

ssl_options.honor_cipher_order = true
ssl_options.honor_ecc_order    = true

management.listener.ssl  = false

vm_memory_high_watermark.relative = 0.6
cluster_partition_handling = pause_minority


hipe_compile = false

management.listener.port = 15672


We installed rabbitMQ using docker image rabbitmq:3.7.15:

FROM rabbitmq:3.7.15

RUN rabbitmq-plugins enable --offline \
rabbitmq_management \
rabbitmq_consistent_hash_exchange \
rabbitmq_shovel_management \
rabbitmq_shovel

and we run it by executing parent's entrypoint script:
exec /usr/local/bin/docker-entrypoint.sh $@


Tested with a simpler configuration, but still getting the same error. Also, the initial list of ciphers was generated using your documentation.

Darijan

unread,
Aug 1, 2019, 5:52:19 AM8/1/19
to rabbitmq-users
Thanks Michael, tried that, unfortunately not much success.

Dne sreda, 31. julij 2019 20.38.49 UTC+1 je oseba Michael Klishin napisala:

Luke Bakken

unread,
Aug 1, 2019, 10:50:41 AM8/1/19
to rabbitmq-users
Hello,

Depending on how you generated your certificates, you may be running into this issue: https://github.com/rabbitmq/rabbitmq-server/issues/2060#issuecomment-516359030

When we try to connect with an invalid cipher, like ECDSA against an RSA certificate, this is what we get on the server side, along with the handshake failing:

Please run the openssl commands that are shown in https://www.rabbitmq.com/troubleshooting-ssl.html and provide a transcript of the command and the output. Save the output in a file and attach it to your response.

It would be very helpful to see what the openssl s_server and s_client commands show when using your certificates. Saying "tried that, unfortunately not much success" doesn't tell us anything. Since we don't have access to your certificates, you must show us everything you try and the output.

I suggest using this project to generate some self-signed certificates for you to test with:

https://github.com/michaelklishin/tls-gen

Please attach the simpler configuration you tested with in a future response. Also, it may be helpful to test without using Docker, to eliminate another potential cause of the issue.

Thanks,
Luke

Abhishek Biswas

unread,
Oct 19, 2023, 9:12:47 AM10/19/23
to rabbitmq-users
Hello everyone,
I am stuck with  this issue while developing my client to use Mqtt Protocol in C# .Net 4.5 OS-Windows8.
RMQ Version 3.12.6 Erlang 26.0.2 , Using M2Mqtt Library .
I have created selfsigned certificates that I used to connect the broker . 
Surprisingly, while I connect with Mqtt.fx it is fine with the certificates and gets connected but not with my client.

Exceptions in my client : 
1> A call to SSPI failed (Inner Exception) 2> The Client and Server cannot communicate : they do not possess the same algorithm.
I am going after these two but failed .

Next I find "tls server: in state hello at tls_handshake.erl:354 generated server alert" in rabbitmq.log and have come to this thread .

 I have allowed both TLS1.3 , TLS 1.2 in ssl.option.versions in Rabbitmq.conf but not able to connect. 
openssl s_client with my keys has been attached.

Can you please help.
test_sclient.txt

Luke Bakken

unread,
Oct 19, 2023, 10:33:23 AM10/19/23
to rabbitmq-users
Please start a new discussion instead of replying to one that is 4 years old.

If you would like me to investigate this issue, you must provide a git repository (via GitHub or GitLab) that I can clone. The repository MUST contain the following or I will not spend time investigating:
  • The self-signed certificates you are using (public and private keys), including the CA certificate.
  • Your complete RabbitMQ configuration files
  • An application that I can compile and run to see the issue.
Right now you are asking me to spend a considerable amount of time setting up an environment and guessing how to reproduce your issue.

Abhishek Biswas

unread,
Oct 21, 2023, 2:31:07 AM10/21/23
to rabbitm...@googlegroups.com
Thanks , I can understand that. Give me sometime and I will let you know.  does the openssl s_client output meant anything  

--
You received this message because you are subscribed to a topic in the Google Groups "rabbitmq-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/rabbitmq-users/3TQFT8jX-bk/unsubscribe.
To unsubscribe from this group and all its topics, send an email to rabbitmq-user...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/rabbitmq-users/c9bd0da3-b2a9-4e09-9faa-1f87c7cbd0c2n%40googlegroups.com.


--
Abhishek

Luke Bakken

unread,
Oct 21, 2023, 11:43:02 AM10/21/23
to rabbitmq-users
I don't see any "openssl s_client" output.

Please start a new discussion with the information I requested.

Reply all
Reply to author
Forward
0 new messages