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

abi <abi/4.0>,

include <tunables/global>

@{exec_path} = @{bin}/issue-generator
profile issue-generator @{exec_path} {
  include <abstractions/base>
  include <abstractions/consoles>
  include <abstractions/nameservice-strict>

  @{exec_path} mr,

  @{sh_path}       r,
  @{bin}/basename  rix,
  @{bin}/cat       rix,
  @{bin}/chmod     rix,
  @{bin}/cmp       rix,
  @{bin}/mktemp    rix,
  @{bin}/mv        rix,
  @{bin}/rm        rix,
  @{bin}/sort      rix,

  /etc/issue.d/{,**} r,
  /etc/sysconfig/issue-generator r,

  @{run}/agetty.reload w,
  @{run}/issue rw,
  @{run}/issue.@{rand10} rw,
  @{run}/issue.d/{,**} r,

  /dev/tty rw,

  include if exists <local/issue-generator>
}

# vim:syntax=apparmor
