# 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} = @{bin}/multipath
profile multipath @{exec_path} flags=(attach_disconnected) {
  include <abstractions/base>
  include <abstractions/disks-write>

  capability sys_admin,
  capability sys_resource,

  unix (send, receive, connect) type=stream peer=(addr="@/org/kernel/linux/storage/multipathd"),

  @{exec_path} mr,

  /etc/multipath.conf r,
  /etc/multipath/ r,
  /etc/multipath/* rwk,
  /etc/systemd/system/ r,

  @{run}/systemd/system/ r,

  @{sys}/bus/ r,
  @{sys}/class/ r,
  @{sys}/module/*/parameters/multipath r,

  @{PROC}/devices r,
  @{PROC}/sys/fs/nr_open r,

  include if exists <local/multipath>
}

# vim:syntax=apparmor
