# apparmor.d - Full set of apparmor profiles
# Copyright (C) 2020-2022 Mikhail Morfikov
# Copyright (C) 2021-2024 Alexandre Pujol <alexandre@pujol.io>
# SPDX-License-Identifier: GPL-2.0-only

abi <abi/3.0>,

include <tunables/global>

@{exec_path} = @{bin}/systemd-detect-virt
profile systemd-detect-virt @{exec_path} flags=(attach_disconnected) {
  include <abstractions/base>
  include <abstractions/consoles>
  include <abstractions/common/systemd>

  capability net_admin,

  network netlink raw,

  @{exec_path} mr,

  @{run}/cloud-init/ds-identify.log w,
  @{run}/host/container-manager r,
  @{run}/systemd/notify w,

  @{sys}/devices/virtual/dmi/id/bios_vendor r,
  @{sys}/devices/virtual/dmi/id/board_vendor r,
  @{sys}/devices/virtual/dmi/id/product_name r,
  @{sys}/devices/virtual/dmi/id/product_version r,
  @{sys}/devices/virtual/dmi/id/sys_vendor r,
  @{sys}/firmware/dmi/entries/*/raw r,

  include if exists <local/systemd-detect-virt>
}
