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

abi <abi/3.0>,

include <tunables/global>

@{exec_path} = @{lib}/ubuntu-advantage/apt-esm-hook
profile apt-esm-hook @{exec_path} {
  include <abstractions/base>
  include <abstractions/common/apt>
  include <abstractions/consoles>

  @{exec_path} mr,

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

  /etc/machine-id r,

  /var/cache/apt/pkgcache.bin* rw,
  /var/lib/ubuntu-advantage/messages/{,**} rw,

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

  include if exists <local/apt-esm-hook>
}

# vim:syntax=apparmor
