Hi,
anybody had any success creating an SSL server listener in LUA ?
There seems to be an issue with the server socket not being able to receive() from the client. Sending from server to client however, works just fine.
Note that I tried using it in a copas handler first, and then as a simple standalone luasec handler (running on my machine, not in LM)
Simple test code looks like this:
anybody had any success creating an SSL server listener in LUA ?
There seems to be an issue with the server socket not being able to receive() from the client. Sending from server to client however, works just fine.
Note that I tried using it in a copas handler first, and then as a simple standalone luasec handler (running on my machine, not in LM)
Simple test code looks like this:
Code:
local socket = require("socket")
local ssl = require("ssl")
local params = {
mode = "server",
protocol = "tlsv1_2",
key = "C:\\ .... \\serverkey.pem",
certificate = "C:\\ .... \\server.pem",
cafile = "C:\\ .... \\root.pem",
verify = {"peer", "fail_if_no_peer_cert"},
options = "all",
}
local server = socket.tcp()
local ctx = assert(ssl.newcontext(params))
server:setoption('reuseaddr', true)
assert( server:bind("10.20.2.92", 2000) )
server:listen()
local peer = server:accept()
peer = assert( ssl.wrap(peer, ctx) )
peer:dohandshake()
data = peer:receive() -- <--- HANGS !
print("receieved: " .. data)
peer:send("Pong!\n")
peer:close()