What is the correct setup for fail2ban?

I am not using the system admin module thus I am directly editing the jail.conf and jail.local files.

In the jail.conf file it has this:

   enabled  = true
    filter   = recidive
    logpath  = /var/log/fail2ban.log
    action   = iptables-allports[name=recidive, protocol=all]
               sendmail[name=recidive, [email protected], [email protected]]
    bantime  = 604800  ; 1 week
    findtime = 86400   ; 1 day
    maxretry = 10

Which of course I edit with my information in the yourpbx.com.

This section does work, but that is not the issue I have with.

It is the SIP section I am having trouble with which contains, by default, the following:

[asterisk-iptables]
enabled  = true
filter   = asterisk
action   = iptables-allports[name=SIP, protocol=all]
           sendmail[name=SIP, [email protected], [email protected]]
logpath  = /var/log/asterisk/fail2ban
maxretry = 5
bantime = 1800

I put the information in the sendmail section,I test with a phone and nothing happens.

In the ssh-iptables it has by default:

[ssh-iptables]
enabled  = true
filter   = sshd
action   = iptables[name=SSH, port=ssh, protocol=tcp]
           sendmail[name=SSH, [email protected], [email protected]]
logpath  = /var/log/secure
maxretry = 3

Now this section semi works as is, as a ban email is sent, but no ban occurs. However if I put in port =22, it will now ban on port 22 fail attempts.

In the asterisk-iptables no email is sent, nor a ban occurs no matter, even adding port=5060 in the action section.

What are the proper settings?

1 Like