2021-04-01 17:17:47 +02:00
|
|
|
# apparmor.d - Full set of apparmor profiles
|
|
|
|
# Copyright (C) 2019-2021 Mikhail Morfikov
|
2024-02-07 00:16:21 +01:00
|
|
|
# Copyright (C) 2021-2024 Alexandre Pujol <alexandre@pujol.io>
|
2021-04-01 17:17:47 +02:00
|
|
|
# SPDX-License-Identifier: GPL-2.0-only
|
2020-09-12 17:19:23 +02:00
|
|
|
|
2020-12-10 22:33:39 +01:00
|
|
|
abi <abi/3.0>,
|
2020-09-12 17:19:23 +02:00
|
|
|
|
2020-12-10 22:33:39 +01:00
|
|
|
include <tunables/global>
|
2020-09-12 17:19:23 +02:00
|
|
|
|
2023-07-09 15:34:42 +02:00
|
|
|
@{exec_path} = @{bin}/hardinfo
|
2020-09-12 17:19:23 +02:00
|
|
|
profile hardinfo @{exec_path} {
|
2020-12-10 22:33:39 +01:00
|
|
|
include <abstractions/base>
|
|
|
|
include <abstractions/consoles>
|
|
|
|
include <abstractions/fontconfig-cache-read>
|
2023-07-09 15:34:42 +02:00
|
|
|
include <abstractions/fonts>
|
2020-12-10 22:33:39 +01:00
|
|
|
include <abstractions/freedesktop.org>
|
2023-07-09 15:34:42 +02:00
|
|
|
include <abstractions/gtk>
|
2020-12-10 22:33:39 +01:00
|
|
|
include <abstractions/nameservice-strict>
|
|
|
|
include <abstractions/python>
|
2023-07-09 15:34:42 +02:00
|
|
|
include <abstractions/user-download-strict>
|
2020-09-12 17:19:23 +02:00
|
|
|
|
|
|
|
# This is needed to display some content of devices -> resources
|
|
|
|
capability sys_admin,
|
|
|
|
|
|
|
|
# This is for benchmarks
|
|
|
|
capability sys_nice,
|
|
|
|
|
2020-12-10 22:33:39 +01:00
|
|
|
network inet dgram,
|
|
|
|
network inet6 dgram,
|
|
|
|
network inet stream,
|
|
|
|
network inet6 stream,
|
|
|
|
|
2020-09-12 17:19:23 +02:00
|
|
|
@{exec_path} mrix,
|
|
|
|
|
2024-02-11 15:34:46 +01:00
|
|
|
@{sh_path} rix,
|
2023-07-09 15:34:42 +02:00
|
|
|
@{bin}/gdb rix,
|
|
|
|
@{bin}/iconv rix,
|
|
|
|
@{bin}/last rix,
|
|
|
|
@{bin}/ldd rix,
|
|
|
|
@{bin}/locale rix,
|
|
|
|
@{bin}/make rix,
|
|
|
|
@{bin}/perl rix,
|
2024-01-25 13:44:47 +01:00
|
|
|
@{bin}/python3.@{int} rix,
|
2023-07-09 15:34:42 +02:00
|
|
|
@{bin}/route rix,
|
2023-08-18 18:09:53 +02:00
|
|
|
@{bin}/ruby[0-9].@{int} rix,
|
2023-07-09 15:34:42 +02:00
|
|
|
@{bin}/strace rix,
|
|
|
|
@{bin}/tr rix,
|
|
|
|
@{bin}/valgrind{,.bin} rix,
|
|
|
|
@{lib}/@{multiarch}/valgrind/memcheck-*-linux rix,
|
|
|
|
|
|
|
|
@{bin}/lsb_release rPx -> lsb_release,
|
|
|
|
@{bin}/xdg-open rCx -> open,
|
|
|
|
@{bin}/ccache rCx -> ccache,
|
|
|
|
@{bin}/kmod rCx -> kmod,
|
|
|
|
|
|
|
|
@{bin}/glxinfo rPx,
|
|
|
|
@{bin}/xdpyinfo rPx,
|
|
|
|
@{bin}/lspci rPx,
|
|
|
|
@{bin}/lsusb rPx,
|
|
|
|
@{bin}/netstat rPx,
|
|
|
|
@{bin}/qtchooser rPx,
|
|
|
|
|
|
|
|
@{lib}/jvm/java-[0-9]*-openjdk-amd64/bin/javac rCx -> javac,
|
2020-09-12 17:19:23 +02:00
|
|
|
|
|
|
|
/usr/share/hardinfo/{,**} r,
|
|
|
|
|
|
|
|
@{sys}/class/power_supply/ r,
|
|
|
|
@{sys}/class/thermal/ r,
|
|
|
|
@{sys}/bus/i2c/drivers/eeprom/ r,
|
|
|
|
|
|
|
|
@{sys}/devices/system/cpu/** r,
|
|
|
|
@{sys}/devices/virtual/dmi/id/* r,
|
2024-02-26 22:10:53 +01:00
|
|
|
@{sys}/devices/virtual/thermal/thermal_zone@{int}/hwmon@{int}/temp* r,
|
|
|
|
@{sys}/devices/virtual/thermal/thermal_zone@{int}/temp* r,
|
2023-08-18 18:09:53 +02:00
|
|
|
@{sys}/devices/platform/**/hwmon/hwmon@{int}/temp* r,
|
|
|
|
@{sys}/devices/platform/**/hwmon/hwmon@{int}/fan* r,
|
2023-12-08 18:46:05 +01:00
|
|
|
@{sys}/devices/@{pci}/eeprom r,
|
|
|
|
@{sys}/devices/@{pci}/hwmon/hwmon@{int}/temp* r,
|
2020-09-12 17:19:23 +02:00
|
|
|
@{sys}/devices/**/power_supply/** r,
|
|
|
|
|
|
|
|
@{PROC}/@{pid}/net/wireless r,
|
|
|
|
@{PROC}/@{pid}/net/dev r,
|
|
|
|
@{PROC}/@{pid}/net/arp r,
|
|
|
|
owner @{PROC}/@{pid}/fd/ r,
|
|
|
|
owner @{PROC}/@{pid}/mountinfo r,
|
|
|
|
owner @{PROC}/@{pid}/mounts r,
|
|
|
|
@{PROC}/@{pids}/loginuid r,
|
|
|
|
@{PROC}/uptime r,
|
|
|
|
@{PROC}/loadavg r,
|
|
|
|
@{PROC}/ioports r,
|
|
|
|
@{PROC}/iomem r,
|
|
|
|
@{PROC}/dma r,
|
|
|
|
@{PROC}/asound/cards r,
|
|
|
|
@{PROC}/scsi/scsi r,
|
|
|
|
@{PROC}/bus/input/devices r,
|
|
|
|
@{PROC}/sys/kernel/random/entropy_avail r,
|
|
|
|
@{PROC}/@{pids}/net/route r,
|
|
|
|
|
|
|
|
/etc/fstab r,
|
|
|
|
/etc/exports r,
|
2020-12-10 22:33:39 +01:00
|
|
|
/etc/samba/smb.conf r,
|
|
|
|
|
|
|
|
/etc/gdb/gdbinit.d/ r,
|
|
|
|
|
|
|
|
/usr/share/gdb/python/ r,
|
|
|
|
/usr/share/gdb/python/** r,
|
2020-09-12 17:19:23 +02:00
|
|
|
|
|
|
|
/var/log/wtmp r,
|
|
|
|
|
|
|
|
owner @{HOME}/.hardinfo/ rw,
|
|
|
|
|
2023-08-17 21:01:53 +02:00
|
|
|
owner /tmp/#@{int} rw,
|
2020-09-12 17:19:23 +02:00
|
|
|
|
|
|
|
# Allowed apps to open
|
2023-07-09 15:34:42 +02:00
|
|
|
@{lib}/firefox/firefox rPUx,
|
2020-09-12 17:19:23 +02:00
|
|
|
|
2020-12-10 22:33:39 +01:00
|
|
|
# Silencer
|
|
|
|
deny /usr/share/gdb/python/** w,
|
|
|
|
|
2020-09-12 17:19:23 +02:00
|
|
|
# file_inherit
|
2023-08-18 18:09:53 +02:00
|
|
|
owner /dev/tty@{int} rw,
|
2020-09-12 17:19:23 +02:00
|
|
|
|
|
|
|
|
|
|
|
profile ccache {
|
2020-12-10 22:33:39 +01:00
|
|
|
include <abstractions/base>
|
2020-09-12 17:19:23 +02:00
|
|
|
|
2023-07-09 15:34:42 +02:00
|
|
|
@{bin}/ccache mr,
|
2020-09-12 17:19:23 +02:00
|
|
|
|
2023-07-09 15:34:42 +02:00
|
|
|
@{lib}/llvm-[0-9]*/bin/clang rix,
|
|
|
|
@{bin}/{,@{multiarch}-}gcc-[0-9]* rix,
|
|
|
|
@{bin}/{,@{multiarch}-}g++-[0-9]* rix,
|
2020-09-12 17:19:23 +02:00
|
|
|
|
|
|
|
/media/ccache/*/** rw,
|
|
|
|
|
2021-05-26 10:49:17 +02:00
|
|
|
/etc/debian_version r,
|
|
|
|
|
2020-09-12 17:19:23 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
profile javac {
|
2020-12-10 22:33:39 +01:00
|
|
|
include <abstractions/base>
|
|
|
|
include <abstractions/nameservice-strict>
|
|
|
|
|
2023-07-09 15:34:42 +02:00
|
|
|
@{lib}/jvm/java-[0-9]*-openjdk-amd64/bin/* mr,
|
2020-09-12 17:19:23 +02:00
|
|
|
|
2023-07-09 15:34:42 +02:00
|
|
|
@{lib}/jvm/java-[0-9]*-openjdk-amd64/lib/** mr,
|
2020-09-12 17:19:23 +02:00
|
|
|
|
2020-12-10 22:33:39 +01:00
|
|
|
/etc/java-[0-9]*-openjdk/** r,
|
2020-09-12 17:19:23 +02:00
|
|
|
|
|
|
|
/usr/share/java/*.jar r,
|
|
|
|
|
|
|
|
owner @{PROC}/@{pid}/mountinfo r,
|
|
|
|
owner @{PROC}/@{pid}/cgroup r,
|
2020-12-10 22:33:39 +01:00
|
|
|
owner @{PROC}/@{pid}/coredump_filter rw,
|
2020-09-12 17:19:23 +02:00
|
|
|
|
2021-03-13 09:47:36 +01:00
|
|
|
@{sys}/fs/cgroup/{,**} r,
|
2020-09-12 17:19:23 +02:00
|
|
|
|
|
|
|
owner /tmp/hsperfdata_*/ rw,
|
|
|
|
owner /tmp/hsperfdata_*/@{pid} rw,
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
profile open {
|
2020-12-10 22:33:39 +01:00
|
|
|
include <abstractions/base>
|
|
|
|
include <abstractions/xdg-open>
|
2020-09-12 17:19:23 +02:00
|
|
|
|
2023-07-09 15:34:42 +02:00
|
|
|
@{bin}/xdg-open mr,
|
2020-09-12 17:19:23 +02:00
|
|
|
|
2024-02-11 15:34:46 +01:00
|
|
|
@{sh_path} rix,
|
2023-07-09 15:34:42 +02:00
|
|
|
@{bin}/{m,g,}awk rix,
|
|
|
|
@{bin}/readlink rix,
|
|
|
|
@{bin}/basename rix,
|
2021-02-13 15:00:16 +01:00
|
|
|
|
2020-12-09 10:30:52 +01:00
|
|
|
owner @{HOME}/ r,
|
|
|
|
|
2021-04-18 20:00:15 +02:00
|
|
|
owner @{run}/user/@{uid}/ r,
|
2020-12-09 10:30:52 +01:00
|
|
|
|
2020-09-12 17:19:23 +02:00
|
|
|
# Allowed apps to open
|
2023-07-09 15:34:42 +02:00
|
|
|
@{lib}/firefox/firefox rPUx,
|
2020-09-12 17:19:23 +02:00
|
|
|
|
|
|
|
# file_inherit
|
|
|
|
owner @{HOME}/.xsession-errors w,
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
profile kmod {
|
2020-12-10 22:33:39 +01:00
|
|
|
include <abstractions/base>
|
2020-09-12 17:19:23 +02:00
|
|
|
|
2023-07-09 15:34:42 +02:00
|
|
|
@{bin}/kmod mr,
|
2020-09-12 17:19:23 +02:00
|
|
|
|
2020-12-10 22:33:39 +01:00
|
|
|
@{sys}/module/** r,
|
|
|
|
|
2020-09-12 17:19:23 +02:00
|
|
|
@{PROC}/cmdline r,
|
|
|
|
@{PROC}/modules r,
|
|
|
|
@{PROC}/ioports r,
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2020-12-10 22:33:39 +01:00
|
|
|
include if exists <local/hardinfo>
|
2020-09-12 17:19:23 +02:00
|
|
|
}
|