Skip to content

Commit b1a45ae

Browse files
committed
First pass on LXC security page
Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
1 parent e36a6b9 commit b1a45ae

2 files changed

Lines changed: 75 additions & 0 deletions

File tree

content/STRUCTURE.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,12 @@
5151
"generator": "markdown",
5252
"meta": {"input": "lxc/contribute.md"}},
5353

54+
{"path": "/lxc/security",
55+
"title": "LXC - Security",
56+
"menu": ["LXC", "Security"],
57+
"generator": "markdown",
58+
"meta": {"input": "lxc/security.md"}},
59+
5460
{"path": "/lxc/downloads",
5561
"title": "LXC - Downloads",
5662
"menu": ["LXC", "Downloads"],

content/lxc/security.md

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
# Introduction
2+
LXC containers can be of two kinds:
3+
4+
- Privileged containers
5+
- Unprivileged containers
6+
7+
The former can be thought as old-style containers, they're not safe at all and should only be used
8+
in environments where unprivileged containers aren't available and where you would trust
9+
your container's user with root access to the host.
10+
11+
The latter has been introduced back in LXC 1.0 (February 2014) and requires a reasonably recent
12+
kernel (3.13 or higher). The upside being that we do consider those containers to be root-safe and so,
13+
as long as you keep on top of kernel security issues, those containers are safe.
14+
15+
16+
As privileged containers are considered unsafe, we typically will not consider new container escape
17+
exploits to be security issues worthy of a CVE and quick fix. We will however try to mitigate those
18+
issues so that accidental damage to the host is prevented.
19+
20+
# Privileged containers
21+
Privileged containers are defined as any container where the container uid 0 is mapped to the host's uid 0.
22+
In such containers, protection of the host and prevention of escape is entirely done through
23+
Mandatory Access Control (apparmor, selinux), seccomp filters, dropping of capabilities and namespaces.
24+
25+
Those technologies combined will typically prevent any accidental damage of the host,
26+
where damage is defined as things like reconfiguring host hardware,
27+
reconfiguring the host kernel or accessing the host filesystem.
28+
29+
LXC upstream's position is that those containers aren't and cannot be root-safe.
30+
31+
They are still valuable in an environment where you are running trusted workloads
32+
or where no untrusted task is running as root in the container.
33+
34+
We are aware of a number of exploits which will let you escape such containers and get full root privileges on the host.
35+
Some of those exploits can be trivially blocked and so we do update our different policies once made aware of them.
36+
Some others aren't blockable as they would require blocking so many core features that the average container would become completely unusable.
37+
38+
# Unprivileged containers
39+
Unprivileged containers are safe by design. The container uid 0 is mapped to an unprivileged user outside of the container
40+
and only has extra rights on resources that it owns itself.
41+
42+
With such container, the use of SELinux, AppArmor, Seccomp and capabilities isn't necessary for security.
43+
LXC will still use those to add an extra layer of security which may be handy in the event
44+
of a kernel security issue but the security model isn't enforced by them.
45+
46+
To make unprivileged containers work, LXC interacts with 3 pieces of setuid code:
47+
48+
- lxc-user-nic (setuid helper to create a veth pair and bridge it on the host)
49+
- newuidmap (from the shadow package, sets up a uid map)
50+
- newgidmap (from the shadow package, sets up a gid map)
51+
52+
Everything else is run as your own user or as a uid which your user owns.
53+
54+
As a result, most security issues (container escape, resource abuse, ...) in those containers will apply just as well
55+
to a random unprivileged user and so would be a generic kernel security bug rather than a LXC issue.
56+
57+
LXC upstream is happy to help track such security issue and get in touch with the Linux kernel community
58+
to have them resolved as quickly as possible.
59+
60+
# Reporting security issues
61+
To ensure security issues can be fixed as quickly as possible and simultaneously
62+
in all Linux distributions, issues should be reported either:
63+
64+
* By e-mail to both serge.hallyn (at) ubuntu (dot) com AND stgraber (at) ubuntu (dot) com
65+
* By opening a private security bug at [https://launchpad.net/ubuntu/+source/lxc/+filebug](https://launchpad.net/ubuntu/+source/lxc/+filebug)
66+
67+
We will then confirm the security issue, come up with fixes against all supported releases,
68+
provide you those patches for testing and then get a CVE assigned as well as a
69+
coordinated release date for you and the Linux distribution community.

0 commit comments

Comments
 (0)