3 ms·
But that’s a worse solution unless you feel the need to test the kernel’s tcp stack. You’re back to opening local ports that anyone on the box can access. You
by kortilla 5y ago
But that’s a worse solution unless you feel the need to test the kernel’s tcp stack.
You’re back to opening local ports that anyone on the box can access. You can work around that by isolating the tests into a container/namespace, but now you have more stuff to orchestrate.
Finally, the problem with binding to 0 and letting the kernel pick a port is now you have to wait for that bind event to happen to know which port to connect to from your test side. With domain sockets you can set that up in advance and know how to communicate with the process under test without needing a different API to get its bound port number.
- rwmj 5y agoIt's definitely the last point which is the main problem. We can start the server side and tell it to pick a port, but then we have to somehow communicate that port to the test / client, and often that channel of communication doesn't really exist (or it's a hack like having the server print the port number on stdout - which is what qemu does). Unix domain sockets by contrast are an infinite private space that can be prepared in advance.
- jerf 5y agoI don't have a problem running my test code on boxes with hostile people logged in to them, nor do my socket connections offer them anything they couldn't already do if they have that level of access. You sound like you may have a very particular problem, and if this is your situation I'm not convinced "Unix sockets" are the answer anyhow... you seem to have bigger problems with unauthorized access.
- kortilla 5y agoIsolation on a machine is a very basic security primitive. Binding to localhost circumvents all of that and you end up with vulnerabilities like this: http://benmmurphy.github.com/blog/2015/06/09/redis-hot-patch http://benmmurphy.github.com/blog/2015/06/09/redis-hot-patch Remember, anything you put on localhost can be reached by your browser (unless you use iptables with the pid owner check) and arbitrary webpages you are on can hit those endpoints in the background. The solution you are offering is worse both from a security and a usability standpoint.
- nerdponx 5y agoFYI- that link returns 404. "There isn't a GitHub Pages site here."