Add OpenSSL support
getnamo opened this issue · 46 comments
Current libs do not have openssl compiled in. Need to check the settings to get openssl built for socket.io client cpp.
Edit: Current SSL support available in https://github.com/getnamo/socketio-client-ue4/tree/ssl branch
I believe so, but some tests to confirm would be useful.
@getnamo yes, we moved our server to https. Socket.io then stopped working. We then opened up another instance on regular http port 80 and it works fine. It seems that inside the socketio.lib file is where the issue is, yet we don't have the pdb's to debug in there further. Do you have an ETA on when you will have an ssl supported version?
Thanks for confirming!
I don't currently have an eta on SSL, but now that I know there is demand for it I'll add it to the list. That said the underlying .lib that gets compiled is also open source with its repo here: https://github.com/getnamo/socketio-client-prebuild which has the cmake script shown here: https://github.com/getnamo/socket.io-client-cpp/blob/bfa0a53a4851cbbd56d4606c6d6fbed3f81a964b/CMakeLists.txt#L51 if I remember correctly, I didn't have OPENSSL library installed in the correct location on my computer when I was building the socket.io library. based on the above script, it does appear that everything else is already ready for it. If you need it badly, consider contributing by updating the underlying .lib to include the OpenSSL libs!
Also as a side note you can get the .pdbs easily by compiling the plugin in a UE4 c++ project, which will recompile the plugin and generate the .pdbs.
I'm gonna jump in on this one - I'm at a bit of a loss, I do have openSSL installed so I think the boost libs compiled ok. (macOS). I expect and need to use ws:// or wss:// for the URL not sure where to make that change :(
@anadin See the discussion here: #72 (comment) for the latest development on integrating openssl. It appears MykonCodes was able to enable it, but it stopped non-ssl version connections from working. His implementation should give you a basis to explore good ssl support however.
Note to self: with refactor, we can likely use the built-in openssl module: https://github.com/EpicGames/UnrealEngine/tree/release/Engine/Source/ThirdParty/OpenSSL. TBC
Note to self: merge e.g. socketio/socket.io-client-cpp#137 into base
What is the current status of tls support?
Are there any news already?
Still waiting to find time to build an SSL server with a certificate to use for AB tests.
There has been some early work done, but the blocker is the certificate process. Branch for this work is found at: https://github.com/getnamo/socketio-client-ue4/tree/issue-39
If you wish to help speed up the process, let me know if you have an ssl backend I can test against.
I have to ask again do you only need a socketio server with https connection? I can provide that for you.
@dobby5 that would likely be helpful, current blocker is setting up an SSL server with socket.io server running so it can be tested against.
Okay good.
I don't like to make my server IP public. Would you like to send me an email. Then I will send you the server address.
@getnamo Do you still need a public https socketio server to test against? I can throw one together pretty quickly.
I've been swamped in the past few weeks, still trying to find some time for this issue. If there are any decent C++ programmers, they could help patch in the openssl module based on info in this issue and #72 (comment). Code contributions are always welcome.
@getnamo Is there any update regarding SSL support? This is crucial to my project and the existing workaround seems to be outdated. If not, is there an email I can reach you at or something?
It's still on the docket. I need to schedule time to specifically address this issue. No ETA atm, will ping here when I find time.
we are still waiting for wss and https
@cheburashkalev I believe this is how you support SSL (ONLY SSL, this will break non-SSL): In the files sio_client_impl.h and sio_client_impl.cpp you want to add "#define SIO_TLS 1" near the top of the file. Then add "OpenSSL" to the PublicDependencyModuleNames and PrivateDependencyModuleNames of SocketIOLib.Build.cs. There might be a few compilation issues which you'll have to solve. Good luck.
I have just moved to plain websockets. Using this plugin without tls is just careless and dangerous. I wonder how it got such a good rating. Very sad.
@The12MT I have the plugin working with tls using the steps I provided above. Just takes a bit of tinkering lol. No need to bash the merits of this project. Mostly has to do with the awkward socket.io port to c++, completely unrelated to getnamo's contributions.
I have just moved to plain websockets. Using this plugin without tls is just careless and dangerous. I wonder how it got such a good rating. Very sad.
You know what's sad? The fact that you expect an open source project to cater to your needs and are not willing to contribute anything in return. The author is taking his own personal time to work on this, you have no rights no complain about what they do or don't do.
You are free to implement this and I'm sure they would be more than happy to look at your PR.
I have just moved to plain websockets. Using this plugin without tls is just careless and dangerous. I wonder how it got such a good rating. Very sad.
You know what's sad? The fact that you expect an open source project to cater to your needs and are not willing to contribute anything in return. The author is taking his own personal time to work on this, you have no rights no complain about what they do or don't do.
You are free to implement this and I'm sure they would be more than happy to look at your PR.
Wrong. He is selling his work on the unreal marketplace stating that there will be ssl very soon ;D I have my own projects and don't care at all about this project anymore since I "have moved to websocket".
Hi everyone !
First, thanks you to @getnamo for your great work. This plugin is very useful and easy to setup.
These last days I try to make the code support SSL but I encounter several pitfalls. I added the code mentionned by @brittanft and wiped out some compalition issues but it still doesn't working.
I get always this error : "SocketIO Invalid appears to have lost connection, reconnecting attempt 0 with delay 5000".
By digging into the problem, I have noticed this error : "TLS handshake failed".
My knowledge in this field is pretty bad... Can someone help me understand what I'm doing wrong?
Finally, I managed to solve my problem!
I solved the above problem by modifying the generic TLS version in the on_tls_init
function.
I upgraded to TLS 1.2 instead of the original 1.0 version :
context_ptr ctx = context_ptr(new asio::ssl::context(asio::ssl::context::tlsv12));
Now, the plugin works perfectly! I can receive all events from a remote browser.
Thank you very much @getnamo and @brittanft!
If anyone's interested, I spent last couple of days adding OpenSSL support to this plugin (Win64 only though). Check tls
branch of this fork -- https://github.com/peetonn/socketio-client-ue4/tree/tls. Last commits shall explain you my story of getting OpenSSL to work.
@peetonn That looks great, do you know if your implementation disables non-ssl connections or do both type of connections work?
@peetonn That looks great, do you know if your implementation disables non-ssl connections or do both type of connections work?
I haven't tested it, but I suspect it disables unencrypted... I'll update if I get a chance to test.
yeah he fucked it up with the none SSL, but who cares?
this thing worth nothing none ssl. this guy rocks!!
thanks man :)
Atm i could not make OpenSSL switchable until now, but we can also use the OpenSSL integration from the UE4.
Besides the fact that it saves us some data, it should now work on Mac, IOS, Windows 32 and 64bit.
https://github.com/dobby5/socketio-client-ue4/tree/tls
Otherwise, my suggestion would be that we declare the code
https://github.com/dobby5/socketio-client-ue4/blob/3b037f2e3b5d806e2a8979dab512488bd68ad5f1/Source/SocketIOLib/SocketIOLib.Build.cs#L70
and then merge with the master branch.
So anyone who wants can enable the SSL function in the code manuel until we find another solution. It's a workaround but what do you think @getnamo?
This is great option, awesome work.
Until we get this to work via url swap (https->ssl, http->standard) without compile changes, I'll leave it in an ssl branch https://github.com/getnamo/socketio-client-ue4/tree/ssl. This way just swapping the branch in git, will let you have the SSL variant of the plugin until it matures in master.
After some further investigation, it seems like ssl-dev
had the initial work for swapping TLS/SSL and not, but the code wasn't fully integrated.
I have a working swapping branch over at https://github.com/IncantaGames/socketio-client-ue4/tree/ue5, with the majority of the changes to get ssl-dev
working in Incanta@71c08f7. Note, that branch is not mergeable into ssl-dev
as I rewrote a commit that changed a bunch of whitespace/formatting (so I can figure out what was added).
I've tested both modes with a socket.io
nodejs server (with a self signed certificate). There's work that needs to be done to figure out how to verify certificates, but I've given a checkbox to turn on/off verification.
Let me know if you'd like me to make a pull request out of this.
The criteria to get an ssl branch merged is that both http and https work. I believe ssl-dev had changes that made only https work and broke http support. If you have a working branch with both without code changes, I'd definitely be interested in merging the work.
Ok, I'll look into separating my work into an MVP branch that's mergeable into master
and create a PR
Will this branch be viable for ue5? ssl is highly important feature, would be great to have it in ue5
Will this branch be viable for ue5? ssl is highly important feature, would be great to have it in ue5
@staskjs if I actually remember to get my PR in 😅, it will support UE5 and UE4.
Thanks guys, going to check this out as soon as other plugins to update to ue5 and I can boot my project up
Will review shortly and merge if it passes my internal tests
Release with @seesemichaelj pull request available here: https://github.com/getnamo/SocketIOClient-Unreal/releases/tag/v2.1.0. Please do test and let us know if it works as intended. See https://github.com/getnamo/SocketIOClient-Unreal#httpsssl for basic API