error:1408F10B:SSL routines:SSL3_GET_RECORD:wrong version number

Asked by swapnel

Hi,
   I am trying to use SSL with MQTT and gets following error,

1379677998: Client connection from 127.0.0.1 failed: error:1408F10B:SSL routines:SSL3_GET_RECORD:wrong version number.
1379678058: OpenSSL Error: error:140940E5:SSL routines:SSL3_READ_BYTES:ssl handshake failure
1379678058: Socket read error on client (null), disconnecting.

My conf file has seetings as below,

port 8883
cafile /home/administrator/Downloads/mosquitto-1.2.1_dilip/test/ssl/test-root-ca.crt (also tried all-ca.crt here)
certfile /home/administrator/Downloads/mosquitto-1.2.1_dilip/test/ssl/server.crt
keyfile /home/administrator/Downloads/mosquitto-1.2.1_dilip/test/ssl/server.key
tls_version tlsv1
require_certificate true (tried commenting this too)

and I run, 08-ssl-connect-cert-auth.test from test folder. code snippet included below

        mosquitto_tls_opts_set(mosq, 1, "tlsv1", NULL);
        mosquitto_tls_set(mosq, "../ssl/test-root-ca.crt", "../ssl/certs", "../ssl/client.crt", "../ssl/client.key", NULL);
        mosquitto_connect_callback_set(mosq, on_connect);
        mosquitto_disconnect_callback_set(mosq, on_disconnect);

        rc = mosquitto_connect(mosq, "localhost", 8883, 60);

Environment info:
Python 2.7.3
OpenSSL 1.0.1 14 Mar 2012
Description: Ubuntu 12.04.2 LTS
Release: 12.0
mosquitto-1.2.1/mosquitto-1.2

Please let me know what could go wrong here? I also tried generating certificates using gen.sh.
-Swapnel

Question information

Language:
English Edit question
Status:
Solved
For:
mosquitto Edit question
Assignee:
No assignee Edit question
Solved by:
swapnel
Solved:
Last query:
Last reply:
Revision history for this message
Roger Light (roger.light) said :
#1

See the answer I gave on the duplicate question here: http://stackoverflow.com/questions/18917555/mqttssl-routinesssl3-get-recordwrong-version-number/18918250#18918250

Please just ask your question in one place in the future.

Revision history for this message
swapnel (swapnel) said :
#2

Thanks Roger for your quick response. Solution given in above link worked. Sorry for duplicating this in two places, for future queries I will make sure that its asked on one place only.