# vim:syntax=apparmor # ------------------------------------------------------------------ # # Copyright (C) 2017-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 @{TELEGRAM_WORK_DIR} = /media/Kabi/telegram @{exec_path} = /{usr/,}bin/telegram-desktop profile telegram-desktop @{exec_path} { include include include include include include include include include include include include include include include include include include network inet dgram, network inet6 dgram, network inet stream, network inet6 stream, network netlink dgram, network netlink raw, @{exec_path} mr, /{usr/,}bin/{,ba,da}sh rix, # 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, owner @{PROC}/@{pid}/fd/ r, 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 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 @{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 }