05.07.2021, 08:31
HTTPS certificate verification is disabled by default. You can try sending a request using raw sockets to check where the remote host closes the connection:
Code:
IP = '192.168.1.9'
data = '{"username":"customer","password":"MYPASS","email":"MY@EMAIL.COM","force_sm_off":false}'
socket = require('socket')
ssl = require('ssl')
params = {
mode = 'client',
protocol = 'tlsv1_2',
verify = 'none',
}
client = socket.tcp()
client:settimeout(1)
res, err = client:connect(IP, 443)
log('connect', res, err)
ctx = ssl.newcontext(params)
client = ssl.wrap(client, ctx)
client:settimeout(1)
res, err = client:dohandshake()
log('dohandshake', res, err)
res, err = client:send(
'POST /api/login/Basic HTTP/1.1' .. '\r\n' ..
'Host: ' .. IP .. '\r\n' ..
'User-Agent: curl/7.64.1' .. '\r\n' ..
'Accept: */*' .. '\r\n' ..
'Connection: close' .. '\r\n' ..
'Content-Type: application/json' .. '\r\n' ..
'Content-Length: ' .. #data .. '\r\n\r\n' ..
data)
log('send', res, err)
res, err, partial = client:receive('*a')
log('receive', res, err, partial)
client:close()