Introduce new mapping for each unprivileged container

Ketho

New Member
Jul 12, 2024
1
1
1
Hello,

I'd like to set up a collection of unprivileged containers, each with access to a different ZFS dataset. Since the default mapping between host and container UID/GID is always the same, this seems to introduce a security risk. If a container is compromised, the attacker could access all datasets on the host if the owner, for example, is always set to the root of the container (so the UID would always be 100000). How would I mitigate this risk?

Currently, I'm considering making the mapped spaces disjoint between the containers. For example, container 1 would have the following mapping:
lxc.idmap = u 0 100000 10000
lxc.idmap = g 0 100000 10000

Container 2 would have:
lxc.idmap = u 0 110000 10000
lxc.idmap = g 0 110000 10000

And so on. This way, the UIDs/GIDs in container 1 would be mapped to 100000-109999, and the UIDs in container 2 would be mapped to 110000-119999. Is this a good approach, or are there better ways to mitigate this risk?

Thanks for your help!
 
Last edited:
  • Like
Reactions: crash

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!