Fail2ban not working on apache Ubuntu

apache-2.2fail2ban

Nothing happens even though it detects in the logs. It does not block the IP. It works fine forVSFTP but not for apache. Please help. You can see the config and log below.

jail.local config file:

[apache]
enabled  = true
port     = 80,443
filter   = apache-auth
logpath  = /var/log/apache*/*error.log
maxretry = 2

    # default action is now multiport, so apache-multiport jail was left
    # for compatibility with previous (<0.7.6-2) releases
[apache-multiport]

enabled   = true
port      = http,https
filter    = apache-auth
logpath   = /var/log/apache*/*error.log
maxretry  = 6

Apache-Auth config file

[INCLUDES]
before = apache-common.conf
[Definition]
failregex = ^%(_apache_error_client)s user .* (authentication failure|not found|password mismatch)\s*$
ignoreregex =

Apache-Error Log:

[Fri Jul 25 11:31:20.758218 2014] [auth_basic:error] [pid 4959] [client 8.8.8.8:12767] AH01617: user GOLD: authentication failure for "/Folder": Password Mismatch
[Fri Jul 25 11:31:22.941978 2014] [auth_basic:error] [pid 4959] [client 8.8.8.8:12767] AH01618: user asd not found: /Folder

fail2ban-regex result:

Running tests
=============
Use regex file : /etc/fail2ban/filter.d/apache-auth.conf
Use log file   : /var/log/apache2/error.log
Matched time template MONTH Day Hour:Minute:Second
Matched time template MONTH Day Hour:Minute:Second
Matched time template MONTH Day Hour:Minute:Second
Matched time template MONTH Day Hour:Minute:Second
Matched time template MONTH Day Hour:Minute:Second
Results
=======
Failregex: 0 total
Ignoreregex: 0 total
Summary
=======
Sorry, no match

Fail2Ban Log:

    2014-07-25 15:16:49,010 fail2ban.filter.datedetector: DEBUG  Matched time template MONTH Day Hour:Minute:Second

    2014-07-25 15:16:49,010 fail2ban.filter.datedetector: DEBUG  Sorting the template list

    2014-07-25 15:16:49,011 fail2ban.filter.datedetector: DEBUG  Winning template: MONTH Day Hour:Minute:Second with 994 hits

    2014-07-25 15:16:52,214 fail2ban.filter : DEBUG  Default Callback for Event: <Event dir=False mask=0x2 maskname=IN_MODIFY name='' path=/var/log/apache2/error.log pathname=/var/log/apache2/error.log wd=2 >

    2014-07-25 15:16:52,214 fail2ban.filter.datedetector: DEBUG  Matched time template MONTH Day Hour:Minute:Second

    2014-07-25 15:16:52,215 fail2ban.filter.datedetector: DEBUG  Sorting the template list

    2014-07-25 15:16:52,215 fail2ban.filter.datedetector: DEBUG  Winning template: MONTH Day Hour:Minute:Second with 995 hits

    2014-07-25 15:16:52,215 fail2ban.filter : DEBUG  Default Callback for Event: <Event dir=False mask=0x2 maskname=IN_MODIFY name='' path=/var/log/apache2/error.log pathname=/var/log/apache2/error.log wd=2 >

    2014-07-25 15:16:52,215 fail2ban.filter.datedetector: DEBUG  Matched time template MONTH Day Hour:Minute:Second

    2014-07-25 15:16:52,215 fail2ban.filter.datedetector: DEBUG  Sorting the template list

    2014-07-25 15:16:52,215 fail2ban.filter.datedetector: DEBUG  Winning template: MONTH Day Hour:Minute:Second with 995 hits

    2014-07-25 15:16:52,215 fail2ban.filter : DEBUG  Default Callback for Event: <Event dir=False mask=0x2 maskname=IN_MODIFY name='' path=/var/log/apache2/error.log pathname=/var/log/apache2/error.log wd=2 >

    2014-07-25 15:16:52,216 fail2ban.filter.datedetector: DEBUG  Matched time template MONTH Day Hour:Minute:Second

    2014-07-25 15:16:52,216 fail2ban.filter.datedetector: DEBUG  Sorting the template list

    2014-07-25 15:16:52,216 fail2ban.filter.datedetector: DEBUG  Winning template: MONTH Day Hour:Minute:Second with 995 hits

    2014-07-25 15:16:54,790 fail2ban.filter : DEBUG  Default Callback for Event: <Event dir=False mask=0x2 maskname=IN_MODIFY name='' path=/var/log/apache2/error.log pathname=/var/log/apache2/error.log wd=2 >

    2014-07-25 15:16:54,791 fail2ban.filter.datedetector: DEBUG  Matched time template MONTH Day Hour:Minute:Second

    2014-07-25 15:16:54,791 fail2ban.filter.datedetector: DEBUG  Sorting the template list

    2014-07-25 15:16:54,791 fail2ban.filter.datedetector: DEBUG  Winning template: MONTH Day Hour:Minute:Second with 996 hits

    2014-07-25 15:16:54,791 fail2ban.filter : DEBUG  Default Callback for Event: <Event dir=False mask=0x2 maskname=IN_MODIFY name='' path=/var/log/apache2/error.log pathname=/var/log/apache2/error.log wd=2 >

    2014-07-25 15:16:54,792 fail2ban.filter.datedetector: DEBUG  Matched time template MONTH Day Hour:Minute:Second

    2014-07-25 15:16:54,792 fail2ban.filter.datedetector: DEBUG  Sorting the template list

    2014-07-25 15:16:54,792 fail2ban.filter.datedetector: DEBUG  Winning template: MONTH Day Hour:Minute:Second with 996 hits

    2014-07-25 15:16:54,792 fail2ban.filter : DEBUG  Default Callback for Event: <Event dir=False mask=0x2 maskname=IN_MODIFY name='' path=/var/log/apache2/error.log pathname=/var/log/apache2/error.log wd=2 >

Best Answer

Related Topic