# 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/4.0>,

include <tunables/global>

@{exec_path} = @{bin}/systemd-hwdb
@{att} = /att/systemd-hwdb/
profile systemd-hwdb /{,usr/}bin/systemd-hwdb  flags=(attach_disconnected,attach_disconnected.path=@{att},mediate_deleted,complain) {
  include <abstractions/attached/base>
  include <abstractions/attached/consoles>

  capability dac_override,

  @{exec_path} mr,

  @{lib}/udev/#@{int} rwl,
  @{lib}/udev/.#hwdb.bin{@{hex16},@{rand6}} wl -> @{lib}/udev/#@{int},
  @{lib}/udev/hwdb.bin w,

  /etc/udev/.#hwdb.bin{@{hex16},@{rand6}} wl ->  /etc/udev/#@{int},
  /etc/udev/hwdb.bin w,
  /etc/udev/hwdb.d/{,*} r,

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

  include if exists <local/systemd-hwdb>
}

# vim:syntax=apparmor
