# apparmor.d - Full set of apparmor profiles
# Copyright (C) 2022 Jeroen Rijken
# SPDX-License-Identifier: GPL-2.0-only

abi <abi/4.0>,

include <tunables/global>

@{exec_path} = @{bin}/lvm
profile lvm @{exec_path} flags=(attach_disconnected) {
  include <abstractions/base>
  include <abstractions/bus-system>
  include <abstractions/consoles>
  include <abstractions/disks-write>

  capability dac_read_search,
  capability fowner,
  capability mknod,
  capability net_admin,
  capability sys_admin,
  capability sys_nice,
  capability sys_rawio,

  ptrace (read),

  mqueue r type=posix /,

  @{exec_path} rm,

  @{etc_rw}/lvm/** rwkl,
  /etc/multipath.conf r,

  @{run}/lock/ rw,
  @{run}/lock/lvm/ rw,
  @{run}/lock/lvm/* rwk,
  @{run}/lvm/** rwk,

  @{sys}/bus/ r,
  @{sys}/class/ r,
  @{sys}/devices/virtual/bdi/**/read_ahead_kb r,
  @{sys}/devices/virtual/dmi/id/product_uuid r,

        @{PROC}/@{pid}/cmdline r,
        @{PROC}/@{pid}/fd/ r,
        @{PROC}/devices r,
  owner @{PROC}/@{pid}/mounts r,

  /dev/**/ r,
  /dev/mapper/control rw,

  include if exists <local/lvm>
}

# vim:syntax=apparmor
