Compare commits
8
Commits
defense-0.1
...
develop
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
49812d9746 | ||
|
|
9af9edf09d | ||
|
|
7e66141336 | ||
|
|
e0bc336890 | ||
|
|
2f90243356 | ||
|
|
964c53427d | ||
|
|
d6a5e8a800 | ||
|
|
746f590746 |
No files matched your search
@@ -5,6 +5,8 @@ Protects the Roundcube login page from bruteforce login attempts.
|
||||
Original concept from the roundcube "security" plugin by Lazlo Westerhof.
|
||||
Wanting to fix the shortfalls of that plugin led me to a rewrite.
|
||||
|
||||
Requires Roundcube 0.9-beta or higher.
|
||||
|
||||
FEATURES
|
||||
-------------------
|
||||
- Bruteforce protection
|
||||
@@ -13,9 +15,11 @@ FEATURES
|
||||
- Increasing ban duration by power of 4 for repeated offenders (2m, 8m, 32m, 8h32m, etc)
|
||||
- Whitelist
|
||||
- Blacklist
|
||||
- Failed logins log
|
||||
- Failed logins log [TODO: Logs are in DB, but no interface yet]
|
||||
- Only accessible by administrator
|
||||
|
||||

|
||||
|
||||
INSTALLATION
|
||||
--------------------
|
||||
1. Change to plugins/ directory
|
||||
|
||||
+1
-1
@@ -52,8 +52,8 @@
|
||||
|
||||
// Reset repeat offender count after this number of seconds or
|
||||
// multiply last ban period by <defense_repeat_multiplier>, whichever is greater
|
||||
|
||||
$rcmail_config['defense_repeat_reset'] = 86400;
|
||||
|
||||
// Name of table in database
|
||||
$rcmail_config['defense_db_table'] = 'defense';
|
||||
|
||||
|
||||
+4
-4
@@ -131,7 +131,7 @@ class defense extends rcube_plugin {
|
||||
return (((!preg_match('/^[\.\/:0-9a-f]+$/', strtolower($ip))) || (substr_count($ip, ':') < 2)) ? true : false);
|
||||
}
|
||||
/**
|
||||
* Check string if it is IPv6
|
||||
* Check string if it is IPv4
|
||||
*
|
||||
* @param string
|
||||
* ip address
|
||||
@@ -290,9 +290,9 @@ class defense extends rcube_plugin {
|
||||
die();
|
||||
}
|
||||
|
||||
if ($this->isBanned($this->ipaddr)) {
|
||||
if ($this->ban_httpstatus) { $this->sendForbiddenHeader(); }
|
||||
if (($this->ban_httpstatus) && ($this->isBanned($this->ipaddr))) {
|
||||
$this->debug("IP already banned");
|
||||
$this->sendForbiddenHeader();
|
||||
}
|
||||
|
||||
$this->debug("Sending login form.");
|
||||
@@ -347,7 +347,7 @@ class defense extends rcube_plugin {
|
||||
$this->debug($query . " [" . $result->rowCount() . "]");
|
||||
$row = $result->fetch();
|
||||
if (!$row) { $this->debug("Warning, SQL result empty: $query"); return false; } // No rows? Strange, abort.
|
||||
$this->debug("Found " . $row['n'] . " failed attempts in last " . $this->fail_reset . "s");
|
||||
$this->debug("Found " . $row['n'] . " failed attempts in last " . (time() - $rTime) . "s");
|
||||
if (($row['n'] >= $this->fail_max)) {
|
||||
$this->debug("IP banned.");
|
||||
// This IP is now banned
|
||||
|
||||
Reference in new issue
Block a user