Compare commits

8 Commits
3 changed files with 10 additions and 6 deletions

No files matched your search

+5 -1
View File
@@ -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
![Example](http://i.imgur.com/caJQC3I.png)
INSTALLATION
--------------------
1. Change to plugins/ directory
+1 -1
View File
@@ -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
View File
@@ -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