General
Protect your Ubuntu Server with Fail2ban
Installation
apt install -y fail2ban
Check Status Ban
- Default jail name is
sshd
sudo fail2ban-client status sshd
Ban Manually
sudo fail2ban-client -vvv set sshd banip x.x.x.x
Unban
fail2ban-client set sshd unbanip x.x.x.x
Default configuration
- Default retry ->
max 5
- Default jail perido ->
10 m
Create notification to Telegram
- Configure on
/etc/fail2ban/jail.conf
add this on existing configurar
[sshd]
action = iptables[name=SSH, port=22, protocol=tcp]
telegram
- Create script on
sudo mkdir /etc/fail2ban/scripts/
then create scriptfail2ban-telegram.sh
-> script - Create script on
/etc/fail2ban/action.d/
then create scripttelegram.conf
-> script - Reference