# 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} = @{lib}/localsearch-control-3
@{att} = ""
profile localsearch-control /{,usr/}lib{,exec,32,64}/localsearch-control-3 flags=(complain) {
  include <abstractions/base-strict>
  include <abstractions/bus-session>

  include <abstractions/bus/session/own>

  dbus bind bus=session name=org.freedesktop.Tracker3.Miner.Files.Control{,.*},
  dbus receive bus=session path=/org/freedesktop/Tracker3/Miner/Files/Control{,/**}
       interface=org.freedesktop.Tracker3.Miner.Files.Control{,.*}
       peer=(name="@{busname}"),
  dbus send bus=session path=/org/freedesktop/Tracker3/Miner/Files/Control{,/**}
       interface=org.freedesktop.Tracker3.Miner.Files.Control{,.*}
       peer=(name="{@{busname},org.freedesktop.DBus}"),
  dbus (send receive) bus=session path=/org/freedesktop/Tracker3/Miner/Files/Control{,/**}
       interface=org.freedesktop.DBus.Properties
       member={Get,GetAll,Set,PropertiesChanged}
       peer=(name="{@{busname},org.freedesktop.DBus}"),
  dbus receive bus=session path=/org/freedesktop/Tracker3/Miner/Files/Control{,/**}
       interface=org.freedesktop.DBus.Introspectable
       member=Introspect
       peer=(name="@{busname}"),
  dbus receive bus=session path=/org/freedesktop/Tracker3/Miner/Files/Control{,/**}
       interface=org.freedesktop.DBus.ObjectManager
       member=GetManagedObjects
       peer=(name="{@{busname},org.freedesktop.Tracker3.Miner.Files.Control{,.*}}"),
  dbus send bus=session path=/org/freedesktop/Tracker3/Miner/Files/Control{,/**}
       interface=org.freedesktop.DBus.ObjectManager
       member={InterfacesAdded,InterfacesRemoved}
       peer=(name="{@{busname},org.freedesktop.DBus}"),

  @{exec_path} mr,

  include if exists <local/localsearch-control>
}

# vim:syntax=apparmor
