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

abi <abi/4.0>,

include <tunables/global>

@{exec_path} = @{bin}/mumble
profile mumble @{exec_path} {
  include <abstractions/base>
  include <abstractions/audio-client>
  include <abstractions/desktop>
  include <abstractions/fontconfig-cache-read>
  include <abstractions/graphics>
  include <abstractions/nameservice-strict>
  include <abstractions/qt5-compose-cache-write>
  include <abstractions/qt5-settings-write>
  include <abstractions/ssl_certs>
  include <abstractions/user-download-strict>
  include <abstractions/user-download-strict>

  network inet dgram,
  network inet6 dgram,
  network inet stream,
  network inet6 stream,
  network netlink dgram,
  network netlink raw,

  @{exec_path} mrix,

  @{bin}/lsb_release  rPx -> lsb_release,
  @{browsers_path}    rPx,
  @{open_path}        rPx -> child-open,

  /etc/fstab r,
  /etc/machine-id r,
  /var/lib/dbus/machine-id r,

  owner @{HOME}/ r,
  owner @{HOME}/.jackdrc r,
  owner @{HOME}/.MumbleOverlayPipe rw,
  owner @{HOME}/.MumbleSocket rw,
  owner @{user_config_dirs}/Mumble/ rw,
  owner @{user_config_dirs}/Mumble/** rwkl -> @{user_config_dirs}/Mumble/#@{int},
  owner @{user_share_dirs}/Mumble/ rw,
  owner @{user_share_dirs}/Mumble/** rwk,

  owner @{run}/user/@{uid}/MumbleSocket rw,
  owner @{run}/user/@{uid}/MumbleOverlayPipe rw,

  deny owner @{PROC}/@{pid}/cmdline r,
       owner @{PROC}/@{pid}/fd/ r,
       owner @{PROC}/@{pid}/mountinfo r,
       owner @{PROC}/@{pid}/mounts r,
  deny       @{PROC}/sys/kernel/random/boot_id r,

  /dev/shm/MumbleLink.@{int} rw,
  /dev/shm/#@{int} rw,

  # file_inherit
  owner /dev/tty@{int} rw,

  include if exists <local/mumble>
}

# vim:syntax=apparmor
