2021-04-01 17:17:47 +02:00
|
|
|
# apparmor.d - Full set of apparmor profiles
|
2022-03-30 23:20:56 +02:00
|
|
|
# Copyright (C) 2020-2022 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-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
|
|
|
|
2023-07-09 15:23:22 +02:00
|
|
|
@{exec_path} = @{bin}/borg
|
2020-10-13 16:47:49 +02:00
|
|
|
profile borg @{exec_path} {
|
2020-12-10 22:33:39 +01:00
|
|
|
include <abstractions/base>
|
2024-01-25 14:22:20 +01:00
|
|
|
include <abstractions/consoles>
|
2023-11-22 22:37:09 +01:00
|
|
|
include <abstractions/nameservice-strict>
|
2020-12-10 22:33:39 +01:00
|
|
|
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
|
|
|
|
2023-11-22 22:37:09 +01:00
|
|
|
mount fstype=fuse -> @{MOUNTS}/,
|
|
|
|
mount fstype=fuse -> @{MOUNTS}/*/,
|
|
|
|
umount @{MOUNTS}/,
|
|
|
|
umount @{MOUNTS}/*/,
|
|
|
|
|
2020-10-13 16:47:49 +02:00
|
|
|
@{exec_path} r,
|
2022-06-03 21:13:11 +02:00
|
|
|
|
2023-07-09 15:23:22 +02:00
|
|
|
@{bin}/ r,
|
2024-01-25 13:44:47 +01:00
|
|
|
@{bin}/python3.@{int} r,
|
2020-10-13 16:47:49 +02:00
|
|
|
|
2023-07-09 15:23:22 +02:00
|
|
|
@{bin}/{,@{multiarch}-}ld.bfd rix,
|
|
|
|
@{bin}/cat rix,
|
|
|
|
@{bin}/ldconfig rix,
|
|
|
|
@{bin}/uname rix,
|
2020-10-13 16:47:49 +02:00
|
|
|
|
2023-07-09 15:23:22 +02:00
|
|
|
@{bin}/ccache rCx -> ccache,
|
|
|
|
@{bin}/fusermount{,3} rCx -> fusermount,
|
2023-11-22 22:37:09 +01:00
|
|
|
@{bin}/pass rPx,
|
|
|
|
@{bin}/ssh rPx,
|
2020-10-13 16:47:49 +02:00
|
|
|
|
2023-11-22 22:37:09 +01:00
|
|
|
# Dirs that can be backed up
|
|
|
|
/ r,
|
|
|
|
/etc/{,**} r,
|
|
|
|
/home/{,**} r,
|
|
|
|
@{MOUNTS}/{,**} r,
|
|
|
|
/root/{,**} r,
|
|
|
|
/srv/{,**} r,
|
|
|
|
/var/{,**} r,
|
2021-04-15 23:51:21 +02:00
|
|
|
|
2023-11-22 22:37:09 +01:00
|
|
|
# The backup dirs
|
|
|
|
owner @{MOUNTS}/ r,
|
|
|
|
owner @{MOUNTS}/** rwkl -> @{MOUNTS}/**,
|
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,
|
2021-08-22 16:32:42 +02:00
|
|
|
owner /tmp/borg-cache-*/ rw,
|
|
|
|
owner /tmp/borg-cache-*/* rw,
|
2023-11-22 22:37:09 +01:00
|
|
|
owner /tmp/tmp*/ rw,
|
|
|
|
owner /tmp/tmp*/file rw,
|
|
|
|
owner /tmp/tmp*/idx rw,
|
2020-10-13 16:47:49 +02:00
|
|
|
owner /var/tmp/* rw,
|
|
|
|
owner /var/tmp/tmp*/ rw,
|
2022-02-27 13:18:10 +01:00
|
|
|
owner /var/tmp/tmp*/file rw,
|
2023-11-22 22:37:09 +01:00
|
|
|
owner /var/tmp/tmp*/idx rw,
|
2020-10-13 16:47:49 +02:00
|
|
|
|
2023-11-22 22:37:09 +01:00
|
|
|
owner @{PROC}/@{pid}/fd/ r,
|
2020-10-13 16:47:49 +02:00
|
|
|
|
2023-11-22 22:37:09 +01:00
|
|
|
/dev/fuse rw,
|
2020-10-13 16:47:49 +02:00
|
|
|
|
|
|
|
profile ccache {
|
2020-12-10 22:33:39 +01:00
|
|
|
include <abstractions/base>
|
2020-10-13 16:47:49 +02:00
|
|
|
|
2023-07-09 15:23:22 +02:00
|
|
|
@{bin}/ccache mr,
|
2020-10-13 16:47:49 +02:00
|
|
|
|
2023-07-09 15:23:22 +02:00
|
|
|
@{lib}/llvm-[0-9]*/bin/clang rix,
|
|
|
|
@{bin}/{,@{multiarch}-}gcc-[0-9]* rix,
|
|
|
|
@{bin}/{,@{multiarch}-}g++-[0-9]* rix,
|
2020-10-13 16:47:49 +02:00
|
|
|
|
2021-05-26 10:49:17 +02:00
|
|
|
/etc/debian_version r,
|
|
|
|
|
2023-11-22 22:37:09 +01:00
|
|
|
@{MOUNTS}/** rw,
|
|
|
|
|
|
|
|
include if exists <local/borg_ccache>
|
2020-10-13 16:47:49 +02:00
|
|
|
}
|
|
|
|
|
2021-04-03 12:03:57 +02:00
|
|
|
profile fusermount {
|
|
|
|
include <abstractions/base>
|
|
|
|
include <abstractions/nameservice-strict>
|
|
|
|
|
|
|
|
capability sys_admin,
|
|
|
|
|
2023-11-22 22:37:09 +01:00
|
|
|
umount @{MOUNTS}/,
|
|
|
|
umount @{MOUNTS}/*/,
|
|
|
|
|
2023-07-09 15:23:22 +02:00
|
|
|
@{bin}/fusermount{,3} mr,
|
2021-04-03 12:03:57 +02:00
|
|
|
|
2021-08-22 16:32:42 +02:00
|
|
|
/etc/fuse.conf r,
|
|
|
|
|
2021-09-12 21:47:14 +02:00
|
|
|
@{PROC}/@{pids}/mounts r,
|
2021-08-22 16:32:42 +02:00
|
|
|
|
|
|
|
/dev/fuse rw,
|
2023-11-22 22:37:09 +01:00
|
|
|
|
|
|
|
include if exists <local/borg_fusermount>
|
2021-04-03 12:03:57 +02:00
|
|
|
}
|
|
|
|
|
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
|
|
|
}
|