# 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} = @{sbin}/sulogin
@{att} = ""
profile sulogin /{,usr/}{,s}bin/sulogin flags=(complain) {
  include <abstractions/base-strict>
  include <abstractions/consoles>
  include <abstractions/nameservice-strict>

  capability checkpoint_restore,
  capability sys_admin,
  capability sys_tty_config,

  @{exec_path} mr,

  # The shell is not confined on purpose.
  @{bin}/@{shells}     rux,

  /etc/shadow r,

  @{PROC}/consoles r,

  /dev/ r,
  /dev/hvc@{int} rw,
  /dev/ttyS@{int} rw,

  include if exists <local/sulogin>
}

# vim:syntax=apparmor
