apparmor.d/profiles/mpv

177 lines
4.4 KiB
Text
Raw Normal View History

# apparmor.d - Full set of apparmor profiles
# Copyright (C) 2017-2021 Mikhail Morfikov
# SPDX-License-Identifier: GPL-2.0-only
2020-12-10 22:33:39 +01:00
abi <abi/3.0>,
2020-12-10 22:33:39 +01:00
include <tunables/global>
# 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
@{mpv_ext} = [aA]{52,[aA][cC],[cC]3}
@{mpv_ext} += [mM][kK][aA]
@{mpv_ext} += [fF][lL][aA][cC]
@{mpv_ext} += [mM][pP][123cC]
@{mpv_ext} += [oO][gGmM][aA]
@{mpv_ext} += [wW]{,[aA]}[vV]
@{mpv_ext} += [wW][mM]{,[aA]}
@{mpv_ext} += 3[gG]{[2pP],[pP][2pP]}
@{mpv_ext} += [aA][sS][fF]
@{mpv_ext} += [aA][vV][iI]
@{mpv_ext} += [dD][iI][vV][xX]
@{mpv_ext} += [mM][124][vV]
@{mpv_ext} += [mM][kKoO][vV]
@{mpv_ext} += [mM][pP][4aAeEgG]
@{mpv_ext} += [mM][pP][eE][gG]{,[124]}
@{mpv_ext} += [oO][gG][gGmMxXvV]
@{mpv_ext} += [rR][mM]{,[vV][bB]}
@{mpv_ext} += [wW][eE][bB][mM]
@{mpv_ext} += [wW][mMtT][vV]
@{mpv_ext} += [mM][pP]2[tT]
# Image extensions
# bmp, jpg, jpeg, png, gif
@{mpv_ext} += [bB][mM][pP]
@{mpv_ext} += [jJ][pP]{,[eE]}[gG]
@{mpv_ext} += [pP][nN][gG]
@{mpv_ext} += [gG][iI][fF]
# Subtitle extensions:
# srt, txt, sub
@{mpv_ext} += [sS][rR][tT]
@{mpv_ext} += [tT][xX][tT]
@{mpv_ext} += [sS][uU][bB]
# Playlist extensions:
# m3u, m3u8, pls
@{mpv_ext} += [mM]3[uU]{,8}
@{mpv_ext} += [pP][lL][sS]
# For Qbittorrent !qB extension
@{mpv_ext} += "!qB"
@{exec_path} = /{usr/,}bin/mpv
profile mpv @{exec_path} {
2020-12-10 22:33:39 +01:00
include <abstractions/base>
include <abstractions/consoles>
include <abstractions/opencl-intel>
include <abstractions/fonts>
include <abstractions/fontconfig-cache-read>
include <abstractions/freedesktop.org>
include <abstractions/mesa>
include <abstractions/audio>
include <abstractions/nameservice-strict>
include <abstractions/vulkan>
include <abstractions/user-download-strict>
include <abstractions/openssl>
include <abstractions/ssl_certs>
include <abstractions/deny-root-dir-access>
signal (receive) set=(term, kill),
signal (send) set=(term, kill) peer=youtube-dl,
2020-12-10 22:33:39 +01:00
network inet dgram,
network inet6 dgram,
network inet stream,
network inet6 stream,
2021-03-21 17:04:10 +01:00
network netlink raw,
2020-12-10 22:33:39 +01:00
@{exec_path} mr,
# MPV config files
/etc/mpv/* r,
owner @{HOME}/.config/mpv/ rw,
owner @{HOME}/.config/mpv/* rw,
# Which files MPV should be able to open
/ r,
/home/ r,
owner @{HOME}/ r,
owner @{HOME}/**/ r,
/media/ r,
owner /media/**/ r,
/tmp/ r,
owner /tmp/mpsyt-input* rw,
owner /tmp/mpsyt-mpv*.sock rw,
owner /tmp/smplayer-mpv-* rw,
owner /tmp/mozilla_*/ r,
owner /{home,media,tmp/mozilla_*}/**.@{mpv_ext} rw,
# For the SMPlayer's builtin thumbnail generator
owner /tmp/smplayer_preview/[0-9]*.{jpg,png} w,
# For SMPlayer's screenshots
owner /tmp/smplayer_screenshots/cap_*.{jpg,png} w,
# Media downloaded by firefox
#deny owner /tmp/mozilla_*/* r,
/etc/machine-id r,
/var/lib/dbus/machine-id r,
owner @{PROC}/@{pid}/cmdline r,
owner @{PROC}/@{pid}/task/ r,
##include <abstractions/nvidia>
/etc/vdpau_wrapper.cfg r,
2021-03-13 09:47:36 +01:00
#/etc/samba/smb.conf r,
# What's this for? (since v0.30.0)
@{sys}/bus/ r,
@{sys}/class/ r,
#
@{sys}/class/input/ r,
@{sys}/devices/**/input/**/uevent r,
@{sys}/devices/**/input/**/capabilities/* r,
/dev/input/event[0-9]* r,
2020-10-25 10:23:34 +01:00
@{run}/udev/data/+input:input[0-9]* r,
@{run}/udev/data/c13:[0-9]* r, # for /dev/input/*
#
@{sys}/class/sound/ r,
@{sys}/devices/**/sound/**/uevent r,
@{sys}/devices/**/sound/**/capabilities/* r,
2020-10-25 10:23:34 +01:00
@{run}/udev/data/+sound:* r,
@{run}/udev/data/c116:[0-9]* r, # for ALSA
# Be able to turn off the screensaver while playing movies
2021-03-13 09:47:36 +01:00
/{usr/,}bin/xdg-screensaver rCx -> xdg-screensaver,
# External apps
/{usr/,}bin/youtube-dl rPUx,
# file_inherit
owner /dev/tty[0-9]* rw,
owner @{HOME}/.xsession-errors w,
2021-03-13 09:47:36 +01:00
profile xdg-screensaver {
include <abstractions/base>
include <abstractions/consoles>
/{usr/,}bin/xdg-screensaver mr,
/{usr/,}bin/{,ba,da}sh rix,
/{usr/,}bin/mv rix,
/{usr/,}bin/{,e}grep rix,
/{usr/,}bin/sed rix,
/{usr/,}bin/which rix,
/{usr/,}bin/xset rix,
/{usr/,}bin/xautolock rix,
/{usr/,}bin/dbus-send rix,
owner @{HOME}/.Xauthority r,
# file_inherit
/dev/dri/card[0-9]* rw,
network inet stream,
network inet6 stream,
}
2020-12-10 22:33:39 +01:00
include if exists <local/mpv>
}