-
Notifications
You must be signed in to change notification settings - Fork 116
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Websocket Secure support #18
Comments
Hello! wss is indeed on the roadmap. Frankly I won't start implementing this feature before ~June (Maybe someone likes to help?). It should not be too difficult employing luasec for sync/copas. The ev backends may be a bit trickier, since luasec does not seem to work non-blocking. |
Hi @lipp, Thx |
@rohitjoshi For client or server? Which backend? |
@lipp I need support for server side. |
@rohitjoshi which backend (copas/lua-ev)? I am happy about every (happy) user, but out of curiosity: what's wrong / inconvenient with tornado / python? |
@lipp thx. for quick reply. I used Lau-ev based lua-websockets server. Is there any advantage using one over other?
|
@rohitjoshi Thanks, very interesting. Good choice :) I prefer the lua-ev backend, too. It is far more powerful if you want to do more elaborated IO stuff (timer, file, other sockets) etc. |
@lipp thanks. It is not immediate product release so will use ws:// now. |
@rohitjoshi nice, so no pressure for me :) BTW: good news: I just made some experiments using luasec non block (which is the crucial part) and it looks good: https://gist.github.com/lipp/5635191 |
Hi lipp, Any update on this? I looked into integrating/expanding your experiments above but am certain to break things more than fix them. My use case is client and I'll update my code to fit any of the backends (including synchronous). -Mitch |
@mlschuh Hello Mitch, I am very sorry, but secure websockets is still very low on prio. I will definitely not make it before end of this year. |
as it turns out, luasec does not allow for it yet: lunarmodules/luasec#7 |
@lipp, No worries, I understand priorities as well as libraries not having the functionality you need. I'll look into other solutions, thanks! -Mitch |
Hi @lipp I guess luasec ready by lunarmodules/luasec@84cb83b Do you plan to add secure support for now? If you are or not, thank you to create such an awesome package. |
@ckilimci thx! just out of curiosity: what application / environment are you targeting with lua + websockets? for wss servers consider this: for wss clients lua+websockets can make perfect sense. |
You are right @lipp I wanted to use lua+websocket for wss client in embedded. |
Hello @lipp |
Hi @lipp, It seems luasec's ssl module can wrap tcp connections. I tried to add it to client_ev.lua. I think somethig like this should go somewhere after if protocol == 'wss' then
sock:timeout(1) -- it timed out for me without this
sock = ssl.wrap(sock,{ mode = 'client', protocol = 'sslv23' }) -- tlsv1 segfaulted when i tried it with a plain tcp socket; may need more params, e.g. cafile = '/etc/...', verify = 'peer', options = 'all'
sock:dohandshake() -- i don't know if it's needed for the ssl wrapper
sock:timeout(0) -- turn async back on
end It runs past this code fine, but it doesn't seem to work; I end up with a
I started using lua only like a week ago, so I'm quite clueless as for what I'm missing... |
@dakhota i highly appreciate your efforts! the error shown in the stacktrace definitely says: wanted to call "sock:shutdown()" but this function was not there. calling shutdown could be caused by something went wrong during previous operations or client:close() was called. anyhow: i once started myself to do this but never finished.... some stuff was working though... maybe you want to have a look: https://github.com/lipp/lua-websockets/tree/secure-wss |
You are right, the object that ssl.wrap returns implements only a subset of the tcp.socket interface. I tried to add a wrapper around it, one that calls the ssl method when it exists but falls back to the original socket's method when it doesn't, but it didn't work (ssl.wrap sets the socket's fd to -1, so I had to set it back to whatever it originally was.) |
I was looking to implement a COPAS websocket client for the Slack RTM API, which uses secure websockets ( Disappointed to find this isn't supported. |
@lipp Disappointed to find this still isn't supported 3 years later |
@NovusTheory @Treeston sorry for disappointing you. PRs welcome! |
I write backend for lua-WebSocket based on my libuv binding (both sync and async). And it support wss wss client async example wss client sync example. |
merged @NovusTheory PR with SSL support for sync clients. Thanks! |
Hi lipp,
In client*.lua I see the following code snippet:
if protocol ~= 'ws' then
error('Protocol not supported:'..protocol)
end
There is no support for wss:// ? Is secure connection support on the roadmap? A non-secured websocket connection will run into proxy problems.
Nathan.
The text was updated successfully, but these errors were encountered: