apparmor.d/apparmor.d/profiles-a-f/borg

128 lines
2.7 KiB
Text
Raw Normal View History

# apparmor.d - Full set of apparmor profiles
2022-03-30 23:20:56 +02:00
# Copyright (C) 2020-2022 Mikhail Morfikov
# Copyright (C) 2021-2022 Alexandre Pujol <alexandre@pujol.io>
# SPDX-License-Identifier: GPL-2.0-only
2020-10-13 16:47:49 +02:00
2020-12-10 22:33:39 +01:00
abi <abi/3.0>,
2020-10-13 16:47:49 +02:00
2020-12-10 22:33:39 +01:00
include <tunables/global>
2020-10-13 16:47:49 +02:00
@{exec_path} = /{usr/,}bin/borg
profile borg @{exec_path} {
2020-12-10 22:33:39 +01:00
include <abstractions/base>
include <abstractions/python>
2020-10-13 16:47:49 +02:00
capability dac_read_search,
capability fowner,
2022-02-27 13:18:10 +01:00
capability sys_admin,
2020-10-13 16:47:49 +02:00
2021-03-14 18:57:00 +01:00
network inet dgram,
network inet6 dgram,
2022-06-03 21:13:11 +02:00
network netlink raw,
2021-03-14 18:57:00 +01:00
2020-10-13 16:47:49 +02:00
@{exec_path} r,
2022-06-03 21:13:11 +02:00
/{usr/,}bin/ r,
2020-10-13 16:47:49 +02:00
/{usr/,}bin/python3.[0-9]* r,
2021-04-19 16:28:54 +02:00
/{usr/,}bin/uname rix,
/{usr/,}bin/cat rix,
2021-04-15 23:51:21 +02:00
/{usr/,}{s,}bin/ldconfig rix,
2020-10-13 16:47:49 +02:00
/{usr/,}bin/{,@{multiarch}-}ld.bfd rix,
2021-04-19 16:28:54 +02:00
/{usr/,}bin/pass rPUx,
/{usr/,}bin/ssh rPx,
2020-10-13 16:47:49 +02:00
/{usr/,}bin/ccache rCx -> ccache,
2021-04-19 16:28:54 +02:00
/{usr/,}bin/fusermount{,3} rCx -> fusermount,
2020-10-13 16:47:49 +02:00
mount fstype=fuse -> @{MOUNTS}/,
mount fstype=fuse -> @{MOUNTS}/*/,
umount @{MOUNTS}/,
umount @{MOUNTS}/*/,
2020-10-13 16:47:49 +02:00
/dev/fuse rw,
owner @{PROC}/@{pid}/fd/ r,
2021-04-15 23:51:21 +02:00
@{PROC}/sys/kernel/random/boot_id r,
@{run}/systemd/userdb/ r,
2022-03-30 23:20:56 +02:00
@{run}/resolvconf/resolv.conf r,
2020-10-13 16:47:49 +02:00
2021-04-01 18:20:05 +02:00
owner @{user_cache_dirs}/ rw,
owner @{user_cache_dirs}/borg/ rw,
owner @{user_cache_dirs}/borg/** rw,
2020-10-13 16:47:49 +02:00
2021-04-01 18:21:33 +02:00
owner @{user_config_dirs}/borg/ rw,
owner @{user_config_dirs}/borg/** rw,
2020-10-13 16:47:49 +02:00
# If /tmp/ isn't accessible, then /var/tmp/ is used.
owner /tmp/* rw,
owner /tmp/tmp*/ rw,
owner /tmp/tmp*/idx rw,
2022-02-27 13:18:10 +01:00
owner /tmp/tmp*/file rw,
2021-08-22 16:32:42 +02:00
owner /tmp/borg-cache-*/ rw,
owner /tmp/borg-cache-*/* rw,
2020-10-13 16:47:49 +02:00
owner /var/tmp/* rw,
owner /var/tmp/tmp*/ rw,
owner /var/tmp/tmp*/idx rw,
2022-02-27 13:18:10 +01:00
owner /var/tmp/tmp*/file rw,
2020-10-13 16:47:49 +02:00
# Dirs that can be backed up
/ r,
/etc/{,**} r,
/home/{,**} r,
@{MOUNTS}/{,**} r,
2020-10-13 16:47:49 +02:00
/root/{,**} r,
/srv/{,**} r,
/var/{,**} r,
# The backup dirs
2022-02-05 21:02:10 +01:00
owner @{MOUNTS}/ r,
owner @{MOUNTS}/** rwkl -> @{MOUNTS}/**,
2020-10-13 16:47:49 +02:00
2022-03-30 23:20:56 +02:00
# borg serve on server's side
owner /home/borg/*/ rw,
owner /home/borg/*/{,**} rw,
2020-10-13 16:47:49 +02:00
# For exporting the key
owner /**/key w,
profile ccache {
2020-12-10 22:33:39 +01:00
include <abstractions/base>
2020-10-13 16:47:49 +02:00
/{usr/,}bin/ccache mr,
2021-05-26 10:49:17 +02:00
/{usr/,}lib/llvm-[0-9]*/bin/clang rix,
2020-10-13 16:47:49 +02:00
/{usr/,}bin/{,@{multiarch}-}gcc-[0-9]* rix,
2021-05-26 10:49:17 +02:00
/{usr/,}bin/{,@{multiarch}-}g++-[0-9]* rix,
2020-10-13 16:47:49 +02:00
/media/ccache/*/** rw,
2021-05-26 10:49:17 +02:00
/etc/debian_version r,
2020-10-13 16:47:49 +02:00
}
profile fusermount {
include <abstractions/base>
include <abstractions/nameservice-strict>
# To mount anything:
capability sys_admin,
/{usr/,}bin/fusermount{,3} mr,
2021-08-22 16:32:42 +02:00
/etc/fuse.conf r,
umount @{MOUNTS}/,
umount @{MOUNTS}/*/,
2021-09-12 21:47:14 +02:00
@{PROC}/@{pids}/mounts r,
2021-08-22 16:32:42 +02:00
/dev/fuse rw,
}
2021-09-26 19:12:30 +02:00
include if exists <usr/borg.d>
2020-12-10 22:33:39 +01:00
include if exists <local/borg>
2020-10-13 16:47:49 +02:00
}