# 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}/fprintd
profile fprintd @{exec_path} flags=(attach_disconnected) {
  include <abstractions/base>
  include <abstractions/bus-system>
  include <abstractions/bus/org.freedesktop.login1>
  include <abstractions/devices-usb>
  include <abstractions/nameservice-strict>

  capability net_admin,
  capability sys_nice,

  network netlink raw,

  #aa:dbus own bus=system name=net.reactivated.Fprint

  @{exec_path} mr,

  /etc/fprintd.conf r,

  /var/lib/fprint/{,**} rw,

  @{run}/systemd/journal/socket rw,
  @{run}/systemd/inhibit/*.ref w,
  @{run}/udev/data/c@{dynamic}:@{int} r,  # For dynamic assignment range 234 to 254, 384 to 511

  @{sys}/class/hidraw/ r,
  @{sys}/devices/@{pci}/hidraw/hidraw@{int}/uevent r,
  @{sys}/devices/virtual/**/hidraw/hidraw@{int}/uevent r,

  include if exists <local/fprintd>
}
