EDIT: after googling i found out the error is related to CA, i changed to CA1.pem and now i get
AWS IoT Test 15.06.2020 16:37:44
* arg: 1
* number: 16
* arg: 2
* string: Client TEST sending CONNECT
but it doesnt go into the loop
OLD POST:
network config is ok. i was able to ping the host from the network utilities
with the ON_LOG i see:
AWS IoT Test 15.06.2020 16:11:39
* arg: 1
* number: 8
* arg: 2
* string: OpenSSL Error: error:14090086:lib(20):func(144):reason(134)
just for clarity, the full script:
AWS IoT Test 15.06.2020 16:37:44
* arg: 1
* number: 16
* arg: 2
* string: Client TEST sending CONNECT
but it doesnt go into the loop
OLD POST:
network config is ok. i was able to ping the host from the network utilities
with the ON_LOG i see:
AWS IoT Test 15.06.2020 16:11:39
* arg: 1
* number: 8
* arg: 2
* string: OpenSSL Error: error:14090086:lib(20):func(144):reason(134)
just for clarity, the full script:
Code:
require('socket')
require('ssl')
mqtt = require('mosquitto')
client = mqtt.new('TEST')
log('client created')
--client:tls_insecure_set(true)
cafile = '/data/ftp/AmazonRootCA3.pem'
certfile = '/data/ftp/a0b1c2e4-certificate.pem.crt'
keyfile = '/data/ftp/a0b1c2e4-private.pem.key'
--cafile = '/data/ftp/AmazonRootCA3.crt'
--certfile = '/data/ftp/a0b1c2e4-certificate.crt'
--keyfile = '/data/ftp/a0b1c2e4-private.key'
log(
io.exists(cafile),
io.exists(certfile),
io.exists(keyfile)
)
broker = 'random-ats.iot.eu-central-1.amazonaws.com'
client:tls_set(cafile, nil, certfile, keyfile)
local ok, rc = client:connect(broker,8883)
assert(ok)
log(ok)
client.ON_LOG = log
client.ON_CONNECT = function()
log('connected')
client:publish("TEST/test1", 1, 0, 0)
log('disconecting...')
client:disconnect()
end
log('loop...')
client:loop_forever()
log('end...')