Package: geoclue-2.0
Version: 2.8.2-1
Severity: normal
Tags: patch

Dear Maintainer,

The AppArmor profile shipped in debian/local/usr.libexec.geoclue lets
GeoClue talk only to the top-level ModemManager object, and only in the
send direction:

  # use ModemManager
  dbus send
       bus=system
       path=/org/freedesktop/ModemManager1
       
interface={org.freedesktop.DBus.ObjectManager,org.freedesktop.DBus.Properties},

GeoClue's modem sources need more than that. They call
org.freedesktop.ModemManager1.Modem.Location (Setup, SetGpsRefreshRate,
GetLocation) on the modem objects /org/freedesktop/ModemManager1/Modem/N,
and they receive PropertiesChanged and ObjectManager signals from
ModemManager. With the profile in enforce mode and D-Bus mediation
active, all of these are denied.

Effect

GeoClue cannot enable GPS or 3GPP (cell) location on any modem. No error
is shown to the user: GeoClue falls back to the next source, so an
application gets a GeoIP position with an accuracy of 25 km instead of
the GPS position, even though the modem has a fix.

Where it was seen

I found this on Ubuntu 26.04.1 (geoclue-2.0 2.7.2-2ubuntu3, kernel
7.3.0-9003-oem, ModemManager 1.25.95) with an MBIM LTE modem that has a
GNSS receiver. "dpkg -V geoclue-2.0" reports no modified file, and the
ModemManager rule in that package is identical to the one in Debian
master (2.8.2-1), lines 73 to 77, which is why I report it here first.
I have not tested a Debian installation; on a system where D-Bus
mediation is not active the rule is not enforced and the problem does
not show.

How to reproduce

1. A modem with GPS support managed by ModemManager, location services
   enabled, the geoclue profile in enforce mode.
2. Run: /usr/libexec/geoclue-2.0/demos/where-am-i -a 8 -t 90
3. Result: one location, "ipf fallback (from GeoIP data)", 25000 m.
   The journal shows (shortened, full lines attached):

   geoclue: Failed to enable GPS: 
GDBus.Error:org.freedesktop.DBus.Error.AccessDenied:
     An AppArmor policy prevents this sender from sending this message to this 
recipient
   apparmor="DENIED" operation="dbus_method_call" bus="system"
     path="/org/freedesktop/ModemManager1/Modem/0"
     interface="org.freedesktop.ModemManager1.Modem.Location" member="Setup"
     mask="send" label="/usr/libexec/geoclue" peer_label="unconfined"
   apparmor="DENIED" operation="dbus_signal" bus="system"
     path="/org/freedesktop/ModemManager1/Modem/0"
     interface="org.freedesktop.DBus.Properties" member="PropertiesChanged"
     mask="receive" label="/usr/libexec/geoclue" peer_label="unconfined"

   In one 90 second run there were 18 such denials (Setup,
   SetGpsRefreshRate, and PropertiesChanged from the modem and bearer
   objects).

Proposed fix

The attached patch gives the ModemManager rule the same form that the
profile already uses for wpa_supplicant and NetworkManager: send and
receive, the service path with its child objects, and the service's own
interfaces next to the standard D-Bus ones.

Test of the fix

With the rule from the patch added through
/etc/apparmor.d/local/usr.libexec.geoclue, on the same boot and with
nothing else changed, the same where-am-i run gave 58 locations, all
"GPS GGA", and no AppArmor denial for ModemManager. Firefox then showed
the GPS position on a map page.

Related: Ubuntu bug https://bugs.launchpad.net/bugs/2030951 has the
history of this profile, including an earlier report of the same
ModemManager denial.

Thank you for maintaining the package.

Br,
Chris


