Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
Already on GitHub? Sign in to your account
Update apparmor profile for snap-confine #73
Merged
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
c266baa
Update apparmor profile for snap-confine
zyga 06d5261
Add spread test for LP: 1599891
zyga c63512a
Simplify apparmor rules for mount profiles
zyga 24bbd43
Constrain allowed locatios for mount profiles
zyga 94579ec
Deny mounts to /snap/bin/
zyga 9b09f3a
Ensure that /snap/bin cannot be used for bind mounts
zyga a9b53f1
Add more spread tests for /snap/bin
zyga 1296104
Update spread tests for bind mounts
zyga 7375159
Fix copy-paste issue
zyga 9243efb
Update comment about mount profiles
zyga
Jump to file or symbol
Failed to load files and symbols.
Viewing a subset of changes. View all
Ensure that /snap/bin cannot be used for bind mounts
- Loading branch information...
commit 9b09f3a2e574bb7782b5be5beaefa4e6cc74ddd6
zyga
committed
Jul 7, 2016
| @@ -0,0 +1,23 @@ | ||
| +summary: Check that apparmor profiles prevents bind mounting /snap/bin anywhere | ||
| +# This is blacklisted on debian because it relies on apparmor mount mediation | ||
| +systems: [-debian-8] | ||
| +prepare: | | ||
| + echo "Having installed the snapd-hacker-toolbelt snap" | ||
| + snap install snapd-hacker-toolbelt | ||
| + echo "We can change its mount profile externally to create bind mount /snap/bin somewhere" | ||
| + echo "/snap/bin -> /snap/snapd-hacker-toolbelt/mnt" | ||
| + mkdir -p /var/lib/snapd/mount | ||
| + echo "/snap/bin /snap/snapd-hacker-toolbelt/current/mnt none bind,ro 0 0" > /var/lib/snapd/mount/snap.snapd-hacker-toolbelt.busybox.fstab | ||
| + sysctl -w kernel.printk_ratelimit=0 | ||
| +execute: | | ||
| + cd / | ||
| + echo "Let's clear the kernel ring buffer" | ||
| + dmesg -c | ||
| + echo "We can now run busybox true and expect it to fail" | ||
| + ! /snap/bin/snapd-hacker-toolbelt.busybox true | ||
| + echo "Not only the command failed because snap-confine failed, we see why!" | ||
| + dmesg | grep 'apparmor="DENIED" operation="mount" info="failed srcname match" error=-13 profile="/usr/lib/snapd/snap-confine" name="/snap/snapd-hacker-toolbelt/[0-9]\+/mnt/" pid=[0-9]\+ comm="ubuntu-core-lau" srcname="/snap/bin/" flags="rw, bind"' | ||
jdstrand
Contributor
|
||
| +restore: | | ||
| + snap remove snapd-hacker-toolbelt | ||
| + rm -rf /var/snap/snapd-hacker-toolbelt | ||
| + rm -f /var/lib/snapd/mount/snap.snapd-hacker-toolbelt.busybox.fstab | ||
From IRC discussion (thanks @zyga for remembering the deny rules):