# vim:syntax=apparmor # ------------------------------------------------------------------ # # Copyright (C) 2019-2021 Mikhail Morfikov # # 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. # # ------------------------------------------------------------------ abi , include # 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} { include include include include include include include include include include include include include # 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), network inet dgram, network inet6 dgram, network inet stream, network inet6 stream, network netlink raw, network netlink dgram, @{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 { include include /{usr/,}bin/xdg-open mr, /{usr/,}bin/{,ba,da}sh rix, /{usr/,}bin/gawk rix, /{usr/,}bin/readlink rix, /{usr/,}bin/basename rix, owner @{HOME}/ r, owner @{run}/user/[0-9]*/ r, # Allowed apps to open /{usr/,}lib/firefox/firefox rPUx, # file_inherit owner @{HOME}/.xsession-errors w, } include if exists }