================================================================================================================================================================
This message may contain information which is private, privileged or 
confidential of Compal Electronics, Inc. If you are not the intended recipient 
of this message, please notify the sender and destroy/delete the message. Any 
review, retransmission, dissemination or other use of, or taking of any action 
in reliance upon this information, by persons or entities other than the 
intended recipient is prohibited.
================================================================================================================================================================
Dec 01 17:35:14 HOST geoclue[PID]: Failed to set GPS refresh rate: 
GDBus.Error:org.freedesktop.DBus.Error.AccessDenied: An AppArmor policy 
prevents this sender from sending this message to this recipient; 
type="method_call", sender=":1.345" (uid=N pid=N comm="/usr/libexec/geoclue" 
label="/usr/libexec/geoclue (enforce)") 
interface="org.freedesktop.ModemManager1.Modem.Location" 
member="SetGpsRefreshRate" error name="(unset)" requested_reply="0" 
destination=":1.16" (uid=N pid=N comm="/usr/sbin/ModemManager" 
label="unconfined")
Dec 01 17:35:14 HOST geoclue[PID]: Failed to enable assisted GPS: 
GDBus.Error:org.freedesktop.DBus.Error.AccessDenied: An AppArmor policy 
prevents this sender from sending this message to this recipient; 
type="method_call", sender=":1.345" (uid=N pid=N comm="/usr/libexec/geoclue" 
label="/usr/libexec/geoclue (enforce)") 
interface="org.freedesktop.ModemManager1.Modem.Location" member="Setup" error 
name="(unset)" requested_reply="0" destination=":1.16" (uid=N pid=N 
comm="/usr/sbin/ModemManager" label="unconfined")
Dec 01 17:35:14 HOST kernel: audit: type=1107 audit(T): pid=N uid=N auid=N 
ses=N subj=unconfined msg='apparmor="DENIED" operation="dbus_method_call"  
bus="system" path="/org/freedesktop/ModemManager1/Modem/0" 
interface="org.freedesktop.ModemManager1.Modem.Location" 
member="SetGpsRefreshRate" mask="send" name=":1.16" pid=N 
label="/usr/libexec/geoclue" peer_pid=N peer_label="unconfined" 
exe="/usr/bin/dbus-daemon" sauid=N hostname=? addr=? terminal=?'
Dec 01 17:35:14 HOST kernel: audit: type=1107 audit(T): pid=N uid=N auid=N 
ses=N subj=unconfined msg='apparmor="DENIED" operation="dbus_method_call"  
bus="system" path="/org/freedesktop/ModemManager1/Modem/0" 
interface="org.freedesktop.ModemManager1.Modem.Location" member="Setup" 
mask="send" name=":1.16" pid=N label="/usr/libexec/geoclue" peer_pid=N 
peer_label="unconfined" exe="/usr/bin/dbus-daemon" sauid=N hostname=? addr=? 
terminal=?'
Dec 01 17:35:14 HOST geoclue[PID]: Failed to enable GPS: 
GDBus.Error:org.freedesktop.DBus.Error.AccessDenied: An AppArmor policy 
prevents this sender from sending this message to this recipient; 
type="method_call", sender=":1.345" (uid=N pid=N comm="/usr/libexec/geoclue" 
label="/usr/libexec/geoclue (enforce)") 
interface="org.freedesktop.ModemManager1.Modem.Location" member="Setup" error 
name="(unset)" requested_reply="0" destination=":1.16" (uid=N pid=N 
comm="/usr/sbin/ModemManager" label="unconfined")
Dec 01 17:35:14 HOST geoclue[PID]: Failed to enable 3GPP: 
GDBus.Error:org.freedesktop.DBus.Error.AccessDenied: An AppArmor policy 
prevents this sender from sending this message to this recipient; 
type="method_call", sender=":1.345" (uid=N pid=N comm="/usr/libexec/geoclue" 
label="/usr/libexec/geoclue (enforce)") 
interface="org.freedesktop.ModemManager1.Modem.Location" member="Setup" error 
name="(unset)" requested_reply="0" destination=":1.16" (uid=N pid=N 
comm="/usr/sbin/ModemManager" label="unconfined")
Dec 01 17:35:27 HOST kernel: audit: type=1107 audit(T): pid=N uid=N auid=N 
ses=N subj=unconfined msg='apparmor="DENIED" operation="dbus_signal"  
bus="system" path="/org/freedesktop/ModemManager1/Bearer/0" 
interface="org.freedesktop.DBus.Properties" member="PropertiesChanged" 
name=":1.16" mask="receive" pid=N label="/usr/libexec/geoclue" peer_pid=N 
peer_label="unconfined" exe="/usr/bin/dbus-daemon" sauid=N hostname=? addr=? 
terminal=?'
Dec 01 17:35:34 HOST kernel: audit: type=1107 audit(T): pid=N uid=N auid=N 
ses=N subj=unconfined msg='apparmor="DENIED" operation="dbus_signal"  
bus="system" path="/org/freedesktop/ModemManager1/Modem/0" 
interface="org.freedesktop.DBus.Properties" member="PropertiesChanged" 
name=":1.16" mask="receive" pid=N label="/usr/libexec/geoclue" peer_pid=N 
peer_label="unconfined" exe="/usr/bin/dbus-daemon" sauid=N hostname=? addr=? 
terminal=?'
Dec 01 17:36:44 HOST geoclue[PID]: Failed to disable GPS: 
GDBus.Error:org.freedesktop.DBus.Error.AccessDenied: An AppArmor policy 
prevents this sender from sending this message to this recipient; 
type="method_call", sender=":1.345" (uid=N pid=N comm="/usr/libexec/geoclue" 
label="/usr/libexec/geoclue (enforce)") 
interface="org.freedesktop.ModemManager1.Modem.Location" member="Setup" error 
name="(unset)" requested_reply="0" destination=":1.16" (uid=N pid=N 
comm="/usr/sbin/ModemManager" label="unconfined")
Dec 01 17:36:44 HOST geoclue[PID]: Failed to disable 3GPP: 
GDBus.Error:org.freedesktop.DBus.Error.AccessDenied: An AppArmor policy 
prevents this sender from sending this message to this recipient; 
type="method_call", sender=":1.345" (uid=N pid=N comm="/usr/libexec/geoclue" 
label="/usr/libexec/geoclue (enforce)") 
interface="org.freedesktop.ModemManager1.Modem.Location" member="Setup" error 
name="(unset)" requested_reply="0" destination=":1.16" (uid=N pid=N 
comm="/usr/sbin/ModemManager" label="unconfined")

Attachment: geoclue-apparmor-modemmanager.patch
Description: geoclue-apparmor-modemmanager.patch

Reply via email to