Closed whitetiger21022014 closed 5 years ago
Hello, In function luasocket_ssl.connect(conn) if insert for dump conn.ssl_params, I can't see value for custom: cafile, certificate, key for k, v in pairs(conn.ssl_params) do print(k,v) end
When I insert manual for testing as below, it works as expected
conn.ssl_params["cafile"] = "certs/device/cacert.pem" conn.ssl_params["certificate"] = "/certs/device/clientcert.pem" conn.ssl_params["key"] = "/certs/device/clientkey.pem"
John, Thanks for error reporting, will fix it in next release.
According ssl params - you may pass it in ssl = { ... } instead of ssl = true when constructing your MQTT client instance like this:
client = mqtt.client{
debug = client_debug,
uri = "x.x.x.x:8883",
auth = {username = "mqtt_user", password = "123456" },
clean = true,
ssl ={ cafile = "/certs/device/cacert.pem",
certificate = "/certs/device/clientcert.pem",
key = "/certs/device/clientkey.pem" },
},
}
lua: /usr/lib/lua/mqtt/luasocket_ssl.lua:30: attempt to concatenate local 'err' (a nil value) stack traceback: /usr/lib/lua/mqtt/luasocket_ssl.lua:30: in function 'connect' /usr/lib/lua/mqtt/init.lua:411: in function '_open_connection' /usr/lib/lua/mqtt/init.lua:305: in function 'connect'
Fixed in version v2.0.0
Hello I test with RabbitMQ, If I use from file: examples/quick-receive.lua, No SSL, port 1883 everything is Ok, But when I use SSL port, self certs, has problem as below Please correct the 'ssl_params' syntax in below config Thank you so much
Use SSL with self certs
Error examples/quick-receive2.lua
lua: /usr/lib/lua/mqtt/luasocket_ssl.lua:30: attempt to concatenate local 'err' (a nil value) stack traceback: /usr/lib/lua/mqtt/luasocket_ssl.lua:30: in function 'connect' /usr/lib/lua/mqtt/init.lua:411: in function '_open_connection' /usr/lib/lua/mqtt/init.lua:305: in function 'connect'