# 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>

profile default-sudo {
  include <abstractions/base>
  include <abstractions/app/sudo>

  capability chown,
  capability mknod,
  capability sys_ptrace,

  network inet dgram,
  network inet6 dgram,

  ptrace (read),

  @{bin}/su       mr,

  @{bin}/**       Px,
  @{lib}/**       Px,
  /opt/*/**       Px,

        /var/db/sudo/lectured/ r,
        /var/lib/extrausers/shadow r,
        /var/lib/sudo/lectured/ r,
  owner /var/db/sudo/lectured/@{uid} rw,
  owner /var/lib/sudo/lectured/* rw,

  owner @{HOME}/.sudo_as_admin_successful rw,

  @{run}/ r,
  @{run}/systemd/sessions/* r,

  include if exists <local/default-sudo>
}

# vim:syntax=apparmor
