# apparmor.d - Full set of apparmor profiles
# Copyright (C) 2019-2021 Mikhail Morfikov
# 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}/{tune2fs,e2label}
profile tune2fs @{exec_path} {
  include <abstractions/base>
  include <abstractions/consoles>
  include <abstractions/disks-write>
  include <abstractions/nameservice-strict>
  include <abstractions/private-files-strict>
  include <abstractions/user-download-strict>

  network inet stream,
  network inet6 stream,

  @{exec_path} mr,

  /.ismount-test-file rw,

  # Image files
  owner @{user_img_dirs}/{,**} rw,

  owner @{run}/blkid/blkid.tab{,-@{rand6}} rw,
  owner @{run}/blkid/blkid.tab.old rwl -> @{run}/blkid/blkid.tab,

        @{PROC}/swaps r,
  owner @{PROC}/@{pid}/mounts r,

  include if exists <local/tune2fs>
}

# vim:syntax=apparmor
