FOP2 logs
-
Hi,
I want to add the fop2 login attempts to fail2ban.
There are no logs for login attempts under httpd log.
How can I add the login attempts or login failures to fail2ban? -
-
-
-
-
-
This is working.
Just posting the working config I used for other users who want to do the same. This is for PIAF and FreePBX distro, which come with a preconfigured fail2ban setup.Create a fop2.conf file in /etc/fail2ban/filter.d/ and put the following content in there:
[INCLUDES]Read common prefixes. If any customizations available -- read them from
common.local
before = common.conf
[Definition]
_daemon = fop2_server
Option: failregex
Notes.: regex to match the password failures messages in the logfile. The
host must be matched by a group named "host". The tag "<HOST>" can
be used for standard IP/hostname matching and is only an alias for
(?:::f{4,6}:)?(?P<host>[\w-.^_]+)
Values: TEXT
failregex = GENERAL|FAILED LOGIN (bad password)|<HOST>
Option: ignoreregex
Notes.: regex to ignore. If this regex matches, the line is ignored.
Values: TEXT
ignoreregex =
Then add below content to /etc/fail2ban/jail.conf:
[fop2]
enabled = true
filter = fop2
action = iptables-allports[name=FOP2, protocol=all]
sendmail[name=FOP2, dest="your destination email", sender=root@"hostname"]
logpath = /var/log/fop2_audit.log
bantime = 1800
findtime = 600
maxretry = 8
backend = autoAdjust the bantime, etc. settings and change the action if you want to block custom ports and not all.
A failed login attempt in /var/log/fop2_audit.log looks like this:1447099540|8800|GENERAL|FAILED LOGIN (bad password)|192.168.1.254:49379
1447099545|8800|GENERAL|FAILED LOGIN (bad password)|192.168.1.254:49396Good luck!
-
-
Adding a slight correction here.
Put that into /etc/fail2ban/filter.d/fop2.conf:
failregex = GENERAL|FAILED LOGIN (bad password)|<HOST>:\d+
GENERAL|FAILED LOGIN (non existant user)|<HOST>:\d+Also don't forget to do service fail2ban restart. Do fail2ban-client status to see if your jail got added.
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login