There was a recent post about whether to enable ufw and it made me ask: how protected I am from a rogue docker container? I have a single server with 15-20 docker containers running at any given time. Should one get hacked or be malicious from the get go, are there (hopefully easy to implement for an armchair sysadmin) best practices to mitigate such an event? Thanks!
So attempt to run every container with the least privilege:
To avoid issues with containers, could also make use of user namespaces: https://docs.docker.com/engine/security/userns-remap/
Allows a process to have root privileges within the container, but be unprivileged on the host.
Does using this method allow mounting to folders on the host drive without permission issues?
That’s the way Proxmox issues privileges to containers by default. I don’t know how bulletproof it is, seems very reasonable.
I’d argue it’s up there :) In the end you’re quite limited with what you can do as an unprivileged user.
Granted it’s not for Docker, but Kubernetes, but userns is userns. This Kubernetes blog post even has a short demo :) https://kubernetes.io/blog/2023/09/13/userns-alpha/