# any abstractions
/etc/ld.so.cache r,
/etc/ld.so.preload r,
- /{,usr/}lib{,32,64,x32}/{,@{multiarch}/}ld-*.so mrix,
+ /{,usr/}lib{,32,64,x32}/{,@{multiarch}/{,atomics/}}ld-*.so mrix,
# libc, you are funny
- /{,usr/}lib{,32,64,x32}/{,@{multiarch}/}libc{,-[0-9]*}.so* mr,
- /{,usr/}lib{,32,64,x32}/{,@{multiarch}/}libpthread{,-[0-9]*}.so* mr,
+ /{,usr/}lib{,32,64,x32}/{,@{multiarch}/{,atomics/}}libc{,-[0-9]*}.so* mr,
+ /{,usr/}lib{,32,64,x32}/{,@{multiarch}/{,atomics/}}libpthread{,-[0-9]*}.so* mr,
/{,usr/}lib{,32,64,x32}/{,@{multiarch}/}libreadline{,-[0-9]*}.so* mr,
- /{,usr/}lib{,32,64,x32}/{,@{multiarch}/}librt{,-[0-9]*}.so* mr,
+ /{,usr/}lib{,32,64,x32}/{,@{multiarch}/{,atomics/}}librt{,-[0-9]*}.so* mr,
/{,usr/}lib{,32,64,x32}/{,@{multiarch}/}libgcc_s.so* mr,
/{,usr/}lib{,32,64,x32}/{,@{multiarch}/}libncursesw{,-[0-9]*}.so* mr,
- /{,usr/}lib{,32,64,x32}/{,@{multiarch}/}libresolv{,-[0-9]*}.so* mr,
+ /{,usr/}lib{,32,64,x32}/{,@{multiarch}/{,atomics/}}libresolv{,-[0-9]*}.so* mr,
/{,usr/}lib{,32,64,x32}/{,@{multiarch}/}libselinux.so* mr,
- /{,usr/}lib{,32,64,x32}/{,@{multiarch}/}libpcre.so* mr,
+ /{,usr/}lib{,32,64,x32}/{,@{multiarch}/}libpcre{,2}{,-[0-9]*}.so* mr,
/{,usr/}lib{,32,64,x32}/{,@{multiarch}/}libmount.so* mr,
/{,usr/}lib{,32,64,x32}/{,@{multiarch}/}libblkid.so* mr,
/{,usr/}lib{,32,64,x32}/{,@{multiarch}/}libuuid.so* mr,
# normal libs in order
/{,usr/}lib{,32,64,x32}/{,@{multiarch}/}libapparmor.so* mr,
/{,usr/}lib{,32,64,x32}/{,@{multiarch}/}libcgmanager.so* mr,
- /{,usr/}lib{,32,64,x32}/{,@{multiarch}/}libdl{,-[0-9]*}.so* mr,
+ /{,usr/}lib{,32,64,x32}/{,@{multiarch}/{,atomics/}}libdl{,-[0-9]*}.so* mr,
/{,usr/}lib{,32,64,x32}/{,@{multiarch}/}libnih.so* mr,
/{,usr/}lib{,32,64,x32}/{,@{multiarch}/}libnih-dbus.so* mr,
/{,usr/}lib{,32,64,x32}/{,@{multiarch}/}libdbus-1.so* mr,
capability dac_read_search,
capability dac_override,
/sys/fs/cgroup/devices/snap{,py}.*/ w,
- /sys/fs/cgroup/devices/snap{,py}.*/tasks w,
+ /sys/fs/cgroup/devices/snap{,py}.*/cgroup.procs w,
/sys/fs/cgroup/devices/snap{,py}.*/devices.{allow,deny} w,
# cgroup: freezer
# Allow creating per-snap cgroup freezers and adding snap command (task)
# invocations to the freezer. This allows for reliably enumerating all
- # running tasks for the snap. In addition, allow enumerating processes in
- # the cgroup to determine if it is occupied.
+ # running processes for the snap. In addition, allow enumerating processes
+ # in the cgroup to determine if it is occupied.
/sys/fs/cgroup/freezer/ r,
/sys/fs/cgroup/freezer/snap.*/ w,
- /sys/fs/cgroup/freezer/snap.*/tasks w,
- /sys/fs/cgroup/freezer/snap.*/cgroup.procs r,
+ /sys/fs/cgroup/freezer/snap.*/cgroup.procs rw,
# cgroup: pids
# allow creating per snap-security-tag hierarchy and adding snap command (task)
# invocations to the controller.
/sys/fs/cgroup/pids/ r,
/sys/fs/cgroup/pids/snap.*/ w,
- /sys/fs/cgroup/pids/snap.*/tasks w,
+ /sys/fs/cgroup/pids/snap.*/cgroup.procs w,
# querying udev
/etc/udev/udev.conf r,
# reading seccomp filters
/{tmp/snap.rootfs_*/,}var/lib/snapd/seccomp/bpf/*.bin r,
- # LP: #1668659
+ # LP: #1668659 and parallel instaces of classic snaps
mount options=(rw rbind) /snap/ -> /snap/,
mount options=(rw rshared) -> /snap/,
+ mount options=(rw rbind) /var/lib/snapd/snap/ -> /var/lib/snapd/snap/,
+ mount options=(rw rshared) -> /var/lib/snapd/snap/,
# boostrapping the mount namespace
mount options=(rw rshared) -> /,
mount options=(rw rbind) /tmp/ -> /tmp/snap.rootfs_*/tmp/,
mount options=(rw rslave) -> /tmp/snap.rootfs_*/tmp/,
+ mount options=(rw rbind) /var/lib/dhcp/ -> /tmp/snap.rootfs_*/var/lib/dhcp/,
+ mount options=(rw rslave) -> /tmp/snap.rootfs_*/var/lib/dhcp/,
+
mount options=(rw rbind) /var/lib/snapd/ -> /tmp/snap.rootfs_*/var/lib/snapd/,
mount options=(rw rslave) -> /tmp/snap.rootfs_*/var/lib/snapd/,
# pivot_root preparation and execution
mount options=(rw bind) /tmp/snap.rootfs_*/var/lib/snapd/hostfs/ -> /tmp/snap.rootfs_*/var/lib/snapd/hostfs/,
mount options=(rw private) -> /tmp/snap.rootfs_*/var/lib/snapd/hostfs/,
- # pivot_root mediation in AppArmor is not complete. See LP: #1791711
- pivot_root,
+
+ # pivot_root mediation in AppArmor is not complete. See LP: #1791711.
+ # However, we can mediate the new_root and put_old to be what we expect,
+ # and then deny directory creation within old_root to prevent trivial
+ # pivoting into a whitelisted path.
+ pivot_root oldroot=/tmp/snap.rootfs_*/var/lib/snapd/hostfs/ /tmp/snap.rootfs_*/,
+ # Explicitly deny creating the old_root directory in case it is
+ # inadvertently added somewhere else. While this doesn't resolve
+ # LP: #1791711, it provides some hardening.
+ audit deny /tmp/snap.rootfs_*/{var/,var/lib/,var/lib/snapd/,var/lib/snapd/hostfs/} w,
+
# cleanup
umount /var/lib/snapd/hostfs/tmp/snap.rootfs_*/,
umount /var/lib/snapd/hostfs/sys/,
umount /var/lib/snapd/hostfs/proc/,
mount options=(rw rslave) -> /var/lib/snapd/hostfs/,
+ # Hide /writable from view of snaps.
+ mount options=(rprivate) -> /{,var/lib/snapd/hostfs/}writable/,
+ umount /{,var/lib/snapd/hostfs/}writable/,
+
# set up user mount namespace
mount options=(rslave) -> /,
+ # set up mount namespace for parallel instances of classic snaps
+ mount options=(rw rbind) /snap/{,*/} -> /snap/{,*/},
+ mount options=(rslave) -> /snap/,
+ mount options=(rslave) -> /var/snap/,
+ mount options=(rw rbind) /var/snap/{,*/} -> /var/snap/{,*/},
+ mount options=(rw rshared) -> /var/snap/,
+
# Allow reading the os-release file (possibly a symlink to /usr/lib).
/{etc/,usr/lib/}os-release r,
# We run privileged, so be fanatical about what we include and don't use
# any abstractions
/etc/ld.so.cache r,
- /{,usr/}lib{,32,64,x32}/{,@{multiarch}/}ld-*.so mrix,
+ /{,usr/}lib{,32,64,x32}/{,@{multiarch}/{,atomics/}}ld-*.so mrix,
# libc, you are funny
- /{,usr/}lib{,32,64,x32}/{,@{multiarch}/}libc{,-[0-9]*}.so* mr,
- /{,usr/}lib{,32,64,x32}/{,@{multiarch}/}libpthread{,-[0-9]*}.so* mr,
+ /{,usr/}lib{,32,64,x32}/{,@{multiarch}/{,atomics/}}libc{,-[0-9]*}.so* mr,
+ /{,usr/}lib{,32,64,x32}/{,@{multiarch}/{,atomics/}}libpthread{,-[0-9]*}.so* mr,
/{,usr/}lib{,32,64,x32}/{,@{multiarch}/}libreadline{,-[0-9]*}.so* mr,
- /{,usr/}lib{,32,64,x32}/{,@{multiarch}/}librt{,-[0-9]*}.so* mr,
+ /{,usr/}lib{,32,64,x32}/{,@{multiarch}/{,atomics/}}librt{,-[0-9]*}.so* mr,
/{,usr/}lib{,32,64,x32}/{,@{multiarch}/}libgcc_s.so* mr,
/{,usr/}lib{,32,64,x32}/{,@{multiarch}/}libncursesw{,-[0-9]*}.so* mr,
- /{,usr/}lib{,32,64,x32}/{,@{multiarch}/}libresolv{,-[0-9]*}.so* mr,
+ /{,usr/}lib{,32,64,x32}/{,@{multiarch}/{,atomics/}}libresolv{,-[0-9]*}.so* mr,
/{,usr/}lib{,32,64,x32}/{,@{multiarch}/}libselinux.so* mr,
/{,usr/}lib{,32,64,x32}/{,@{multiarch}/}libpcre.so* mr,
/{,usr/}lib{,32,64,x32}/{,@{multiarch}/}libmount.so* mr,
# normal libs in order
/{,usr/}lib{,32,64,x32}/{,@{multiarch}/}libapparmor.so* mr,
/{,usr/}lib{,32,64,x32}/{,@{multiarch}/}libcgmanager.so* mr,
- /{,usr/}lib{,32,64,x32}/{,@{multiarch}/}libdl{,-[0-9]*}.so* mr,
+ /{,usr/}lib{,32,64,x32}/{,@{multiarch}/{,atomics/}}libdl{,-[0-9]*}.so* mr,
/{,usr/}lib{,32,64,x32}/{,@{multiarch}/}libnih.so* mr,
/{,usr/}lib{,32,64,x32}/{,@{multiarch}/}libnih-dbus.so* mr,
/{,usr/}lib{,32,64,x32}/{,@{multiarch}/}libdbus-1.so* mr,
# Allow mounting /var/lib/jenkins from the host into the snap.
mount options=(rw rbind) /var/lib/jenkins/ -> /tmp/snap.rootfs_*/var/lib/jenkins/,
mount options=(rw rslave) -> /tmp/snap.rootfs_*/var/lib/jenkins/,
+
+ # Suppress noisy file_inherit denials (LP: #1850552) until LP: #1849753 is
+ # fixed.
+ deny /dev/shm/.org.chromium.Chromium.* rw,
+
+ # While snap-confine itself doesn't require unix rules and therefore all
+ # unix rules are implicitly denied, adding an explicit deny for unix to
+ # silence noisy denials breaks nested lxd. Until the cause is determined,
+ # do not use an explicit deny for unix. (LP: #1855355)
+ #deny unix,
+
+ # Explicitly deny these accesses which show up on Arch to silence the
+ # denials for this unneeded access.
+ deny /{,usr/}lib{,32,64,x32}/{,@{multiarch}/}libnss_files-[0-9]*.so* mr,
+ deny /{,usr/}lib{,32,64,x32}/{,@{multiarch}/}libnss_mymachines.[0-9]*.so* mr,
+ deny /{,usr/}lib{,32,64,x32}/{,@{multiarch}/}libnss_systemd.[0-9]*.so* mr,
+ deny /etc/nsswitch.conf r,
+ deny /etc/passwd r,
}