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

abi <abi/4.0>,

include <tunables/global>

@{exec_path} = @{bin}/speech-dispatcher
@{att} = ""
profile speech-dispatcher /{,usr/}bin/speech-dispatcher flags=(complain) {
  include <abstractions/base-strict>
  include <abstractions/audio-client>
  include <abstractions/bus-session>
  include <abstractions/consoles>
  include <abstractions/nameservice-strict>

  network inet stream,
  network inet6 stream,

  @{exec_path} mr,

  @{sh_path} ix,
  @{lib}/speech-dispatcher-modules/* ix,
  @{lib}/speech-dispatcher/** r,
  @{lib}/speech-dispatcher/speech-dispatcher-modules/* ix,

  /etc/machine-id r,
  /etc/speech-dispatcher/{,**} r,

  owner @{user_config_dirs}/speech-dispatcher/{,**} r,

  owner @{run}/user/@{uid}/speech-dispatcher/ rw,
  owner @{run}/user/@{uid}/speech-dispatcher/** rwk,

  owner /dev/shm/sem.@{rand6} rw,
  owner /dev/shm/sem.speechd-modules-dummy-@{int} rwl -> /dev/shm/sem.@{rand6},

  include if exists <local/speech-dispatcher>
}

# vim:syntax=apparmor
