This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

TCP over SSL
#1
Question 
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:


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()
Reply


Messages In This Thread
TCP over SSL - by oyvindi - 31.10.2016, 15:56
RE: TCP over SSL - by admin - 01.11.2016, 09:30
RE: TCP over SSL - by oyvindi - 01.11.2016, 09:44
RE: TCP over SSL - by rocfusion - 16.10.2017, 07:47
RE: TCP over SSL - by admin - 16.10.2017, 11:52
RE: TCP over SSL - by rocfusion - 18.10.2017, 04:43
RE: TCP over SSL - by rocfusion - 19.10.2017, 09:03
RE: TCP over SSL - by admin - 19.10.2017, 09:19

Forum Jump: