GPS: optional anti-spoofing guard for position and time (GPS_GUARD)
A spoofed GPS signal can move a fixed node anywhere and set its clock to any time; the clock only moves forward, so a time pushed into the future breaks timestamps and replay protection until fixed by hand. With GPS_GUARD, MicroNMEALocationProvider asks a GpsGuard before a fix is stored as the last fix (satellites, HDOP, optional region box, fence around the configured position, jump speed, N stable fixes) and before GPS time is written to the clock (trusted fix current, not before the build date, small steps once the clock is valid, drift-sized after the first sync). Without a trusted fix no live position is reported. CLI in CommonGpsPrefs: 'gps guard', 'gps guard accept', 'gps fence', 'gps ref'; CommonCLI keeps the reference on set lat/lon and gps setloc, resets the time anchor on manual clock sets and adds 'time force'. Ported from #3736 onto the GpsDriver/LocationProvider refactor.
This commit is contained in:
1 parent
017005d1cf
commit
6b3da8a2b1
10 files changed
+466
-2
No files matched your search
@@ -19,7 +19,12 @@ public:
|
||||
virtual uint32_t getGpsPeriod() const = 0;
|
||||
virtual void setGpsPeriod(uint32_t seconds) = 0;
|
||||
|
||||
// Reference position for the anti-spoofing guard (GPS_GUARD), e.g. the configured node position.
|
||||
virtual bool getGuardReference(double& lat, double& lon) const { return false; }
|
||||
|
||||
bool setGpsEnabled(SensorManager& sensors, bool enabled);
|
||||
void applyGuardReference(SensorManager& sensors) const;
|
||||
static void onClockSetManually(SensorManager& sensors);
|
||||
bool setGpsPeriod(SensorManager& sensors, uint32_t seconds);
|
||||
bool apply(SensorManager& sensors) const;
|
||||
bool handleCommand(const char* command, SensorManager& sensors, char* reply);
|
||||
|
||||
Reference in new issue
Block a user