Firewall, routes and Docker networking leak analysis #2370
-
Original postMaybe this is just me being paranoid, but...the discussion #868 mentions that at the time of the post the firewall goes online within 15ms of starting the Gluetun container. So if the network stack starts before the firewall - To be clear, I don´t know if this is the case - there theoretically should be a tiny window between the start of both the network stack and the firewall where packets could potentially be leaked, as the connected containers/services could already be using Gluetun's briefly unprotected network stack. One way to prevent this could be forcing any connected containers to always start after Gluetun is finished with its firewall setup. Docker Compose's depends_on in combination with the healthcheck attributes immediately come to mind. However as this only affects the order the services/containers start with Docker Compose you would still be ¨at risk¨ should just the Gluetun container restart for whatever reason while the VPN client containers keep running. The only surefire way that I can think of right now would be to enforce additional firewall rules on the docker host to only allow Gluetun to connect to its designated VPN Servers, which pretty much defeats the ease of use Gluetun otherwise provides. Also, this may or may not break things in other ways as well. If maybe someone more qualified than me would be so kind to put my mind at ease, I would be utmost grateful. Questions from @the-hotmann
A lot of questions, but I genrally would like to understand how the "start-up" and "shut-down" proceedure works, and how it would behave in a crash/faulty state :) The malfunction 4 days ago (2024-07-27) was a good example on how things should be: the container did not come up and never entered "healthy" state, so all container depending on it could not reach out (since no VPN connection was build up) which is exactly what I liked to see. Better not working, than leaking! So I would be curious if it would work like this also in other scenariosn, or how it behaves if something went wrong while it once was booted up correctly. I, just like some friends of mine have expirienced this scenario:
I use SurfShark with WireGuard and know it is a silent protocol and that it is harder to debug so I thought this might be a security implementation or just the container not reconnecting once a connection drops. Anyway I guess this is a topic for a different discussion or at least a different thread and the last time I expirienced this was some months ago. So maybe things changed now, with the newer versions ;) |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
You are correct. I doubt other containers would spin up and start their program under 15ms as well though, especially with the You might want to also subscribe to #1697 which might resolve this, although I'm not too sure of how the implementation will look yet to be fair (it may also just be enabled after 15ms). |
Beta Was this translation helpful? Give feedback.
-
@jagaimoworks I hijacked your discussion to put merge in questions related in there!
The biggest risk would be gross incompetence from me and the firewall being misconfigured 😄 But I'm usually careful testing things out, especially checking
I'm not sure what you mean? If it's healthy, it means network traffic is working, see https://github.com/qdm12/gluetun-wiki/blob/main/faq/healthcheck.md#internal-healthcheck regarding what the healthcheck does. If it's unhealthy, it means the connection is likely not working anymore, and there could be many causes, but not a security cause 😄 |
Beta Was this translation helpful? Give feedback.
You are correct. I doubt other containers would spin up and start their program under 15ms as well though, especially with the
network_mode: "service:gluetun"
dependency. But theoretically it could happen. Now what could it leak? Pretty much not much 😄 Maybe a single DNS request, because 15ms round trip is rather small. For example UDP traffic with a server in the same LAN/room has a ping of 10ms. I also measured time taken by other code pieces before the firewall is configured, and it takes 1 to 2ms, so not really worth fiddling around and moving it below the firewall configuration part. For context, before there was a lot more processing done before and the firewall would be executed af…