Owncloud needs more time to detect blocks. It doesn't respond as fast as the other services. Also owncloud logs UTC (since latest update) even though the timezone is not UTC. Also to detect a block, we get a timeout instead of a refused)

This commit is contained in:
Michael Kroes 2016-06-26 14:17:12 +02:00
parent 4cd56df734
commit 02e1598aad
3 changed files with 8 additions and 4 deletions

View File

@ -36,7 +36,7 @@ port = http,https
filter = miab-owncloud filter = miab-owncloud
logpath = STORAGE_ROOT/owncloud/owncloud.log logpath = STORAGE_ROOT/owncloud/owncloud.log
maxretry = 20 maxretry = 20
findtime = 30 findtime = 120
[miab-postfix587] [miab-postfix587]
enabled = true enabled = true

View File

@ -126,6 +126,7 @@ if [ ! -f $STORAGE_ROOT/owncloud/owncloud.db ]; then
'mail_from_address' => 'owncloud', 'mail_from_address' => 'owncloud',
'mail_domain' => '$PRIMARY_HOSTNAME', 'mail_domain' => '$PRIMARY_HOSTNAME',
'logtimezone' => '$TIMEZONE', 'logtimezone' => '$TIMEZONE',
'logdateformat' => 'Y-m-d H:i:s',
); );
?> ?>
EOF EOF
@ -179,6 +180,7 @@ include("$STORAGE_ROOT/owncloud/config.php");
\$CONFIG['mail_from_address'] = 'administrator'; # just the local part, matches our master administrator address \$CONFIG['mail_from_address'] = 'administrator'; # just the local part, matches our master administrator address
\$CONFIG['logtimezone'] = '$TIMEZONE'; \$CONFIG['logtimezone'] = '$TIMEZONE';
\$CONFIG['logdateformat'] = 'Y-m-d H:i:s';
echo "<?php\n\\\$CONFIG = "; echo "<?php\n\\\$CONFIG = ";
var_export(\$CONFIG); var_export(\$CONFIG);

View File

@ -86,6 +86,8 @@ def http_test(url, expected_status, postdata=None, qsargs=None, auth=None):
data=postdata, data=postdata,
headers={'User-Agent': 'Mail-in-a-Box fail2ban tester'}, headers={'User-Agent': 'Mail-in-a-Box fail2ban tester'},
timeout=8) timeout=8)
except requests.exceptions.ConnectTimeout as e:
raise IsBlocked()
except requests.exceptions.ConnectionError as e: except requests.exceptions.ConnectionError as e:
if "Connection refused" in str(e): if "Connection refused" in str(e):
raise IsBlocked() raise IsBlocked()
@ -180,14 +182,14 @@ if __name__ == "__main__":
# IMAP # IMAP
run_test(imap_test, [], 20, 30, 4) run_test(imap_test, [], 20, 30, 4)
# Mail-in-a-Box contorl panel # Mail-in-a-Box control panel
run_test(http_test, ["/admin/me", 200], 20, 30, 1) run_test(http_test, ["/admin/me", 200], 20, 30, 1)
# Munin via the Mail-in-a-Box contorl panel # Munin via the Mail-in-a-Box control panel
run_test(http_test, ["/admin/munin/", 401], 20, 30, 1) run_test(http_test, ["/admin/munin/", 401], 20, 30, 1)
# ownCloud # ownCloud
run_test(http_test, ["/cloud/remote.php/webdav", 401, None, None, ["aa", "aa"]], 20, 30, 1) run_test(http_test, ["/cloud/remote.php/webdav", 401, None, None, ["aa", "aa"]], 20, 120, 1)
# restart fail2ban so that this client machine is no longer blocked # restart fail2ban so that this client machine is no longer blocked
restart_fail2ban_service(final=True) restart_fail2ban_service(final=True)