apparmor.d/apparmor.d/telegram-desktop

112 lines
2.8 KiB
Text
Raw Normal View History

# vim:syntax=apparmor
# ------------------------------------------------------------------
#
# Copyright (C) 2017-2020 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 <abi/3.0>,
#include <tunables/global>
@{TELEGRAM_WORK_DIR} = /media/Kabi/telegram
@{exec_path} = /{usr/,}bin/telegram-desktop
profile telegram-desktop @{exec_path} {
#include <abstractions/base>
#include <abstractions/consoles>
#include <abstractions/opencl-intel>
#include <abstractions/gtk>
#include <abstractions/fonts>
#include <abstractions/fontconfig-cache-read>
#include <abstractions/freedesktop.org>
#include <abstractions/audio>
#include <abstractions/user-download-strict>
#include <abstractions/qt5-compose-cache-write>
#include <abstractions/qt5-settings-write>
#include <abstractions/mesa>
#include <abstractions/nameservice-strict>
#include <abstractions/enchant>
#include <abstractions/openssl>
#include <abstractions/ssl_certs>
#include <abstractions/deny-dconf>
#include <abstractions/deny-root-dir-access>
@{exec_path} mr,
# Launch external apps
/{usr/,}bin/xdg-open rCx -> open,
# What's this for?
deny /{usr/,}bin/fc-list rx,
# Telegram files
/usr/share/TelegramDesktop/{,**} r,
# Download dir
owner @{TELEGRAM_WORK_DIR}/ rw,
owner @{TELEGRAM_WORK_DIR}/** rwkl -> @{TELEGRAM_WORK_DIR}/#[0-9]*[0-9],
# Telegram's profile (via telegram -many -workdir ~/some/dir/)
#owner @{TELEGRAM_WORK_DIR}/{,**} rw,
# Autostart
owner @{HOME}/.config/autostart/telegramdesktop.desktop rw,
/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,
/var/lib/dbus/machine-id r,
/etc/machine-id r,
# Needed when saving files as, or otherwise the app crashes
/usr/share/glib-2.0/schemas/gschemas.compiled r,
/usr/share/hwdata/pnp.ids r,
# Allowed apps to open
/{usr/,}lib/firefox/firefox rPx,
/{usr/,}bin/smplayer rPx,
/{usr/,}bin/qpdfview rPx,
/{usr/,}bin/geany rPx,
# file_inherit
owner /dev/tty[0-9]* rw,
profile open {
#include <abstractions/base>
#include <abstractions/xdg-open>
/{usr/,}bin/xdg-open mr,
2020-12-09 10:30:52 +01:00
/{usr/,}bin/{,ba,da}sh rix,
owner @{TELEGRAM_WORK_DIR}/ r,
owner @{run}/user/[0-9]*/ r,
# Allowed apps to open
/{usr/,}lib/firefox/firefox rPx,
/{usr/,}bin/smplayer rPx,
/{usr/,}bin/qpdfview rPx,
/{usr/,}bin/geany rPx,
# file_inherit
owner @{HOME}/.xsession-errors w,
}
#include if exists <local/telegram-desktop>
}