apparmor.d/profiles/youtube-dl
2021-04-01 16:17:47 +01:00

96 lines
2.6 KiB
Plaintext

# apparmor.d - Full set of apparmor profiles
# Copyright (C) 2017-2021 Mikhail Morfikov
# SPDX-License-Identifier: GPL-2.0-only
abi <abi/3.0>,
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, m4a
@{ytdl_ext} = [aA]{52,[aA][cC],[cC]3}
@{ytdl_ext} += [mM][kK][aA]
@{ytdl_ext} += [fF][lL][aA][cC]
@{ytdl_ext} += [mM][pP][123cC]
@{ytdl_ext} += [oO][gGmM][aA]
@{ytdl_ext} += [wW]{,[aA]}[vV]
@{ytdl_ext} += [wW][mM]{,[aA]}
@{ytdl_ext} += 3[gG]{[2pP],[pP][2pP]}
@{ytdl_ext} += [aA][sS][fF]
@{ytdl_ext} += [aA][vV][iI]
@{ytdl_ext} += [dD][iI][vV][xX]
@{ytdl_ext} += [mM][124][vV]
@{ytdl_ext} += [mM][kKoO][vV]
@{ytdl_ext} += [mM][pP][4aAeEgG]
@{ytdl_ext} += [mM][pP][eE][gG]{,[124]}
@{ytdl_ext} += [oO][gG][gGmMxXvV]
@{ytdl_ext} += [rR][mM]{,[vV][bB]}
@{ytdl_ext} += [wW][eE][bB][mM]
@{ytdl_ext} += [wW][mMtT][vV]
@{ytdl_ext} += [mM][pP]2[tT]
@{ytdl_ext} += [mM]4[aA]
# The ytdl specific file extensions
# ytdl, part, tmp, temp
@{ytdl_ext} += [yY][tT][dD][lL]
@{ytdl_ext} += part{,-*}
@{ytdl_ext} += [tT]{,[eE]}[mM][pP]
@{exec_path} = /{usr/,}bin/youtube-dl
profile youtube-dl @{exec_path} {
include <abstractions/base>
include <abstractions/consoles>
include <abstractions/X>
include <abstractions/audio>
include <abstractions/fonts>
include <abstractions/fontconfig-cache-read>
include <abstractions/freedesktop.org>
include <abstractions/python>
include <abstractions/nameservice-strict>
include <abstractions/openssl>
include <abstractions/ssl_certs>
include <abstractions/deny-root-dir-access>
signal (receive) set=(term, kill),
network inet dgram,
network inet6 dgram,
network inet stream,
network inet6 stream,
network netlink raw,
@{exec_path} r,
/{usr/,}bin/python3.[0-9]* r,
/{usr/,}bin/ r,
/{usr/,}bin/gcc rix,
/{usr/,}sbin/ldconfig rix,
/{usr/,}bin/uname rix,
/{usr/,}bin/rtmpdump rix,
/{usr/,}bin/git rix,
# Which files youtube-dl should be able to open
owner @{HOME}/ r,
owner @{HOME}/**/ r,
owner /media/**/ r,
owner /{home,media}/**.@{ytdl_ext} rw,
owner @{PROC}/@{pid}/fd/ r,
owner @{PROC}/@{pid}/mounts r,
/etc/mime.types r,
owner @{HOME}/.cache/ rw,
owner @{HOME}/.cache/youtube-dl/{,**} rw,
owner @{HOME}/.config/git/config r,
# External apps
/{usr/,}bin/ffmpeg rPUx,
/{usr/,}bin/ffprobe rPUx,
include if exists <local/youtube-dl>
}