Repeater, room server, sensor: passwords can no longer be guessed over the air at full speed, and a replayed login no longer floods a reply

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
tthandClaude Opus 5.5 committed 2026-11-18 13:03:59 +01:00
1 parent de92ca9ba2
commit dbdae14566
8 files changed
+123

No files matched your search

+9
View File
@@ -374,11 +374,20 @@ uint8_t SensorMesh::handleLoginReq(const mesh::Identity& sender, const uint8_t*
#endif
return 0;
}
// CUSTOM (TeTeHacko): a blank login has a replay floor too -- replayed, it
// gained nothing, but each copy made us send a reply.
if (sender_timestamp <= client->last_timestamp) return 0;
acl.persistTimestamp(client, sender_timestamp, getRTCClock()->getCurrentTime());
client->last_timestamp = sender_timestamp;
} else {
// CUSTOM (TeTeHacko): capped wrong passwords (LoginGuard.h); a known admin is never locked out
ClientInfo* known = acl.getClient(sender.pub_key, PUB_KEY_SIZE);
if (login_guard.locked(millis()) && !(known && known->isAdmin())) return 0;
if (strcmp((char *) data, _prefs.password) != 0) { // check for valid admin password
#if MESH_DEBUG
MESH_DEBUG_PRINTLN("Invalid password: %s", &data[0]);
#endif
login_guard.failed(millis()); // CUSTOM (TeTeHacko)
return 0;
}
+2
View File
@@ -22,6 +22,7 @@
#include <helpers/CommonCLI.h>
#include <helpers/StatsFormatHelper.h>
#include <helpers/ClientACL.h>
#include <helpers/LoginGuard.h> // CUSTOM (TeTeHacko)
#include <helpers/RegionMap.h>
#include <RTClib.h>
#include <target.h>
@@ -149,6 +150,7 @@ private:
unsigned long next_local_advert, next_flood_advert;
NodePrefs _prefs;
ClientACL acl;
LoginGuard login_guard; // CUSTOM (TeTeHacko)
CommonCLI _cli;
uint8_t reply_data[MAX_PACKET_PAYLOAD];
unsigned long dirty_contacts_expiry;