# apparmor.d - Full set of apparmor profiles
# Copyright (C) 2019-2021 Mikhail Morfikov
# Copyright (C) 2021-2024 Alexandre Pujol <alexandre@pujol.io>
# SPDX-License-Identifier: GPL-2.0-only

abi <abi/3.0>,

include <tunables/global>

@{exec_path} = @{bin}/debtags
profile debtags @{exec_path} {
  include <abstractions/base>
  include <abstractions/consoles>
  include <abstractions/common/apt>
  include <abstractions/python>

  #capability sys_tty_config,

  @{exec_path} r,
  @{bin}/python3.@{int} r,

  @{bin}/ r,
  @{bin}/dpkg rPx -> child-dpkg,

  owner @{PROC}/@{pid}/fd/ r,

  /usr/share/debtags/vocabulary r,
  /var/lib/debtags/vocabulary rw,
  /var/lib/debtags/package-tags rw,
  /var/lib/debtags/tmp* rw,

  /var/cache/apt/ r,
  /var/cache/apt/** rwk,

  /var/lib/dbus/machine-id r,
  /etc/machine-id r,

  @{user_build_dirs}/** rwkl -> @{user_build_dirs}/**,

  # file_inherit
  /var/log/cron-apt/temp w ,

  include if exists <local/debtags>
}
