# apparmor.d - Full set of apparmor profiles
# Copyright (C) 2024 Alexandre Pujol <alexandre@pujol.io>
# SPDX-License-Identifier: GPL-2.0-only
# LOGPROF-SUGGEST: no

# Add common attached path to the base abstraction.
#
# !!! warning
#
#     Do not use it manually, It automatically replaces the base abstraction in a
#     profile with the attach_disconnected flag set and the re-attached path enabled.
#

  abi <abi/4.0>,

  include <abstractions/base-strict>

  # Systemd's notification write only socket
  @{att}@{run}/systemd/notify w,
  @{att}/systemd/notify w,

  # Systemd's equivalent of /dev/log
  @{att}@{run}/systemd/journal/dev-log w,
  @{att}/systemd/journal/dev-log w,

  # Systemd native journal API (see sd_journal_print(4))
  @{att}@{run}/systemd/journal/socket w,
  @{att}/systemd/journal/socket w,

  # Nested containers and anything using systemd-cat need this. 'r' shouldn't
  # be required but applications fail without it. journald doesn't leak
  # anything when reading so this is ok.
  @{att}@{run}/systemd/journal/stdout rw,
  @{att}/systemd/journal/stdout rw,

  # Harmless and frequently used
  @{att}/dev/null  rw,

  @{att}/apparmor/.null rw,
  /apparmor/.null rw,

  include if exists <abstractions/attached/base.d>

# vim:syntax=apparmor
