Commit Graph

21 Commits

Author SHA1 Message Date
Pierre-Elliott Bécue
ec90f35b4c
[aa-profile] Deny access to /proc/acpi/**
Signed-off-by: Pierre-Elliott Bécue <becue@crans.org>
2019-08-27 16:07:13 +02:00
Wolfgang Bumiller
e6ec0a9e71 apparmor: allow various remount,bind options
RW bind mounts need to be restricted for some paths in
order to avoid MAC restriction bypasses, but read-only bind
mounts shouldn't have that problem.

Additionally, combinations of 'nosuid', 'nodev' and
'noexec' flags shouldn't be a problem either and are
required with newer systemd versions, so let's allow those
as long as they're combined with 'ro,remount,bind'.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2018-11-16 12:17:30 +01:00
Wolfgang Bumiller
6e6aca3e3e apparmor: update current profiles
remove cgmanager rules and add fstype=cgroup2 variants for
the existing fstype=cgroup rules

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2018-07-25 12:13:17 +02:00
Tycho Andersen
408dd86c76 drop useless apparmor denies
mem and kmem are really in /dev, so this does us no good.

Signed-off-by: Tycho Andersen <tycho@tycho.ws>
2017-10-03 09:40:08 -06:00
Stéphane Graber
7f2b13275d apparmor: Update mount states handling
Properly list all of the states and the right apparmor stanza for them,
then comment them all as actually enabling this would currently let the
user bypass apparmor entirely.

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
2016-06-27 16:03:49 -04:00
Stéphane Graber
af5f70c4b5 apparmor: allow mount move
Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
2016-06-27 15:11:47 -04:00
Stéphane Graber
e96e7a1ac7 apparmor: Allow bind-mounts and {r}shared/{r}private
Bind-mounts aren't harmful in containers, so long as they're not used to
bypass MAC policies.

This change allows bind-mounting of any path which isn't a dangerous
filesystem that's otherwise blocked by apparmor.

This also allows switching paths {r}shared or {r}private.

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
2016-06-23 16:01:29 -04:00
Stéphane Graber
e6faa0670c Also allow fstype=fuse for fuse filesystems
Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
2016-05-11 12:59:23 -04:00
Serge Hallyn
4845c17aff Prevent access to pci devices
Prevent privileged containers from messing with the host's pci devices
directly.  Refuse access under /proc/bus, and drop cap_sys_rawio.  Some
containers may need to re-enable cap_sys_rawio (i.e. if they run an
X server).

It may be desirable to break some of this stuff into files which can be
separately included (or not included), but this patch isn't the right
place for that.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
2016-03-16 15:18:51 -07:00
Serge Hallyn
537188a8ee prevent containers from reading /sys/kernel/debug
Unprivileged containers cannot read it anyway, but also prevent root
owned containers from doing so.  Sadly upstart's mountall won't run
if we try to prevent it from being mounted at all.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
2016-03-07 19:10:58 -08:00
Stéphane Graber
eab570bcaf Revert "allow cgroupfs mounts under /sys/fs/cgroup"
This reverts commit 833bf9c2b2.

This change wasn't actually safe and is now superseded by the cgns profile.

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
2016-03-07 15:00:05 -05:00
Stéphane Graber
97f9856db3 Allow cgroupfs remount by systemd
Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
2016-02-15 20:08:25 -05:00
Stéphane Graber
15966fd086
Allow sysfs remount by mountall
Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
2016-02-15 20:03:50 -05:00
Wolfgang Bumiller
4a491a31c2 apparmor: allow binding /run/{,lock/} -> /var/run/{,lock/}
Some systems need to be able to bind-mount /run to /var/run
and /run/lock to /var/run/lock. (Tested with opensuse 13.1
containers migrated from openvz.)

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2016-02-02 09:18:11 +01:00
Serge Hallyn
833bf9c2b2 allow cgroupfs mounts under /sys/fs/cgroup
Systemd needs to be able to do these, and it does not bypass
any of our apparmor rules.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
2016-01-28 17:49:43 +01:00
Stéphane Graber
98b745498b apparmor: Block access to /proc/kcore
Just like we block access to mem and kmem, there's no good reason for
the container to have access to kcore.

Reported-by: Marc Schaefer
Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
2015-01-05 16:28:33 -05:00
Jamie Strandboge
807f4c9e1e apparmor: restrict signal and ptrace for processes
Restrict signal and ptrace for processes running under the container
profile. Rules based on AppArmor base abstraction. Add unix rules for
processes running under the container profile.

Signed-off-by: Jamie Strandboge <jamie@canonical.com>
Acked-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
2014-09-29 12:40:52 -04:00
Serge Hallyn
097796ac6c apparmor: silence 'silent' mount denials
newer lxc uses 'silent' when remounting on shutdown.  Silence that denial too

Author: Jamie Strandboge <jamie@canonical.com>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
2014-09-25 10:59:26 -04:00
Jesse Tane
f2f545857c Apparmor: allow hugetlbfs mounts everywhere
Signed-off-by: Jesse Tane <jesse.tane@gmail.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
2014-06-30 17:06:52 -04:00
Stéphane Graber
2a31251cc5 apparmor: Update profiles for current upstream parser
Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
2014-04-04 17:45:35 -04:00
Serge Hallyn
198b363fff apparmor: auto-generate the blacklist rules
This uses the generate-apparmor-rules.py script I sent out some time
ago to auto-generate apparmor rules based on a higher level set of
block/allow rules.

Add apparmor policy testcase to make sure that some of the paths we
expect to be denied (and allowed) write access to are in fact in
effect in the final policy.

With this policy, libvirt in a container is able to start its
default network, which previously it could not.

v2: address feedback from stgraber
	  put lxc-generate-aa-rules.py into EXTRA_DIST
	  add lxc-test-apparmor, container-base and container-rules to .gitignore
	  take lxc-test-apparmor out of EXTRA_DIST
	  make lxc-generate-aa-rules.py pep8-compliant
	  don't automatically generate apparmor rules
	  This is only bc we can't be guaranteed that python3 will be
	  available.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
2014-04-01 13:49:43 -04:00