2020-09-12 17:19:23 +02:00
|
|
|
# vim:syntax=apparmor
|
|
|
|
# ------------------------------------------------------------------
|
|
|
|
#
|
2021-01-10 16:35:07 +01:00
|
|
|
# Copyright (C) 2019-2021 Mikhail Morfikov
|
2020-09-12 17:19:23 +02:00
|
|
|
#
|
|
|
|
# This program is free software; you can redistribute it and/or
|
|
|
|
# modify it under the terms of version 2 of the GNU General Public
|
|
|
|
# License published by the Free Software Foundation.
|
|
|
|
#
|
|
|
|
# ------------------------------------------------------------------
|
|
|
|
|
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
|
|
|
|
|
|
|
# Video/audio extensions:
|
|
|
|
# a52, aac, ac3, mka, flac, mp1, mp2, mp3, mpc, oga, oma, wav, wv, wm, wma, 3g2, 3gp, 3gp2, 3gpp,
|
|
|
|
# asf, avi, divx, m1v, m2v, m4v, mkv, mov, mp4, mpa, mpe, mpg, mpeg, mpeg1, mpeg2, mpeg4, ogg, ogm,
|
|
|
|
# ogx, ogv, rm, rmvb, webm, wmv, wtv, mp2t
|
|
|
|
@{qnapi_vid_ext} = [aA]{52,[aA][cC],[cC]3}
|
|
|
|
@{qnapi_vid_ext} += [mM][kK][aA]
|
|
|
|
@{qnapi_vid_ext} += [fF][lL][aA][cC]
|
|
|
|
@{qnapi_vid_ext} += [mM][pP][123cC]
|
|
|
|
@{qnapi_vid_ext} += [oO][gGmM][aA]
|
|
|
|
@{qnapi_vid_ext} += [wW]{,[aA]}[vV]
|
|
|
|
@{qnapi_vid_ext} += [wW][mM]{,[aA]}
|
|
|
|
@{qnapi_vid_ext} += 3[gG]{[2pP],[pP][2pP]}
|
|
|
|
@{qnapi_vid_ext} += [aA][sS][fF]
|
|
|
|
@{qnapi_vid_ext} += [aA][vV][iI]
|
|
|
|
@{qnapi_vid_ext} += [dD][iI][vV][xX]
|
|
|
|
@{qnapi_vid_ext} += [mM][124][vV]
|
|
|
|
@{qnapi_vid_ext} += [mM][kKoO][vV]
|
|
|
|
@{qnapi_vid_ext} += [mM][pP][4aAeEgG]
|
|
|
|
@{qnapi_vid_ext} += [mM][pP][eE][gG]{,[124]}
|
|
|
|
@{qnapi_vid_ext} += [oO][gG][gGmMxXvV]
|
|
|
|
@{qnapi_vid_ext} += [rR][mM]{,[vV][bB]}
|
|
|
|
@{qnapi_vid_ext} += [wW][eE][bB][mM]
|
|
|
|
@{qnapi_vid_ext} += [wW][mMtT][vV]
|
|
|
|
@{qnapi_vid_ext} += [mM][pP]2[tT]
|
|
|
|
|
|
|
|
# Subtitle extensions:
|
|
|
|
# srt, txt, sub
|
|
|
|
@{qnapi_txt_ext} = [sS][rR][tT]
|
|
|
|
@{qnapi_txt_ext} += [tT][xX][tT]
|
|
|
|
@{qnapi_txt_ext} += [sS][uU][bB]
|
|
|
|
|
|
|
|
@{exec_path} = /{usr/,}bin/qnapi
|
|
|
|
profile qnapi @{exec_path} {
|
2020-12-10 22:33:39 +01:00
|
|
|
include <abstractions/base>
|
|
|
|
include <abstractions/X>
|
|
|
|
include <abstractions/freedesktop.org>
|
|
|
|
include <abstractions/fonts>
|
|
|
|
include <abstractions/fontconfig-cache-read>
|
|
|
|
include <abstractions/gtk>
|
|
|
|
include <abstractions/dri-enumerate>
|
|
|
|
include <abstractions/mesa>
|
|
|
|
include <abstractions/qt5-settings-write>
|
|
|
|
include <abstractions/qt5-compose-cache-write>
|
|
|
|
include <abstractions/nameservice-strict>
|
|
|
|
include <abstractions/user-download-strict>
|
|
|
|
include <abstractions/deny-root-dir-access>
|
2020-09-12 17:19:23 +02:00
|
|
|
|
|
|
|
# Some apps can use qnapi to automate downloading of subtitles. When a user wants to abort the
|
|
|
|
# action (stop qnapi), the apps send the term/kill signal to qnapi.
|
|
|
|
signal (receive) set=(kill, term),
|
|
|
|
|
2020-12-10 22:33:39 +01:00
|
|
|
network inet dgram,
|
|
|
|
network inet6 dgram,
|
|
|
|
network inet stream,
|
|
|
|
network inet6 stream,
|
2020-12-24 13:55:12 +01:00
|
|
|
network netlink raw,
|
|
|
|
network netlink dgram,
|
2020-12-10 22:33:39 +01:00
|
|
|
|
2020-09-12 17:19:23 +02:00
|
|
|
@{exec_path} mr,
|
|
|
|
|
|
|
|
/{usr/,}bin/7z rix,
|
|
|
|
/{usr/,}lib/p7zip/7z rix,
|
|
|
|
|
|
|
|
/{usr/,}bin/ffprobe rPUx,
|
|
|
|
/{usr/,}bin/xdg-open rCx -> open,
|
|
|
|
|
|
|
|
# Movie dirs
|
|
|
|
/media/ r,
|
|
|
|
owner /media/*/ r,
|
|
|
|
owner /media/*/** r,
|
|
|
|
owner /media/*/**#[0-9]*[0-9] rw,
|
|
|
|
owner /media/*/**.@{qnapi_vid_ext} r,
|
|
|
|
owner /media/*/**.@{qnapi_txt_ext} rwl -> /media/*/**/#[0-9]*[0-9],
|
|
|
|
|
|
|
|
owner @{HOME}/ r,
|
|
|
|
owner @{HOME}/.config/qnapi.ini rw,
|
|
|
|
owner @{HOME}/.config/qnapi.ini.lock rwk,
|
|
|
|
owner @{HOME}/.config/qnapi.ini.* rwl -> @{HOME}/.config/#[0-9]*[0-9],
|
|
|
|
owner @{HOME}/.config/qnapi.ini.mlXXXY rwl -> @{HOME}/.config/#[0-9]*[0-9],
|
|
|
|
|
|
|
|
owner @{HOME}/.config/qt5ct/{,**} r,
|
|
|
|
/usr/share/qt5ct/** r,
|
|
|
|
|
|
|
|
owner @{HOME}/.cache/ rw,
|
|
|
|
|
|
|
|
/usr/share/hwdata/pnp.ids r,
|
|
|
|
|
|
|
|
/dev/shm/#[0-9]*[0-9] rw,
|
|
|
|
|
|
|
|
deny owner @{PROC}/@{pid}/cmdline r,
|
|
|
|
owner @{PROC}/@{pid}/mountinfo r,
|
|
|
|
owner @{PROC}/@{pid}/mounts r,
|
|
|
|
deny @{PROC}/sys/kernel/random/boot_id r,
|
|
|
|
|
|
|
|
/etc/fstab r,
|
|
|
|
|
|
|
|
/tmp/ r,
|
|
|
|
owner /tmp/QNapi-*-rc wl -> /tmp/#[0-9]*[0-9],
|
|
|
|
owner /tmp/QNapi-*-rc.lock rwk,
|
|
|
|
owner /tmp/QNapi.[0-9]*.tmp rw,
|
|
|
|
owner /tmp/QNapi.[0-9]*[0-9] rw,
|
|
|
|
owner /tmp/#[0-9]*[0-9] rw,
|
|
|
|
owner /tmp/QNapi.[0-9]*.tmp.@{qnapi_txt_ext} rw,
|
|
|
|
owner /tmp/QNapi.[0-9]*.tmp.@{qnapi_txt_ext} rwl -> /tmp/#[0-9]*[0-9],
|
|
|
|
owner /tmp/[0-9a-f]*.@{qnapi_txt_ext} rw,
|
|
|
|
owner /tmp/*.@{qnapi_txt_ext} rw,
|
|
|
|
|
|
|
|
/var/lib/dbus/machine-id r,
|
|
|
|
/etc/machine-id r,
|
|
|
|
|
|
|
|
# Allowed apps to open
|
|
|
|
/{usr/,}lib/firefox/firefox rPUx,
|
|
|
|
|
|
|
|
# file_inherit
|
|
|
|
owner /dev/tty[0-9]* 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
|
|
|
|
|
|
|
/{usr/,}bin/xdg-open mr,
|
|
|
|
|
2021-02-13 15:00:16 +01:00
|
|
|
/{usr/,}bin/{,ba,da}sh rix,
|
|
|
|
/{usr/,}bin/gawk rix,
|
|
|
|
/{usr/,}bin/readlink rix,
|
|
|
|
/{usr/,}bin/basename rix,
|
|
|
|
|
2020-12-09 10:30:52 +01:00
|
|
|
owner @{HOME}/ r,
|
|
|
|
|
|
|
|
owner @{run}/user/[0-9]*/ r,
|
|
|
|
|
2020-09-12 17:19:23 +02:00
|
|
|
# Allowed apps to open
|
|
|
|
/{usr/,}lib/firefox/firefox rPUx,
|
|
|
|
|
|
|
|
# file_inherit
|
|
|
|
owner @{HOME}/.xsession-errors w,
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2020-12-10 22:33:39 +01:00
|
|
|
include if exists <local/qnapi>
|
2020-09-12 17:19:23 +02:00
|
|
|
}
|