# apparmor.d - Full set of apparmor profiles
# 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}/acpid
profile acpid @{exec_path} flags=(attach_disconnected) {
  include <abstractions/base>
  include <abstractions/nameservice-strict>

  capability dac_read_search,
  capability mknod,

  network netlink raw,

  @{exec_path} mr,

  @{bin}/{ba,da,}sh        rix,
  @{bin}/logger            rix,

  /etc/acpi/powerbtn-acpi-support.sh rPx -> acpi-powerbtn,

  /etc/acpi/{,**} r,
  /etc/acpi/handler.sh rix,

  owner @{run}/acpid.socket rw,
  owner @{run}/acpid.pid    rw,

  owner @{PROC}/@{pids}/fd/ r,
  owner @{PROC}/@{pids}/loginuid r,

  /dev/input/{,**} r,
  /dev/tty rw,

  include if exists <local/acpid>
}
