Well, I did exactly as shown in your link
http://www.rojtberg.net/711/secure-owncloud-server/
but it's still not blocking anything. In my fail2ban log there are some errors from iptables where I didnt found anything helpful on google.
It looks like that (I copied just the last attempt, the regular file is now around 700 lines but repeating this):
Code:
2015-02-02 20:49:57,768 fail2ban.server [5504]: ERROR Unable to remove PID file: [Errno 2] No such file or directory: '/va
r/run/fail2ban/fail2ban.pid'
2015-02-02 20:49:57,768 fail2ban.server [5504]: INFO Exiting Fail2ban
2015-02-02 20:55:29,673 fail2ban.server [9350]: INFO Changed logging target to /var/log/fail2ban.log for Fail2ban v0.9.1
2015-02-02 20:55:29,675 fail2ban.database [9350]: INFO Connected to fail2ban persistent database '/var/db/fail2ban/fail2ban
.sqlite3'
2015-02-02 20:55:29,730 fail2ban.jail [9350]: INFO Creating new jail 'owncloud'
2015-02-02 20:55:29,741 fail2ban.jail [9350]: INFO Jail 'owncloud' uses poller
2015-02-02 20:55:29,784 fail2ban.filter [9350]: INFO Set jail log file encoding to US-ASCII
2015-02-02 20:55:29,784 fail2ban.jail [9350]: INFO Initiated 'polling' backend
2015-02-02 20:55:29,862 fail2ban.filter [9350]: INFO Added logfile = /var/log/owncloud.log
2015-02-02 20:55:29,864 fail2ban.filter [9350]: INFO Set maxRetry = 3
2015-02-02 20:55:29,866 fail2ban.filter [9350]: INFO Set jail log file encoding to US-ASCII
2015-02-02 20:55:29,867 fail2ban.actions [9350]: INFO Set banTime = 2592000
2015-02-02 20:55:29,868 fail2ban.filter [9350]: INFO Set findtime = 600
2015-02-02 20:55:29,932 fail2ban.transmitter [9350]: WARNING Command ['start', 'owncloud'] has failed. Received TypeError("'NoneT
ype' object has no attribute '__getitem__'",)
2015-02-02 20:55:29,993 fail2ban.action [9350]: ERROR iptables -N f2b-owncloud
iptables -A f2b-owncloud -j RETURN
iptables -I INPUT -p tcp -m multiport --dports 80,443 -j f2b-owncloud -- stdout: ''
2015-02-02 20:55:29,993 fail2ban.action [9350]: ERROR iptables -N f2b-owncloud
iptables -A f2b-owncloud -j RETURN
iptables -I INPUT -p tcp -m multiport --dports 80,443 -j f2b-owncloud -- stderr: 'iptables: not found\niptables: not found\niptables
: not found\n'
2015-02-02 20:55:29,993 fail2ban.action [9350]: ERROR iptables -N f2b-owncloud
iptables -A f2b-owncloud -j RETURN
iptables -I INPUT -p tcp -m multiport --dports 80,443 -j f2b-owncloud -- returned 127
2015-02-02 20:55:29,994 fail2ban.action [9350]: INFO HINT on 127: "Command not found". Make sure that all commands in 'i
ptables -N f2b-owncloud\niptables -A f2b-owncloud -j RETURN\niptables -I INPUT -p tcp -m multiport --dports 80,443 -j f2b-owncloud'
are in the PATH of fail2ban-server process (grep -a PATH= /proc/`pidof -x fail2ban-server`/environ). You may want to start "fail2ban
-server -f" separately, initiate it with "fail2ban-client reload" in another shell session and observe if additional informative err
or messages appear in the terminals.
2015-02-02 20:55:29,994 fail2ban.actions [9350]: ERROR Failed to start jail 'owncloud' action 'iptables-multiport': Error s
tarting action
My filter seems to work via fail2ban-regex and when I fail to login enough there are entries like this:
Code:
2015-02-02 21:08:08,688 fail2ban.filter [9350]: INFO Log rotation detected for /var/log/owncloud.log
2015-02-02 21:08:08,689 fail2ban.filter [9350]: INFO [owncloud] Found 10.0.0.20
2015-02-02 21:08:11,743 fail2ban.filter [9350]: INFO [owncloud] Found 10.0.0.20
2015-02-02 21:08:13,793 fail2ban.filter [9350]: INFO [owncloud] Found 10.0.0.20
2015-02-02 21:08:14,758 fail2ban.actions [9350]: NOTICE [owncloud] Ban 10.0.0.20
2015-02-02 21:08:14,864 fail2ban.action [9350]: ERROR iptables -n -L INPUT | grep -q 'f2b-owncloud[ \t]' -- stdout: ''
2015-02-02 21:08:14,864 fail2ban.action [9350]: ERROR iptables -n -L INPUT | grep -q 'f2b-owncloud[ \t]' -- stderr: 'iptab
les: not found\n'
2015-02-02 21:08:14,865 fail2ban.action [9350]: ERROR iptables -n -L INPUT | grep -q 'f2b-owncloud[ \t]' -- returned 1
2015-02-02 21:08:14,865 fail2ban.CommandAction [9350]: ERROR Invariant check failed. Trying to restore a sane environment
2015-02-02 21:08:14,972 fail2ban.action [9350]: ERROR iptables -D INPUT -p tcp -m multiport --dports 80,443 -j f2b-ownclou
d
iptables -F f2b-owncloud
iptables -X f2b-owncloud -- stdout: ''
2015-02-02 21:08:14,972 fail2ban.action [9350]: ERROR iptables -D INPUT -p tcp -m multiport --dports 80,443 -j f2b-ownclou
d
iptables -F f2b-owncloud
iptables -X f2b-owncloud -- stderr: 'iptables: not found\niptables: not found\niptables: not found\n'
2015-02-02 21:08:14,973 fail2ban.action [9350]: ERROR iptables -D INPUT -p tcp -m multiport --dports 80,443 -j f2b-ownclou
d
iptables -F f2b-owncloud
iptables -X f2b-owncloud -- returned 127
2015-02-02 21:08:14,973 fail2ban.action [9350]: INFO HINT on 127: "Command not found". Make sure that all commands in 'i
ptables -D INPUT -p tcp -m multiport --dports 80,443 -j f2b-owncloud\niptables -F f2b-owncloud\niptables -X f2b-owncloud' are in the
PATH of fail2ban-server process (grep -a PATH= /proc/`pidof -x fail2ban-server`/environ). You may want to start "fail2ban-server -f
" separately, initiate it with "fail2ban-client reload" in another shell session and observe if additional informative error message
s appear in the terminals.
2015-02-02 21:08:14,973 fail2ban.actions [9350]: ERROR Failed to execute ban jail 'owncloud' action 'iptables-multiport' in
fo 'CallingMap({'ipjailmatches': <function <lambda> at 0x803eb0ed8>, 'matches': u'{"app":"core","message":"Login failed: \'a\' (Remo
te IP: \'10.0.0.20\', X-Forwarded-For: \'\')","level":2,"time":"2015-02-02T21:08:07+01:00"}\n{"app":"core","message":"Login failed:
\'a\' (Remote IP: \'10.0.0.20\', X-Forwarded-For: \'\')","level":2,"time":"2015-02-02T21:08:11+01:00"}\n{"app":"core","message":"Log
in failed: \'a\' (Remote IP: \'10.0.0.20\', X-Forwarded-For: \'\')","level":2,"time":"2015-02-02T21:08:13+01:00"}', 'ip': '10.0.0.20
', 'ipmatches': <function <lambda> at 0x803eb0de8>, 'ipfailures': <function <lambda> at 0x803eb0f50>, 'time': 1422907694.758043, 'fa
ilures': 3, 'ipjailfailures': <function <lambda> at 0x803ed5050>})': Error stopping action
Maybe you can help me, I tried everything I found via google (thats why the complete file is around 700 lines).
Greetings