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

include <tunables/global>

@{exec_path} = @{bin}/systemd-cryptsetup @{lib}/systemd/systemd-cryptsetup
profile systemd-cryptsetup @{exec_path} {
  include <abstractions/base>
  include <abstractions/common/systemd>
  include <abstractions/disks-write>

  capability dac_read_search,
  capability ipc_lock,
  capability net_admin,
  capability sys_admin,

  @{exec_path} mr,

  /etc/fstab r,

  /var/swapfile rw,  #aa:only whonix

  @{run}/ r,
  @{run}/cryptsetup/ r,
  @{run}/cryptsetup/* rwk,
  @{run}/systemd/ask-password/* rw,
  
  @{sys}/devices/virtual/bdi/*/read_ahead_kb r,
  @{sys}/fs/ r,

        @{PROC}/devices r,
  owner @{PROC}/@{pid}/mountinfo r,

  /dev/loop-control r,  #aa:only whonix

  include if exists <local/systemd-cryptsetup>
}

# vim:syntax=apparmor
