# apparmor.d - Full set of apparmor profiles # Copyright (C) 2020-2021 Mikhail Morfikov # Copyright (C) 2023-2024 Alexandre Pujol # SPDX-License-Identifier: GPL-2.0-only abi , include @{exec_path} = @{bin}/calibre{,-parallel,-debug,-server,-smtp,-complete,-customize} @{exec_path} += @{bin}/calibredb @{exec_path} += @{bin}/ebook{-viewer,-edit,-device,-meta,-polish,-convert} @{exec_path} += @{bin}/fetch-ebook-metadata @{exec_path} += @{bin}/lrs2lrf @{bin}/lrf2lrs @{bin}/lrfviewer @{exec_path} += @{bin}/web2disk profile calibre @{exec_path} { include include include include include include include include include include include include include include include include include include include include include include include include capability sys_ptrace, network inet stream, network inet6 stream, network netlink raw, unix (send, receive) type=stream peer=(addr=none, label=xorg), unix (bind, listen) type=stream addr="@*-calibre-gui.socket", unix (bind) type=stream addr="@calibre-*", @{exec_path} mrix, @{bin}/python3.@{int} r, @{bin}/ldconfig{,.real} rix, @{sh_path} rix, @{bin}/file rix, @{bin}/uname rix, @{lib}/@{multiarch}/qt5/libexec/QtWebEngineProcess rix, @{bin}/pdftoppm rPUx, # (#FIXME#) @{bin}/pdfinfo rPUx, @{bin}/pdftohtml rPUx, @{bin}/xdg-open rPx -> child-open, @{bin}/xdg-mime rPx, /usr/share/calibre/{,**} r, /usr/share/hwdata/pnp.ids r, /etc/fstab r, /etc/inputrc r, /etc/magic r, /etc/mime.types r, owner @{HOME}/ r, owner "@{HOME}/Calibre Library/{,**}" rw, owner "@{HOME}/Calibre Library/metadata.db" rwk, owner @{user_documents_dirs}/{,**} rwl, owner @{user_books_dirs}/{,**} rwl, owner @{user_torrents_dirs}/{,**} rwl, owner @{user_work_dirs}/{,**} rwl, owner @{user_config_dirs}/calibre/ rw, owner @{user_config_dirs}/calibre/** rwk, owner @{user_share_dirs}/calibre-ebook.com/ rw, owner @{user_share_dirs}/calibre-ebook.com/calibre/ rw, owner @{user_share_dirs}/calibre-ebook.com/calibre/** rwk, owner @{user_cache_dirs}/ rw, owner @{user_cache_dirs}/calibre/ rw, owner @{user_cache_dirs}/calibre/** rwkl -> @{user_cache_dirs}/calibre/**, owner @{user_cache_dirs}/gstreamer-@{int}/ rw, owner @{user_cache_dirs}/gstreamer-@{int}/registry.*.bin{,.tmp@{rand6}} rw, owner @{user_config_dirs}/qt5ct/{,**} r, owner /tmp/calibre_*_tmp_*/{,**} rw, owner /tmp/calibre-*/{,**} rw, owner /tmp/@{int}-*/ rw, owner /tmp/@{int}-*/** rwl, # owner /tmp/@{int}-*/** rwl -> /tmp/@{int}-*/**, # newer AA version owner /tmp/* rw, owner /dev/shm/#@{int} rw, @{sys}/devices/@{pci}/irq r, @{PROC}/ r, @{PROC}/@{pids}/net/route r, @{PROC}/sys/fs/inotify/max_user_watches r, @{PROC}/sys/kernel/yama/ptrace_scope r, @{PROC}/vmstat r, owner @{PROC}/@{pid}/fd/ r, owner @{PROC}/@{pid}/mountinfo r, owner @{PROC}/@{pid}/mounts r, owner @{PROC}/@{pid}/stat{,m} r, owner @{PROC}/@{pid}/comm r, owner @{PROC}/@{pid}/task/ r, owner @{PROC}/@{pid}/task/@{tid}/status r, owner @{PROC}/@{pid}/task/@{tid}/comm rw, deny owner @{PROC}/@{pid}/cmdline r, deny owner @{PROC}/@{pid}/oom_{,score_}adj rw, deny @{PROC}/sys/kernel/random/boot_id r, owner /dev/tty@{int} rw, include if exists }