feat(profile): add pycompile.

This commit is contained in:
Alexandre Pujol 2025-05-18 23:54:33 +02:00
parent 5e65cec8cf
commit 90a9d86d8a
No known key found for this signature in database
GPG key ID: C5469996F0DF68EC
2 changed files with 55 additions and 0 deletions

View file

@ -0,0 +1,54 @@
# apparmor.d - Full set of apparmor profiles
# Copyright (C) 2025 Alexandre Pujol <alexandre@pujol.io>
# SPDX-License-Identifier: GPL-2.0-only
abi <abi/4.0>,
include <tunables/global>
@{exec_path} = @{bin}/py{,3}compile @{bin}/py{,3}clean
profile pycompile @{exec_path} flags=(attach_disconnected,complain) {
include <abstractions/base>
include <abstractions/common/apt>
include <abstractions/consoles>
# include <abstractions/python>
capability dac_override,
capability dac_read_search,
@{exec_path} mr,
@{python_path} rix,
@{bin}/dpkg rCx -> dpkg,
@{lib}/@{python_name}/dist-packages/__pycache__/ w,
@{lib}/@{python_name}/dist-packages/__pycache__/*.pyc w,
@{lib}/@{python_name}/dist-packages/__pycache__/*.pyc.* w,
@{lib}/@{python_name}/dist-packages/**/__pycache__/ w,
@{lib}/@{python_name}/dist-packages/**/__pycache__/*.pyc w,
@{lib}/@{python_name}/dist-packages/**/__pycache__/*.pyc.* w,
/usr/share/python3/{,**} r,
/ r,
profile dpkg {
include <abstractions/base>
include <abstractions/consoles>
include <abstractions/common/apt>
capability dac_read_search,
@{bin}/dpkg mr,
@{bin}/dpkg-query rpx,
/etc/dpkg/dpkg.cfg.d/{,*} r,
/etc/dpkg/dpkg.cfg r,
include if exists <local/pycompile_dpkg>
}
include if exists <local/pycompile>
}
# vim:syntax=apparmor

View file

@ -264,6 +264,7 @@ plymouthd complain
polkit-kde-authentication-agent attach_disconnected,complain,mediate_deleted
ptyxis complain
ptyxis-agent complain
pycompile complain
qdbus complain
remmina complain
run-parts complain