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

abi <abi/4.0>,

include <tunables/global>

@{exec_path} = @{lib}/systemd/system-generators/systemd-getty-generator
profile systemd-generator-getty /{,usr/}lib{,exec,32,64}/systemd/system-generators/systemd-getty-generator   flags=(attach_disconnected,complain) {
  include <abstractions/base>
  include <abstractions/consoles>
  include <abstractions/common/systemd>

  @{exec_path} mr,

  @{run}/systemd/generator/getty.target.wants/ w,
  @{run}/systemd/generator/getty.target.wants/serial-getty@ttyS@{int}.service w,

  @{sys}/devices/virtual/tty/console/active r,

  @{PROC}/@{pid}/cgroup r,

  owner /dev/ttyS@{int} rw,

  include if exists <local/systemd-generator-getty>
}