FreeSWITCH Fail2Ban configuration Draft - Omid-Mohajerani/freeswitch GitHub Wiki

vim /usr/local/freeswitch/conf/sip_profiles/internal.xml

vim /usr/local/freeswitch/conf/sip_profiles/external.xml

<param name="log-auth-failures" value="true"/>

fs_cli -x "reload mod_sofia"

vim /usr/local/freeswitch/conf/vars.xml

<X-PRE-PROCESS cmd="set" data="console_loglevel=WARNING"/>

fs_cli -x "reloadxml"

Verify if failed registration attempts are in log

tail -F /usr/local/freeswitch/log/freeswitch.log

And try to register an account with wrong password

2022-11-13 20:06:39.510467 95.40% [WARNING] sofia_reg.c:1846 SIP auth challenge (REGISTER) on sofia profile 'internal' for [[email protected]] from ip 95.90.235.37
2022-11-13 20:06:39.670799 95.40% [WARNING] sofia_reg.c:1791 SIP auth failure (REGISTER) on sofia profile 'internal' for [[email protected]] from ip 95.90.235.37

install fail2ban

apt-get install fail2ban

vim /etc/fail2ban/jail.conf to see the current config

vim /etc/fail2ban/jail.d/freeswitch.local