Remove old type whitelist
parent
bfa467996f
commit
db6dabedec
|
@ -6,13 +6,10 @@ class RateLimiter {
|
||||||
private $decayMinutes = 15; // Time window in minutes
|
private $decayMinutes = 15; // Time window in minutes
|
||||||
private $ratelimitTable = 'login_attempts';
|
private $ratelimitTable = 'login_attempts';
|
||||||
private $whitelistTable = 'ip_whitelist';
|
private $whitelistTable = 'ip_whitelist';
|
||||||
private $whitelistedIps = []; // Whitelisted IPs
|
|
||||||
private $whitelistedNetworks = []; // Whitelisted CIDR ranges
|
|
||||||
|
|
||||||
public function __construct($database) {
|
public function __construct($database) {
|
||||||
$this->db = $database->getConnection();
|
$this->db = $database->getConnection();
|
||||||
$this->createTablesIfNotExists();
|
$this->createTablesIfNotExists();
|
||||||
$this->loadWhitelist();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Database preparation
|
// Database preparation
|
||||||
|
@ -40,21 +37,6 @@ class RateLimiter {
|
||||||
$this->db->exec($sql);
|
$this->db->exec($sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
// List of IPs to bypass rate limiting
|
|
||||||
private function loadWhitelist() {
|
|
||||||
// FIXME Load from database or config
|
|
||||||
$this->whitelistedIps = [
|
|
||||||
'127.0.0.1', // localhost
|
|
||||||
'::1' // localhost IPv6
|
|
||||||
];
|
|
||||||
|
|
||||||
$this->whitelistedNetworks = [
|
|
||||||
'10.0.0.0/8', // Private network
|
|
||||||
'172.16.0.0/12', // Private network
|
|
||||||
'192.168.0.0/16' // Private network
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check if IP is whitelisted
|
// Check if IP is whitelisted
|
||||||
private function isIpWhitelisted($ip) {
|
private function isIpWhitelisted($ip) {
|
||||||
// Check exact IP match and CIDR ranges
|
// Check exact IP match and CIDR ranges
|
||||||
|
|
Loading…
Reference in New Issue