# apparmor.d - Full set of apparmor profiles
# 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} = @{lib}/geoclue @{lib}/geoclue-2.0/demos/agent
profile geoclue @{exec_path} flags=(attach_disconnected) {
  include <abstractions/base>
  include <abstractions/bus-system>
  include <abstractions/bus/fi.w1.wpa_supplicant1>
  include <abstractions/bus/org.freedesktop.Avahi>
  include <abstractions/bus/org.freedesktop.ModemManager1>
  include <abstractions/bus/org.freedesktop.NetworkManager>
  include <abstractions/nameservice-strict>
  include <abstractions/p11-kit>
  include <abstractions/ssl_certs>

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

  #aa:dbus own bus=system name=org.freedesktop.GeoClue2

  dbus send bus=system path=/org/freedesktop/DBus
       interface=org.freedesktop.DBus
       member={GetConnectionUnixUser,GetConnectionUnixProcessID}
       peer=(name=org.freedesktop.DBus, label=dbus-system),

  @{exec_path} mr,

  /usr/share/glib-2.0/schemas/gschemas.compiled r,

  /etc/geoclue/{,**} r,
  /etc/sysconfig/proxy r,

  /var/lib/nscd/services r,
  /var/lib/dbus/machine-id r,

  @{run}/systemd/journal/socket rw,

  @{PROC}/@{pids}/cgroup r,
  @{PROC}/sys/net/ipv{4,6}/conf/all/disable_ipv{4,6} r,

  include if exists <local/geoclue>
}
