M
M
MoyMirok2021-07-19 13:45:15
Asterisk
MoyMirok, 2021-07-19 13:45:15

How to set up fail2ban with ufw to secure Asterisk?

Hello!

How to set up fail2ban with ufw to secure Asterisk?
I would be very grateful for any tips or tutorials. Because everything I've found so far covers configuring sshd with ufw at most

Ubuntu 20/04 Server system

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
MoyMirok, 2021-07-20
@MoyMirok

edit information in jail.local

banaction = ufw
banaction_allports = ufw

In filter.d we create
the asterisk.conf file (in fact, the existing one, which is installed with fail2ban, also works)
[Definition]
failregex = .*NOTICE.* .*: Request '.*' from '.*' failed for '<HOST>:.*' .*- Failed to authenticate
            .*NOTICE.* .*: Request '.*' from '.*' failed for '<HOST>:.*' .*- No matching endpoint found
ignoreregex =

create asterisk.conf file in jail.d
[asterisk-full]
Included = true
enabled = true
port = 5060,5061
filter = asterisk
action = ufw
     sendmail[name=ASTERISK, dest=<куда>, sender=<от_кого>]
maxretry = 4
logpath = /var/log/asterisk/full
findtime = 21600
bantime = 604800

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question