Compare commits

17 Commits
Author SHA1 Message Date
gitadmin 61ddd3428c Update README.md 2018-09-11 14:17:41 +03:00
gitadmin 715dfad01e update README 2017-12-10 17:41:30 +03:00
gitadmin 06a2616595 . 2017-12-10 17:40:42 +03:00
gitadmin 311ca3bdad update README 2017-12-10 17:39:48 +03:00
gitadmin 7ec3f80305 PostgreSQL support 2017-12-10 16:53:51 +03:00
gitadmin 61e9aed4be roundcube 1.3 support 2017-12-10 16:46:25 +03:00
gitadmin 2afdc83164 Russian locale 2017-12-10 16:42:09 +03:00
stalks 45aa6e504b Merge pull request #1 from stalks/develop
Catchup
2013-02-21 13:28:00 -08:00
Steve Allison 7e66141336 Match comment to function 2013-02-21 21:25:56 +00:00
Steve Allison e0bc336890 Reformat config file a little 2013-02-21 21:25:11 +00:00
Steve Allison 2f90243356 Fix debug output for check period 2013-02-21 19:19:51 +00:00
Steve Allison 964c53427d Update README with roundcube version requirement 2013-02-21 19:15:26 +00:00
Steve Allison 4300072952 Update README with roundcube version requirement 2013-02-21 19:15:04 +00:00
Steve Allison 094628753f Add image to readme 2013-02-21 19:13:33 +00:00
Steve Allison d6a5e8a800 Add image to readme 2013-02-21 19:11:51 +00:00
Steve Allison 746f590746 Update readme, TODO log ui 2013-02-21 19:07:05 +00:00
Steve Allison eb878c1332 Update readme, TODO log ui 2013-02-21 19:03:30 +00:00
6 changed files with 35 additions and 8 deletions

No files matched your search

+10 -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 1.3 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
@@ -30,8 +34,13 @@ Create an issue ticket at https://github.com/stalks/roundcube-defense/issues
HISTORY
--------------------
10.12.2017 -- Version 1.0
21.02.2013 -- Version 0.1
- initial release, functional, still bug checking
===================
Created by Steve Allison - https://www.nooblet.org/
Forked and upgraded by Inpos
+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';
+5 -5
View File
@@ -46,7 +46,7 @@ class defense extends rcube_plugin {
*/
private function debug($string) {
if (!$this->debugEnabled) { return; }
write_log($this->logfile, $this->ipaddr . " # " . $string);
rcube::write_log($this->logfile, $this->ipaddr . " # " . $string);
}
/**
* Check if IP is matched against all IPs in array,
@@ -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
@@ -148,7 +148,7 @@ class defense extends rcube_plugin {
// I can't seem to try/catch database entries so I have no details regarding error
$string = "Error communicating with database.";
$this->debug($string);
write_log('error', 'plugin::defense: ' . $string);
rcube::write_log('error', 'plugin::defense: ' . $string);
}
/**
* Return true if IP matches config whitelist
@@ -258,7 +258,7 @@ class defense extends rcube_plugin {
$this->debugEnabled = $this->rc->config->get('defense_debug_enabled', false);
// set client ip
$this->ipaddr = rcmail_remote_ip();
$this->ipaddr = rcube_utils::remote_ip();
// Roundcube event hooks
$this->add_hook('template_object_loginform', array($this, 'hookLoginForm'));
@@ -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
+6
View File
@@ -0,0 +1,6 @@
<?php
$labels = array();
$labels['ipbanned'] = 'Вы заблокированы на %s';
?>
+1 -1
View File
@@ -8,7 +8,7 @@ CREATE TABLE IF NOT EXISTS `defense` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`epoch` int(11) NOT NULL,
`type` tinyint(4) NOT NULL,
`ipaddr` varchar(40) NOT NULL,
`ipaddr` varchar(256) NOT NULL,
`data` text NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=30 ;
+12
View File
@@ -0,0 +1,12 @@
CREATE SEQUENCE defense_seq;
CREATE TABLE IF NOT EXISTS defense (
id int NOT NULL DEFAULT NEXTVAL ('defense_seq'),
epoch int NOT NULL,
type smallint NOT NULL,
ipaddr varchar(256) NOT NULL,
data text NOT NULL,
PRIMARY KEY (id)
) ;
ALTER SEQUENCE defense_seq RESTART WITH 30;