From 24b87fa579671391d54b746ef665ff82769edaa8 Mon Sep 17 00:00:00 2001 From: Steve Allison Date: Wed, 20 Feb 2013 21:20:42 +0000 Subject: [PATCH] Add config variable to set ban type --- config.inc.php.dist | 7 +++++++ defense.php | 1 + 2 files changed, 8 insertions(+) diff --git a/config.inc.php.dist b/config.inc.php.dist index c16398b..5f467cb 100644 --- a/config.inc.php.dist +++ b/config.inc.php.dist @@ -40,6 +40,13 @@ // Default ban period $rcmail_config['defense_ban_period'] = 120; + /* Ban with HTTP status + * If set to true: Banned IPs are treated as blacklisted, and will receive + * a HTTP 403 Forbidden response instead of a login screen + * If set to false (default): Banned IPs receive login screen with red warning + * showing duration of ban remaining */ + $rcmail_config['defense_ban_httpstatus'] = false; + // Repeated offenders have their banperiod multiplied, set to 1 to not multiply $rcmail_config['defense_repeat_multiplier'] = 4; diff --git a/defense.php b/defense.php index 042d166..4f6b5a2 100644 --- a/defense.php +++ b/defense.php @@ -76,6 +76,7 @@ class defense extends rcube_plugin { $this->fail_max = $this->rc->config->get('defense_fail_max', 5); $this->fail_reset = $this->rc->config->get('defense_fail_reset', 600); $this->ban_period = $this->rc->config->get('defense_ban_period', 120); + $this->ban_httpstatus = $this->rc->config->get('defense_ban_httpstatus', false); $this->repeat_multiplier = $this->rc->config->get('defense_repeat_multiplier', 4); $this->repeat_reset = $this->rc->config->get('defense_repeat_reset', 86400); $this->db_table = $this->rc->config->get('defense_db_table', 'defense');