+rabbitmq-users, please CC the list.
On 12 April 2016 at 19:11:57, Hw Siew (
qrw...@gmail.com) wrote:
> > I tried two mqtt clients, Mqtt.fx (
http://mqttfx.jfx4ee.org/)
> and Esp8266 pubsubclient (
https://github.com/knolleary/pubsubclient).
>
> For, Mqtt.fx. I tried two methods. First, simply connect to my
> rabbitmq server with build in CA verification in client. Second,
> i upload my CA cert to allow Mqtt.fx for verification. But both
> shows the same result, eg. =ERROR REPORT==== 12-Apr-2016::14:54:40
> ===SSL: certify:ssl_alert.erl:92:Fatal error: certificate
> unknown.
>
> For the second client which run on a hardware module. It was successfully
> connected to my server. However, the library i used to connect
> mqtt seems to be ignoring the verification process for ssl/tls,
> because i checked the fingerprint against the ssl cert. It doesn't
> match. if proper verification, the connection will be rejected.
Where do you "upload" the certificate?
Explaining how PKI is out of scope for this list and there have been numerous
discussions about this in the past.
For TLS verification (authentication) to succeed, both client and server need to trust
the certificate chain provided by the peer. In other words, RabbitMQ needs to trust
the CA that signed a client's certificate, and client needs to trust the CA that signed
RabbitMQ server certificate.
How exactly you specify trusted certificates varies from TLS implementation to implementation.
There is a set of system-wide CA certificates that are trusted ("root CAs") and everything
they sign is trusted by proxy )provided that verification depth used is at least as long as
the number of certificates in the chain). You can also provide a set of certificates to be
treated as trusted in most TLS libraries.
One client you use is Java-based and built on Paho. Java uses its own format for certificate stores,
as briefly described in
http://www.rabbitmq.com/ssl.html (which does not cover MQTT specifically
but it doesn't matter).
Paho Java is actually what our MQTT plugin
test suite uses:
https://github.com/rabbitmq/rabbitmq-mqtt/blob/master/test/src/com/rabbitmq/mqtt/test/tls/MqttSSLTest.java
So take a look and get it to work with Paho Java first (and please post code examples with your questions).
You can also generate some (self-signed) certificates with tls-gen and give it a try to compare:
http://github.com/michaelklishin/tls-gen.
Lastly, make sure you use Erlang 17.5 or 18.x, earlier versions had certain limitations related to TLS
which sometimes to result in otherwise correct certificates to be rejected.
> I also tried the method suggested on the website "tls/ssl troubleshooting".
> Run the command as follow.
>
> openssl s_client -connect localhost:5671 -cert /ssl/fullchain.pem
> -key /ssl/privkey.pem -CAfile /ssl/cacert.pem
>
> Server log an error report :
>
> =ERROR REPORT==== 12-Apr-2016::16:04:49 ===
> closing AMQP connection <0.7990.0> (127.0.0.1:51821(
http://127.0.0.1:51821)
> -> 127.0.0.1:5673(http://127.0.0.1:5673)):
> {handshake_timeout,handshake}
The error message says that client was connected to port 5673, not 5671, so
I'll assume that port 5673 uses TLS.
Whenever you see a handshake timeout when connecting to a TLS port on localhost,
it almost always means that the client *wasn't* configured to use TLS and so it never
performs the TLS upgrade the server expects, and the server logs a handshake timeout message.