260 lines
7.8 KiB
Text
260 lines
7.8 KiB
Text
# apparmor.d - Full set of apparmor profiles
|
|
# Copyright (C) 2022-2024 Alexandre Pujol <alexandre@pujol.io>
|
|
# SPDX-License-Identifier: GPL-2.0-only
|
|
|
|
# Security objectives of the steam profiles:
|
|
# - Ensure no user data is accessed by either steam or steam games
|
|
# - Limit what steam/games can access to the host
|
|
#
|
|
# Current architecture:
|
|
# steam
|
|
# ├── steam-fossilize
|
|
# ├── steam-reaper
|
|
# │ └── steam-game
|
|
# ├── steam-gameoverlayui
|
|
# └── steamerrorreporter
|
|
|
|
abi <abi/3.0>,
|
|
|
|
include <tunables/global>
|
|
|
|
@{share_dirs} = @{user_share_dirs}/Steam
|
|
@{lib_dirs} = @{share_dirs}/ubuntu@{int2}_{32,64}
|
|
@{runtime_dirs} = @{share_dirs}/steamapps/common/SteamLinuxRuntime_sniper
|
|
|
|
@{exec_path} = @{share_dirs}/steam.sh
|
|
profile steam @{exec_path} flags=(attach_disconnected,mediate_deleted) {
|
|
include <abstractions/base>
|
|
include <abstractions/audio-client>
|
|
include <abstractions/common/bwrap>
|
|
include <abstractions/common/chromium>
|
|
include <abstractions/consoles>
|
|
include <abstractions/dconf-write>
|
|
include <abstractions/desktop>
|
|
include <abstractions/disks-read>
|
|
include <abstractions/fontconfig-cache-write>
|
|
include <abstractions/graphics>
|
|
include <abstractions/nameservice-strict>
|
|
include <abstractions/ssl_certs>
|
|
include <abstractions/video>
|
|
|
|
network inet dgram,
|
|
network inet6 dgram,
|
|
network inet stream,
|
|
network inet6 stream,
|
|
network netlink raw,
|
|
|
|
ptrace (read),
|
|
ptrace (trace) peer=steam,
|
|
|
|
signal (send) peer=steam-game,
|
|
signal (read),
|
|
|
|
unix (receive) type=stream,
|
|
|
|
@{exec_path} mrix,
|
|
|
|
@{sh_path} rix,
|
|
@{coreutils_path} rix,
|
|
@{bin}/cmp rix,
|
|
@{bin}/file rix,
|
|
@{bin}/getopt rix,
|
|
@{bin}/gzip rix,
|
|
@{bin}/ldconfig rix,
|
|
@{bin}/ldd rix,
|
|
@{bin}/localedef rix,
|
|
@{bin}/lsb_release rPx -> lsb_release,
|
|
@{bin}/lsof rix,
|
|
@{bin}/lspci rCx -> lspci,
|
|
@{bin}/steam-runtime-urlopen rix,
|
|
@{bin}/tar rix,
|
|
@{bin}/which rix,
|
|
@{bin}/xdg-icon-resource rPx,
|
|
@{bin}/xdg-user-dir rix,
|
|
@{bin}/xz rix,
|
|
@{bin}/zenity rix,
|
|
@{lib}/ld-linux.so* rix,
|
|
|
|
@{lib_dirs}/** mr,
|
|
@{lib_dirs}/*/** ix,
|
|
@{lib_dirs}/*driverquery rix,
|
|
@{lib_dirs}/fossilize_replay rpx,
|
|
@{lib_dirs}/gameoverlayui rpx,
|
|
@{lib_dirs}/reaper rpx,
|
|
@{lib_dirs}/steam* rix,
|
|
|
|
# Entry point for steam-game
|
|
@{runtime_dirs}/*entry-point rpx,
|
|
|
|
@{lib}/pressure-vessel/from-host/** rix,
|
|
@{run}/host/@{bin}/* rix,
|
|
@{run}/host/@{lib}/** rix,
|
|
|
|
@{share_dirs}/linux{32,64}/steamerrorreporter rpx,
|
|
@{share_dirs}/config/cefdata/WidevineCdm/**/linux_*/libwidevinecdm.so rm,
|
|
|
|
/usr/lib/os-release rk,
|
|
/usr/share/fonts/**.{ttf,otf} rk,
|
|
/usr/share/terminfo/** r,
|
|
/usr/share/zenity/* r,
|
|
|
|
/etc/lsb-release r,
|
|
/etc/udev/udev.conf r,
|
|
/etc/machine-id r,
|
|
/var/lib/dbus/machine-id r,
|
|
|
|
@{bin}/ r,
|
|
@{lib}/ r,
|
|
/ r,
|
|
/etc/ r,
|
|
/home/ r,
|
|
/run/ r,
|
|
/usr/ r,
|
|
/usr/local/ r,
|
|
/usr/local/lib/ r,
|
|
/var/ r,
|
|
|
|
owner /bindfile@{rand6} rw,
|
|
|
|
owner /var/pressure-vessel/** rw,
|
|
owner /var/cache/ldconfig/aux-cache* rw,
|
|
|
|
owner @{HOME}/ r,
|
|
owner @{HOME}/.steam/{,**} rw,
|
|
owner @{HOME}/.steam/registry.vdf rwk,
|
|
owner @{HOME}/.steampath rw,
|
|
owner @{HOME}/.steampid rw,
|
|
|
|
owner @{share_dirs}/ rw,
|
|
owner @{share_dirs}/** rwkl -> @{share_dirs}/**,
|
|
|
|
owner @{user_games_dirs}/ rw,
|
|
owner @{user_games_dirs}/** rwlk -> @{user_games_dirs}/**,
|
|
|
|
owner @{user_config_dirs}/autostart/ r,
|
|
owner @{user_config_dirs}/cef_user_data/{,**} r,
|
|
owner @{user_config_dirs}/cef_user_data/Dictionaries/* rw,
|
|
owner @{user_config_dirs}/cef_user_data/WidevineCdm/** rwm,
|
|
owner @{user_config_dirs}/unity3d/{,**} rwk,
|
|
owner @{user_config_dirs}/user-dirs.dirs r,
|
|
|
|
owner @{user_share_dirs}/applications/*.desktop w,
|
|
owner @{user_share_dirs}/icons/hicolor/**/apps/steam*.png rw,
|
|
owner @{user_share_dirs}/vulkan/implicit_layer.d/steam*.json rwk,
|
|
|
|
owner /dev/shm/#@{int} rw,
|
|
owner /dev/shm/fossilize-*-@{int}-@{int} rw,
|
|
owner /dev/shm/u@{uid}-Shm_@{hex} rw,
|
|
owner /dev/shm/u@{uid}-ValveIPCSharedObj-Steam rwk,
|
|
owner /dev/shm/ValveIPCSHM_@{uid} rw,
|
|
|
|
@{tmp}/ r,
|
|
owner @{tmp}/#@{int} rw,
|
|
owner @{tmp}/dumps/ rw,
|
|
owner @{tmp}/dumps/** rwk,
|
|
owner @{tmp}/gdkpixbuf-xpm-tmp.@{rand6} rw,
|
|
owner @{tmp}/miles_image_* mrw,
|
|
owner @{tmp}/pressure-vessel-*-@{rand6}/ rw,
|
|
owner @{tmp}/pressure-vessel-*-@{rand6}/** rwlk -> @{tmp}/pressure-vessel-*-@{rand6}/**,
|
|
owner @{tmp}/runtime-info.txt.* rwk,
|
|
owner @{tmp}/sh-thd.* rw,
|
|
owner @{tmp}/steam_chrome_shmem_uid@{uid}_spid@{int} rw,
|
|
owner @{tmp}/steam@{rand6}/{,**} rw,
|
|
owner @{tmp}/steam/ rw,
|
|
owner @{tmp}/steam/** rwk,
|
|
owner @{tmp}/vdpau-drivers-@{rand6}/{,**} rw,
|
|
|
|
owner @{run}/pressure-vessel/** r,
|
|
owner @{run}/user/@{uid}/ r,
|
|
|
|
@{run}/host/{,**} r,
|
|
|
|
@{run}/udev/data/+input:input@{int} r, # for mouse, keyboard, touchpad
|
|
@{run}/udev/data/+pci:* r, # Identifies all PCI devices (CPU, GPU, Network, Disks, USB, etc.)
|
|
|
|
@{run}/udev/data/c13:@{int} r, # for /dev/input/*
|
|
@{run}/udev/data/c116:@{int} r, # for ALSA
|
|
@{run}/udev/data/c@{dynamic}:@{int} r, # For dynamic assignment range 234 to 254, 384 to 511
|
|
@{run}/udev/data/n@{int} r,
|
|
|
|
@{sys}/ r,
|
|
@{sys}/bus/ r,
|
|
@{sys}/bus/pci/devices/ r,
|
|
@{sys}/class/ r,
|
|
@{sys}/class/hidraw/ r,
|
|
@{sys}/class/input/ r,
|
|
@{sys}/class/net/ r,
|
|
@{sys}/devices/@{pci}/class r,
|
|
@{sys}/devices/@{pci}/i2c-@{int}/{,**/}report_descriptor r,
|
|
@{sys}/devices/@{pci}/sound/card@{int}/** r,
|
|
@{sys}/devices/@{pci}/usb@{int}/{manufacturer,product,bcdDevice,bInterfaceNumber} r,
|
|
@{sys}/devices/**/input@{int}/ r,
|
|
@{sys}/devices/**/input@{int}/capabilities/* r,
|
|
@{sys}/devices/**/input/input@{int}/ r,
|
|
@{sys}/devices/**/input/input@{int}/properties r,
|
|
@{sys}/devices/**/uevent r,
|
|
@{sys}/devices/system/cpu/** r,
|
|
@{sys}/devices/system/node/ r,
|
|
@{sys}/devices/virtual/**/report_descriptor r,
|
|
@{sys}/devices/virtual/net/*/ r,
|
|
@{sys}/devices/virtual/tty/tty@{int}/active r,
|
|
@{sys}/kernel/ r,
|
|
@{sys}/power/suspend_stats/success rk,
|
|
|
|
@{PROC}/ r,
|
|
@{PROC}/@{pids}/comm rk,
|
|
@{PROC}/@{pids}/net/route r,
|
|
@{PROC}/@{pids}/stat r,
|
|
@{PROC}/locks r,
|
|
@{PROC}/@{pid}/net/* r,
|
|
@{PROC}/1/cgroup r,
|
|
@{PROC}/sys/fs/inotify/max_user_watches r,
|
|
@{PROC}/sys/kernel/sched_autogroup_enabled r,
|
|
@{PROC}/sys/kernel/unprivileged_userns_clone r,
|
|
@{PROC}/sys/kernel/yama/ptrace_scope r,
|
|
@{PROC}/sys/net/ipv{4,6}/conf/all/disable_ipv{4,6} r,
|
|
@{PROC}/sys/user/max_user_namespaces r,
|
|
@{PROC}/version r,
|
|
owner @{PROC}/@{pid}/mem r,
|
|
owner @{PROC}/@{pid}/autogroup rw,
|
|
owner @{PROC}/@{pid}/cmdline rk,
|
|
owner @{PROC}/@{pid}/environ r,
|
|
owner @{PROC}/@{pid}/fd/ r,
|
|
owner @{PROC}/@{pid}/fdinfo/@{int} r,
|
|
owner @{PROC}/@{pid}/mounts r,
|
|
owner @{PROC}/@{pid}/oom_score_adj w,
|
|
owner @{PROC}/@{pid}/statm r,
|
|
owner @{PROC}/@{pid}/task/ r,
|
|
owner @{PROC}/@{pid}/task/@{tid}/comm rw,
|
|
owner @{PROC}/@{pid}/task/@{tid}/status r,
|
|
|
|
/dev/hidraw@{int} rw,
|
|
/dev/input/ r,
|
|
/dev/input/event@{int} r,
|
|
/dev/tty rw,
|
|
/dev/uinput w,
|
|
|
|
audit deny /**.steam_exec_test.sh rw,
|
|
deny owner @{user_share_dirs}/gvfs-metadata/{,*} r,
|
|
|
|
profile lspci {
|
|
include <abstractions/base>
|
|
include <abstractions/consoles>
|
|
include <abstractions/nameservice-strict>
|
|
|
|
@{bin}/lspci mr,
|
|
|
|
owner @{HOME}/.steam/steam.pipe r,
|
|
|
|
@{sys}/bus/pci/devices/ r,
|
|
@{sys}/bus/pci/slots/ r,
|
|
@{sys}/bus/pci/slots/@{int}/address r,
|
|
@{sys}/devices/@{pci}/** r,
|
|
|
|
owner /dev/shm/ValveIPCSHM_@{uid} rw,
|
|
|
|
include if exists <local/steam_lspci>
|
|
}
|
|
|
|
include if exists <local/steam>
|
|
}
|