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

include <tunables/global>

@{exec_path} = /usr/share/grub/grub-check-signatures
@{att} = ""
profile grub-check-signatures /usr/share/grub/grub-check-signatures {
  include <abstractions/base-strict>
  include <abstractions/common/debconf>

  @{exec_path} mr,

  @{bin}/{,e}grep     ix,
  @{bin}/{m,g,}awk    ix,
  @{bin}/cp           ix,
  @{bin}/dpkg         px -> child-dpkg,
  @{bin}/find         ix,
  @{bin}/gzip         ix,
  @{bin}/ls           ix,
  @{bin}/mktemp       ix,
  @{bin}/mokutil      ix,
  @{bin}/od           ix,
  @{bin}/openssl      ix,
  @{bin}/rm           ix,
  @{bin}/sbattach     ix,
  @{bin}/sbverify     ix,
  @{bin}/sed          ix,
  @{bin}/sort         ix,
  @{bin}/uname        ix,
  @{bin}/wc           ix,
  @{bin}/zcat         ix,

  / r,
  @{efi}/ r,

  @{tmp}/tmp.@{rand10} rw,
  @{tmp}/tmp.@{rand10}/{,**} rw,

  @{sys}/firmware/efi/efivars/SecureBoot-@{uuid} r,

  include if exists <local/grub-check-signatures>
}

# vim:syntax=apparmor
