this post was submitted on 18 Oct 2023
1 points (100.0% liked)

Self-Hosted Main

502 readers
1 users here now

A place to share alternatives to popular online services that can be self-hosted without giving up privacy or locking you into a service you don't control.

For Example

We welcome posts that include suggestions for good self-hosted alternatives to popular online services, how they are better, or how they give back control of your data. Also include hints and tips for less technical readers.

Useful Lists

founded 1 year ago
MODERATORS
 

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!

you are viewing a single comment's thread
view the rest of the comments
[–] Defiant-Ad-5513@alien.top 1 points 11 months ago (4 children)

So attempt to run every container with the least privilege:

  • seperate networks for each stack
  • only map needed folders
  • run the container as a non root user (some containers won't work so they need to be run as root user)
  • use a RP with authentication (if a app is valuable)
  • make differential backups to shrink size and increase the interval (and check if they work)
  • block internet access to containers that don't need them
[–] WiseCookie69@alien.top 1 points 11 months ago (3 children)

run the container as a non root user (some containers won't work so they need to be run as root user)

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.

[–] Kompost88@alien.top 1 points 11 months ago (1 children)

That's the way Proxmox issues privileges to containers by default. I don't know how bulletproof it is, seems very reasonable.

[–] WiseCookie69@alien.top 1 points 11 months ago

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/

load more comments (1 replies)
load more comments (1 replies)