C:\OpenSSL-Win64\bin>openssl req -x509 -config openssl.cfg -newkey rsa:2048 -days 365 -out ca_certificate_bundle.pem -outform PEM -subj /CN=MyTestCA/ -nodes
Generating a 2048 bit RSA private key
..................................................+++
...................................................................................................+++
writing new private key to 'privkey.pem'
-----
C:\OpenSSL-Win64\bin>openssl req -newkey rsa:2048 -nodes -keyout private_key.pem -x509 -days 365 -out certificate.pem
Generating a 2048 bit RSA private key
........................................................................................................................................................................................................+++
...+++
writing new private key to 'private_key.pem'
-----
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [AU]:
State or Province Name (full name) [Some-State]:
Locality Name (eg, city) []:
Organization Name (eg, company) [Internet Widgits Pty Ltd]:
Organizational Unit Name (eg, section) []:
Common Name (e.g. server FQDN or YOUR name) []: MyTestCA
Email Address []:
The generated files are placed in the C:\Users\jim\AppData\Roaming\RabbitMQ
I have configured the Rabbitmq-config file as below:
{ssl_options, [{cacertfile, "ca_certificate_bundle"},
{certfile, "certificate.pem"},
{keyfile, "private_key.pem"},
{versions, ['tlsv1.2', 'tlsv1.1', tlsv1]},
{depth, 10},
{verify, verify_peer},
{fail_if_no_peer_cert, false}]},
{ciphers, [{ecdhe_ecdsa,aes_128_cbc,sha256},
{ecdhe_ecdsa,aes_256_cbc,sha}]},
I need to configure my client code now to have a secure channel with the server, So i have used the below API in my client code:
channelPtr = AmqpClient::Channel::CreateSecure(
"C:\\Users\\jim\\AppData\\Roaming\\RabbitMQ\\ca_certificate_bundle",
"127.0.0.1",
"C:\\Users\\jim\\AppData\\Roaming\\RabbitMQ\\private_key.pem,
"C:\\Users\\jim\\AppData\\Roaming\\RabbitMQ\\certificate.pem",
5671,
"",
"",
"/",
131072,
false
);
I am getting an exception as below:
2019-04-24 18:14:05.197: host: 127.0.0.1
2019-04-24 18:14:05.202: port: 5671
2019-04-24 18:14:05.207: user:
2019-04-24 18:14:05.212: password:
2019-04-24 18:14:05.217: vHost: /
2019-04-24 18:14:05.223: [ AmqpClient::Channel::Create ]
2019-04-24 18:14:05.240: Exception: class AmqpClient::AmqpLibraryException
2019-04-24 18:14:05.242: what: Error setting client certificate for socket: SSL handshake failed
--
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/7322jFIfXxw/unsubscribe.
To unsubscribe from this group and all its topics, send an email to rabbitmq-user...@googlegroups.com.
To post to this group, send email to rabbitm...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Hello,It doesn't matter since the working directory of the Erlang VM process is different. Like I said, you must use full path names. Did you try it?Please see my other recommendation to use a less complicated configuration.Finally, troubleshooting information is available here - https://www.rabbitmq.com/troubleshooting-ssl.html
Thanks,Luke
On Thursday, April 25, 2019 at 11:49:17 PM UTC-7, Krishna Chaithanya B wrote:But the rabbit-config file is in the same directory " C:\Users\jim\AppData\Roaming\RabbitMQ" as the certificate pem files.On Wed, Apr 24, 2019 at 7:39 PM Luke Bakken <lba...@pivotal.io> wrote:Hello,The following settings must be the full path to the files:
{ssl_options, [{cacertfile, "C:/Users/jim/AppData/Roaming/RabbitMQ/ca_certificate_bundle"},
{certfile, "C:/Users/jim/AppData/Roaming/RabbitMQ/certificate.pem"},{keyfile, "C:/Users/jim/AppData/Roaming/RabbitMQ/private_key.pem"},Also, start with a simpler configuration and do NOT specify TLS versions or ciphers until you get the basic configuration working.
--
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/7322jFIfXxw/unsubscribe.
To unsubscribe from this group and all its topics, send an email to rabbitmq-user...@googlegroups.com.
To post to this group, send email to rabbitm...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
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/7322jFIfXxw/unsubscribe.
To unsubscribe from this group and all its topics, send an email to rabbitmq-user...@googlegroups.com.
To post to this group, send email to rabbitm...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Hi Luke,
{listeners,
[{clustering,25672,"::"},
{'amqp/ssl',5671,"::"},
{'amqp/ssl',5671,"0.0.0.0"},
{https,15671,"::"},
{https,15671,"0.0.0.0"}]},
--
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/7322jFIfXxw/unsubscribe.
To unsubscribe from this group and all its topics, send an email to rabbitmq-user...@googlegroups.com.
To post to this group, send email to rabbitm...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
To unsubscribe from this group and all its topics, 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.
To unsubscribe from this group and all its topics, send an email to rabbitmq-user...@googlegroups.com.
To post to this group, send email to rabbitm...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--Regards,
Krishna Chaithanya B
--
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/7322jFIfXxw/unsubscribe.
To unsubscribe from this group and all its topics, send an email to rabbitmq-user...@googlegroups.com.
To post to this group, send email to rabbitm...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Hi Luke,
This is my rabbitmq.conf file, and with these configuration am able to open the RabbitMQ management console with out any issue.
rabbitmq.conf.txt
And verified the Troubleshooting steps mentioned in this link, with OpenSSL the certificates are working as expected. What am I missing here, how to debug further and find the reason for this failure.
This is how am calling the API in my application:
try
{
AmqpClient::Channel::CreateSecure(
"C:\\Users\\jim\\AppData\\Roaming\\RabbitMQ\\cacert.pem",
"127.0.0.1",
"C:\\Users\\jim\\AppData\\Roaming\\RabbitMQ\\key.pem",
"C:\\Users\\jim\\AppData\\Roaming\\RabbitMQ\\servercert.pem",
"5671",
"guest",
"guest",
"/",
131072,
false
);
}
catch (AmqpClient::AmqpException const& exception)
{
file << "Exception: " << typeid(exception).name() << std::endl;
file << "\t" << "what: " << exception.what() << std::endl;
file << "\t" << "is_soft_error: " << exception.is_soft_error() << std::endl;
file << "\t" << "reply_code: " << exception.reply_code() << std::endl;
file << "\t" << "class_id: " << exception.class_id() << std::endl;
file << "\t" << "method_id: " << exception.method_id() << std::endl;
file << "\t" << "reply_text: " << exception.reply_text() << std::endl;
}
catch (std::exception const& exception)
{
file << "Exception: " << typeid(exception).name() << std::endl;
file << "\t" << "what: " << exception.what() << std::endl;
}
catch (...)
{
}
2019-05-03 17:38:25.467: host: 127.0.0.1
2019-05-03 17:38:25.473: port: 5671
2019-05-03 17:38:25.478: user: guest
2019-05-03 17:38:25.484: password: guest
2019-05-03 17:38:25.488: vHost: /
2019-05-03 17:38:25.494: [ AmqpClient::Channel::CreateSecure ]
2019-05-03 17:38:25.512: Exception: class AmqpClient::AmqpLibraryException
2019-05-03 17:38:25.513: what: Error setting client certificate for socket: SSL handshake failed
--
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/7322jFIfXxw/unsubscribe.
To unsubscribe from this group and all its topics, send an email to rabbitmq-user...@googlegroups.com.
To post to this group, send email to rabbitm...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
5. Attempt TLS Connection to Broker c:\OpenSSL-Win64\bin>openssl s_client -connect 127.0.0.1:5671 -cert C:\Users\jim\AppData\Roaming\RabbitMQ\servercert.pem -key C:\Users\jim\AppData\Roaming\RabbitMQ\key.pem -CAfile C:\Users\jim\AppData\Roaming\RabbitMQ\cacert.pem CONNECTED(00000174) depth=0 CN = ISPACSRootCA verify return:1 18600:error:14094412:SSL routines:ssl3_read_bytes:sslv3 alert bad certificate:ssl\record\rec_layer_s3.c:1407:SSL alert number 42 --- Certificate chain 0 s:/CN=ISPACSRootCA i:/CN=ISPACSRootCA --- Server certificate
Hi Luke,
--
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/7322jFIfXxw/unsubscribe.
To unsubscribe from this group and all its topics, send an email to rabbitmq-user...@googlegroups.com.
To post to this group, send email to rabbitm...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
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/7322jFIfXxw/unsubscribe.
To unsubscribe from this group and all its topics, send an email to rabbitmq-user...@googlegroups.com.
To post to this group, send email to rabbitm...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
AmqpClient::Channel::CreateSecure(
"C:\\Users\\jim\\AppData\\Roaming\\RabbitMQ\\cacert.pem",
"127.0.0.1",
"C:\\Users\\jim\\AppData\\Roaming\\RabbitMQ\\key.pem",
"C:\\Users\\jim\\AppData\\Roaming\\RabbitMQ\\servercert.pem",
"5671",
"guest",
"guest",
"/",
131072,
false
);
--
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/7322jFIfXxw/unsubscribe.
To unsubscribe from this group and all its topics, send an email to rabbitmq-user...@googlegroups.com.
To post to this group, send email to rabbitm...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Hi Luke,
--
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/7322jFIfXxw/unsubscribe.
To unsubscribe from this group and all its topics, send an email to rabbitmq-user...@googlegroups.com.
To post to this group, send email to rabbitm...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
## To force x509 certificate-based authentication on all clients, ## exclude all other mechanisms (note: this will disable password-based ## authentication even for the management UI!): ## auth_mechanisms.1 = EXTERNAL ssl_cert_login_from = common_name
To unsubscribe from this group and all its topics, 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.
To unsubscribe from this group and all its topics, send an email to rabbitmq-user...@googlegroups.com.
To post to this group, send email to rabbitm...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--Regards,
Krishna Chaithanya B
--
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/7322jFIfXxw/unsubscribe.
To unsubscribe from this group and all its topics, send an email to rabbitmq-user...@googlegroups.com.
To post to this group, send email to rabbitm...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
The reason I wanted to go with the TLS enabled / certificate based authentication was to secure the traffic between the server and client.
Q1: Did I achieve the requirement of securing the data traffic between the server and client.
Q2; Do I need to generate the client and server certificate separately ?
Q3: Since SimpleAmqpClient does not support EXTERNAL auth, that means I need to still use username/password based auth ?
Q2; Do I need to generate the client and server certificate separately ?
That's up to you at this point. Right now, you have RabbitMQ configured to require a valid client certificate when the TLS connection is established but not then use the certificate for authentication. All connections must present a certificate that is signed by the Root CA you are using, but the contents of the certificate (common name) are not used for authentication. That's why you still have to provide a username and password.
--
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/7322jFIfXxw/unsubscribe.
To unsubscribe from this group and all its topics, send an email to rabbitmq-user...@googlegroups.com.
To post to this group, send email to rabbitm...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
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/7322jFIfXxw/unsubscribe.
To unsubscribe from this group and all its topics, send an email to rabbitmq-user...@googlegroups.com.
To post to this group, send email to rabbitm...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
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-user...@googlegroups.com.
To unsubscribe from this group and all its topics, send an email to rabbitmq-user...@googlegroups.com.
To post to this group, send email to rabbitm...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--Regards,
Krishna Chaithanya B
--
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/7322jFIfXxw/unsubscribe.
To unsubscribe from this group and all its topics, send an email to rabbitmq-user...@googlegroups.com.
To post to this group, send email to rabbitm...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.