I am running rabbitmq:3-management with ssl enabled. Without SSL things work fine.
Version
Java 1.8
spring-cloud-starter-bus-amqp => 1.3.1.RELEASE
Spring boot parent => 1.5.9.RELEASEMy client is not able to finish ssl handshake. Looks like server is failing to change the cipher spec. Below are java logs.
update handshake state: change_cipher_spec
upcoming handshake states: client finished[20]
upcoming handshake states: server change_cipher_spec[-1]
upcoming handshake states: server finished[20]
springCloudBus.anonymous.aZM2olJcQ2GjJmGdOiE1mA-2, WRITE: TLSv1.1 Change Cipher Spec, length = 1
[Raw write]: length = 6
0000: 14 03 02 00 01 01 ......
*** Finished
verify_data: { 190, 239, 197, 246, 182, 0, 21, 204, 12, 16, 169, 239 }
***
update handshake state: finished[20]
upcoming handshake states: server change_cipher_spec[-1]
upcoming handshake states: server finished[20]
springCloudBus.anonymous.aZM2olJcQ2GjJmGdOiE1mA-2, WRITE: TLSv1.1 Handshake, length = 32
Padded plaintext before ENCRYPTION: len = 64
0000: 3D 2C 53 62 10 27 46 71 C1 A7 A1 5A D3 08 DC EC =,Sb.'Fq...Z....
0010: 14 00 00 0C BE EF C5 F6 B6 00 15 CC 0C 10 A9 EF ................
0020: 30 4C 37 F8 98 A6 17 0E A9 D3 45 2F C8 F6 66 3E 0L7.......E/..f>
0030: A3 9D 5C 25 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B ..\%............
[Raw write]: length = 69
0000: 16 03 02 00 40 42 30 D1 B4 DF 8E 22 CE 8D 72 E4 ....@B0...."..r.
0010: 24 9B 31 22 3E 6C 43 FA 63 9A 19 7E D4 7C 13 BE $.1">lC.c.......
0020: 11 12 43 B2 20 ED EC 71 D9 BA 11 79 34 C3 A9 C9 ..C. ..q...y4...
0030: 0A AE 45 26 1D 00 2B 94 04 33 95 3B CD EB 11 FD ..E&..+..3.;....
0040: EC C1 57 84 D0 ..W..
[Raw read]: length = 5
0000: 15 03 02 00 02 .....
[Raw read]: length = 2
0000: 02 28 .(
springCloudBus.anonymous.aZM2olJcQ2GjJmGdOiE1mA-2, READ: TLSv1.1 Alert, length = 2
springCloudBus.anonymous.aZM2olJcQ2GjJmGdOiE1mA-2, RECV TLSv1.1 ALERT: fatal, handshake_failure
%% Invalidated: [Session-7, TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA]I visited the server which is running in docker container. Used command: docker logs -f <containerID>. Enabled debug logs through dockerbuild.
2018-04-19 18:47:37.176 [debug] <0.685.0> Supervisor {<0.685.0>,rabbit_connection_sup} started rabbit_connection_helper_sup:start_link() at pid <0.686.0>
2018-04-19 18:47:37.176 [debug] <0.685.0> Supervisor {<0.685.0>,rabbit_connection_sup} started rabbit_reader:start_link(<0.686.0>, {acceptor,{0,0,0,0,0,0,0,0},5671}, {sslsocket,{gen_tcp,#Port<0.28884>,tls_connection,<0.465.0>},<0.684.0>}) at pid <0.687.0>
2018-04-19 18:47:37.530 [info] <0.684.0> TLS server: In state certify at ssl_connection.erl:647 generated SERVER ALERT: Fatal - Handshake Failure
2018-04-19 18:47:42.630 [debug] <0.689.0> Supervisor {<0.689.0>,rabbit_connection_sup} started rabbit_connection_helper_sup:start_link() at pid <0.690.0>
2018-04-19 18:47:42.631 [debug] <0.689.0> Supervisor {<0.689.0>,rabbit_connection_sup} started rabbit_reader:start_link(<0.690.0>, {acceptor,{0,0,0,0,0,0,0,0},5671}, {sslsocket,{gen_tcp,#Port<0.28893>,tls_connection,<0.465.0>},<0.688.0>}) at pid <0.691.0>
2018-04-19 18:47:42.989 [info] <0.688.0> TLS server: In state certify at ssl_connection.erl:647 generated SERVER ALERT: Fatal - Handshake Failure
2018-04-19 18:47:48.195 [debug] <0.693.0> Supervisor {<0.693.0>,rabbit_connection_sup} started rabbit_connection_helper_sup:start_link() at pid <0.694.0>
2018-04-19 18:47:48.196 [debug] <0.693.0> Supervisor {<0.693.0>,rabbit_connection_sup} started rabbit_reader:start_link(<0.694.0>, {acceptor,{0,0,0,0,0,0,0,0},5671}, {sslsocket,{gen_tcp,#Port<0.28902>,tls_connection,<0.465.0>},<0.692.0>}) at pid <0.695.0>
2018-04-19 18:47:48.546 [info] <0.692.0> TLS server: In state certify at ssl_connection.erl:647 generated SERVER ALERT: Fatal - Handshake Failure
2018-04-19 18:47:53.659 [debug] <0.697.0> Supervisor {<0.697.0>,rabbit_connection_sup} started rabbit_connection_helper_sup:start_link() at pid <0.698.0>
2018-04-19 18:47:53.659 [debug] <0.697.0> Supervisor {<0.697.0>,rabbit_connection_sup} started rabbit_reader:start_link(<0.698.0>, {acceptor,{0,0,0,0,0,0,0,0},5671}, {sslsocket,{gen_tcp,#Port<0.28912>,tls_connection,<0.465.0>},<0.696.0>}) at pid <0.699.0>
2018-04-19 18:47:54.015 [info] <0.696.0> TLS server: In state certify at ssl_connection.erl:647 generated SERVER ALERT: Fatal - Handshake Failure
spring:
rabbitmq:
host: my.rabbitmq.com
port: 5671
username: guest
password: guest
ssl:
enabled: true
key-store: keystore.pfx
key-store-password: keystorepassword
trust-store: trust.jks
trust-store-password: truststorepassword
cloud:
bus:
enabled: true
=INFO REPORT==== 19-Apr-2018::20:53:23 ===
Starting RabbitMQ 3.6.15 on Erlang 19.2.1
=ERROR REPORT==== 19-Apr-2018::20:53:39 ===
SSL: certify: ssl_handshake.erl:1623:Fatal error: handshake failure - {bad_cert,invalid_ext_key_usage}
[7]: ObjectId: 2.5.29.15 Criticality=false
KeyUsage [
DigitalSignature
Key_Encipherment
]
[8]: ObjectId: 2.5.29.15 Criticality=true
KeyUsage [
Key_CertSign
Crl_Sign
]
Are these wrong ?
springCloudBus.anonymous.SXulBI9JQfKH4oTgrdpgqg-1, READ: TLSv1 Handshake, length = 48
Padded plaintext after DECRYPTION: len = 48
0000: 14 00 00 0C 43 B9 F9 34 93 AF 6E 55 C1 BE 33 E0 ....C..4..nU..3.
0010: CD CF F7 31 D0 3A FF AE 70 2E 39 2B BB E5 B5 30 ...1.:..p.9+...0
0020: 2B 68 96 2B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B +h.+............
check handshake state: finished[20]
update handshake state: finished[20]
*** Finished
verify_data: { 67, 185, 249, 52, 147, 175, 110, 85, 193, 190, 51, 224 }
***
--
You received this message because you are subscribed to the Google Groups "rabbitmq-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rabbitmq-users+unsubscribe@googlegroups.com.
To post to this group, send email to rabbitmq-users@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
This is the image obtained from google chrome>developer console->security->view certificate. I visited the rabbitmq default port 15671 of same container with same certs I am testing. Are the Key Usage and Ext Key Usage values not correct ? Port 15671 I know is only one way but still it has to do the work of validating the cert. doesn't it ? I am facing {bad_cert,invalid_ext_key_usage}. Does it mean invalid Key Usage or invalid Ext Key Usage or they are used based on each other so we consider Key Usage invalid ?
ssl_options.fail_if_no_peer_cert = true
I would be interested in the output of this command:
openssl x509 -noout -text -in client_certificate.pem
The client certificate will be available in the Java trust store you are using. In my test environment, the above command outputs these lines as part of the total output:
X509v3 extensions: X509v3 Basic Constraints: CA:FALSE X509v3 Key Usage: Digital Signature, Key Encipherment X509v3 Extended Key Usage: TLS Web Client Authentication
Thanks,
Luke
...
[Message clipped]
--
You received this message because you are subscribed to the Google Groups "rabbitmq-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rabbitmq-users+unsubscribe@googlegroups.com.
To post to this group, send email to rabbitmq-users@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.