LXC unprivileged nested=1 vs lxc.apparmor.profile unconfined what is more unsecure

kuumaur

Member
Nov 15, 2021
6
0
6
51
Hi,
I run all my LXC container unprivileged.
Now and then I have issues with systemd and/or logrotate and some more services not starting.
I resolve the issues with lxc.apparmor.profile unconfined in the LXC conf file.
But I could resolve it by setting nested=1 option in LXC conf file.

So, what is more secure?
What does expose more risk?

Thanx for an explanation.
 
Hi,
AFAIK, nesting is much more limited, in that it exposes procfs and sysfs of the host to the guest. Note that the web UI defaults to enabling nesting, because it is required for most modern containers. The backend uses lxc.apparmor.allow_nesting = 1 when the feature is enabled.
 
  • Like
Reactions: Johannes S
Thank you for the Answer.
Conclusion: "lxc.apparmor.profile unconfined" is more "unsecure" than nested=1.
 
Can apparmor be disabled completly? I did via cmdline apparmor=0 but this brakes things in Proxmox (like creating subvolumes for LXC containers)
 
Hi,
Can apparmor be disabled completly? I did via cmdline apparmor=0 but this brakes things in Proxmox (like creating subvolumes for LXC containers)
why would you want to disable it?
 
  • Like
Reactions: Johannes S
Please decouple Apparmor from Proxmox and make it opt-in.
And hurt everybody else? Surely not, it will stay opt-out.

If you got actual issues with apparmor (not just misconfiguration), please report them separately. You can already turn it off per-container or use privileged containers.
 
OK, may i ask why it's in? Just because Debian delivers it? I wish Proxmox follows/will follow to KISS princible and not bload everything with complexity.
 
Last edited:
Call me crazy, but I say yes. Away with AppArmor. Away with unnecessary security bullshit that is allready bloaded around the world. The Proxmox team must absolutely avoid increasing complexity!
 
Last edited:
Call me crazy, but I say yes. Away with AppArmor. Away with unnecessary security bullshit that is allready bloaded around the world. The Proxmox team must absolutely avoid increasing complexity!

Yes and making systems harder to secure by removing already enabled options for reaching that security would actually increase the complexity for users in a enterprise environment (which are the paying customers).
But let's take that argument a little bit farer: The firewall function and SDN adds further additional complexity, so away with it! Most of the switchers from VMWare don't run containers (since Vmware doesn't have them) so ProxmoxVE can finally get rid of it (just adds complexity right?).

If you really don't want that kind of complexity you are propably better of with a Linux VM (so you don't need to mess around with lxcs restrictions) or even bare metal Linux/BSD server (Virtualization is extra complexity too, a VM is more isolated than a container, so even more of the security you seem to hate). On the other hand: If you hate security you shouldn't run a server (in your home or elsewhere), the world is already full enough with enablers of ransomware and hacking attacks because they "don't care for security".
Thankfully not only the Proxmox team thinks different, but the lxc developers too (according to https://pve.proxmox.com/wiki/Linux_Container ):

Unprivileged Containers

Unprivileged containers use a new kernel feature called user namespaces. The root UID 0 inside the container is mapped to an unprivileged user outside the container. This means that most security issues (container escape, resource abuse, etc.) in these containers will affect a random unprivileged user, and would be a generic kernel security bug rather than an LXC issue. The LXC team thinks unprivileged containers are safe by design.
This is the default option when creating a new container.
If the container uses systemd as an init system, please be aware the systemd version running inside the container should be equal to or greater than 220.

Privileged Containers

Security in containers is achieved by using mandatory access control AppArmor restrictions, seccomp filters and Linux kernel namespaces. The LXC team considers this kind of container as unsafe, and they will not consider new container escape exploits to be security issues worthy of a CVE and quick fix. That’s why privileged containers should only be used in trusted environments.

Now configuring AppArmor profiles isn't novice friendly, but it's still a lot simpler than selinux and you don't even need to do it to run LXC containers.

So the real question (apart from how one can be so irresponsible and expect other people to enable such behaviour): What actual problem are you trying to solve which couldn't be solved in a different way? I can understand it, if people run in a problem and using the "Yolo, I just will allow everything"-Approach to get around it. I even think that it's useful to test whether it will work at all. But in the end the solution woudln't be to choose the less secure (although easiest) route but to fix the problem by giving the container/vm/application exactly the needed permissions and nothing more.
But "Yolo, Security sucks anyway and I don't care about my data or the impact on other people" shouldn't be encouraged.
 
I understand the point you're making, but as an experienced administrator, you know that security isn't a one-size-fits-all solution and often depends on the specific requirements of the environment. Proxmox provides a range of security mechanisms that make sense for many use cases, but there are certainly scenarios where an administrator may want to make a conscious decision about which security features to implement—and to what degree.

There's no single "correct" approach when it comes to security. An experienced admin is perfectly capable of determining which protection mechanisms are necessary for their environment. Whether it's configuring AppArmor, fine-tuning firewall rules, choosing between LXC and VMs, or even opting to forgo certain security features altogether—these decisions should be based on a solid understanding of the risks and requirements involved.

Basic security best practices should always be followed, of course, but that doesn’t mean every security feature needs to be enabled by default. Sometimes less is more—especially when it comes to performance or complexity. An experienced admin will deploy AppArmor and other security measures where they're truly needed and choose not to use them in other areas to avoid unnecessarily complicating system administration.

The decision on which security mechanisms make sense is always tied to the specific environment and individual needs. An experienced administrator understands the trade-offs and is fully aware of the consequences of their decisions. They know how to run systems securely even without every standard security feature enabled—provided they take responsibility for that choice.
 
sorry to say this so bluntly - but based on your responses in this thread, you seem to be far from an experienced administrator. apparmor is needed to properly secure containers, that's why it is enabled out of the box. this is not some random choice we made because we feel like it, but a fundamental part of LXC's architecture and security principles. if you know what you are doing, you can disable it, but then you are responsible/need to live with the consequences (escaping from your container just got a lot easier, defeating its main purpose).
 
Vulnerabilities/bugs/escape mechanisms keep cropping up to even the most seasoned system administrator. So simply saying, I/we will rely on the professional administrator makes no sense at all. I've yet to meet the system administrator who hasn't made a mistake. Read these forums.

The policy of - It is difficult for me to find the key to my house, the lock keeps getting jammed from time to time, so I'll just take the door down! - MAKES NO SENSE.
 
  • Like
Reactions: Johannes S
I would say I am an experienced administrator because I have to debug strange behaviors on systems every day, just because five companies decide to put different kinds of security layers over the product, which I have to figure out myself. I can imagine better ways to spend my time building systems than messing around with that security theater. Just my two cents. Let's end this discussion—it doesn't lead anywhere as i understand.
 

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!