Use bash script in Fail2Ban Configuration
I would like to call a bash script in the mailing of Fail2Ban. The bash script calls a rest api to get the username of the blocked ip-address by fail2ban.
Code:
# Fail2Ban configuration file Code:
`/bin/sh /etc/fail2ban/scripts/getHttpSessions.sh | grep` 10.100.00.00 \n |/usr/sbin/sendmail -f fail2ban test@test.com -- returned 1 Is there some way to use a bash script in a fail2ban configuration file that lookups the IP-address in the bash created overview? Thanks! |
in there sight
http://www.the-art-of-web.com/system/fail2ban-sendmail/ something about send mail https://www.fail2ban.org/wiki/index.php/Main_Page under HOWTO's |
Thank you for your answer but it says nothing about using a shell scripts with grep in a configuration file.
Quote:
|
Have you read
Code:
man 5 jail.conf |
Quote:
|
Yes, tested the script manually couple of times. This is the script that is called:
Code:
#!/bin/bash Quote:
|
I got it working! Probably some issues with syntax, but the following code works:
Thanks guys! Quote:
|
Quote:
/etc/fail2ban/action.d/<mycustom.conf> or some core file from the fail2ban package?? If the latter, on fail2ban upgrade, you lose. |
Regarding Habitual's comment, just make as back-up of the new file in case fail2ban wipes it out on an upgrade. I know Debian checks for custom config files, but maybe not every distro does.
|
It's just only the configuration file for sending emails in a jail that has changed. I recovered the original file and started all over again.
|
Quote:
Code:
cp /etc/fail2ban/jail.conf /etc/fail2ban/jail.local I only put enabled jails in jail.local ;) good luck. #Unanswered |
All times are GMT -5. The time now is 10:19 AM. |