Spoofing Geoclue GPS with a Local NMEA Server and Avahi Service
Run a local NMEA server and register it with Avahi to provide accurate GPS to Geoclue.
Deploy the nmea_static_gps_server on your home network and restart Geoclue to use it.
Summary
Geoclue, the Linux location service used by Firefox and Gnome Maps, defaults to a GeoIP database that places users in Toronto with 25 km accuracy. The service can also consume NMEA 0183 data over TCP, discovered via an mDNS service named _nmea‑0183._tcp. A simple Python server can emit $GPRMC and $GPGGA sentences once per second and register itself with Avahi to advertise the service. When Geoclue discovers the NMEA source, it switches to the high‑precision GPS data, reporting coordinates with 0 m accuracy. The server uses a static IP and port 10110, and the Avahi service file is placed in /etc/avahi/services. Restarting Geoclue on the client machine causes it to immediately pick up the spoofed coordinates. This approach works on Linux and also on macOS when Location Services are disabled. Deploying such a server allows developers to test location‑dependent features without relying on external GPS hardware.
Key changes
- Geoclue uses GeoIP with 25 km accuracy by default
- NMEA 0183 over TCP via _nmea‑0183._tcp mDNS service
- Python server emits $GPRMC and $GPGGA lines
- Avahi service file placed in /etc/avahi/services
- Geoclue switches to GPS data with 0 m accuracy
- Server runs on port 10110
- Works on Linux and macOS with Location Services off
- Allows testing location‑dependent features without GPS hardware