Correct Way to Edit Fail2Ban .Conf Files on FreePBX Distro

Hello,

What is the correct way to edit the .conf files for Fail2Ban on the FreePBX distro? They have the heading that we should not directly edit the conf files, however, I would like to edit them so that they are similar to the configs I have on my other servers that is working well, namely, I do not want to receieve emails from certain jails (the SSH jail I don’t need the email, however, I need the email alerts for the SIP jails).

I know that I cannot leave the email alert/notification field in the System Admin page blank, since that will not allow any emails to come through.

Please advise as to what is the best thing to do. Thank you!

FreePBX Distro: FreePBX 2.11.0.38

Name        : fail2ban
Arch        : noarch
Version     : 0.8.8
Release     : 106.shmz65.1.114
Size        : 485 k
Repo        : installed
From repo   : schmooze-commercial
Summary     : Scan logfiles and ban ip addresses with too many password failures
URL         : http://fail2ban.sourceforge.net/
License     : GPL
Description : Fail2Ban monitors log files like /var/log/pwdfail or
            : /var/log/apache/error_log and bans failure-prone addresses. It
            : updates firewall rules to reject the IP address or executes user
            : defined commands.

You can not edit or change them if you are using the sysadmin module. Your only option is to remove the sysadmin module then.

Thank you for the response. However, I currently have commercial modules with FreePBX, if I uninstall the module, will I still be able to manage them?

No that module is needed for commercial modules.

Thanks agains for the reply… so then what would be the best option? I don’t want to disable the alerts for all of Fail2ban, just one particular jail. Is there anyway to work around this: still have the sysadmin module available for pro modules, but have the flexibility to edit F2B? Any advice would be most welcome.

fail2ban has a built in command (actully it IS fail2ban as we see it) complete with help at the cli:-

fail2ban-client

with that tool and if your implimentation of fail2ban is not too far from the original, you could use commands such as:-

set <JAIL> addaction <ACT>               adds a new action named <NAME> for
                                             <JAIL>
    set <JAIL> delaction <ACT>               removes the action <NAME> from
                                             <JAIL>
    set <JAIL> setcinfo <ACT> <KEY> <VALUE>  sets <VALUE> for <KEY> of the
                                             action <NAME> for <JAIL>
    set <JAIL> delcinfo <ACT> <KEY>          removes <KEY> for the action
                                             <NAME> for <JAIL>

Now although less delicate policies applied to fail2ban would overwrite your hard work you could script such actions appropriately with incron to reinstate your desired behavior.

JM2CWAE

Thanks for the help! I appreciate it! I shall test out and report back with findings if any :slight_smile: