/notebook/linux-basics/fail2ban

Fail2Ban


Derived from here:

sudo apt install -y fail2ban
sudo systemctl enable fail2ban
sudo systemctl start fail2ban 
sudo systemctl status fail2ban 

config fail2ban for ufw

echo "[DEFAULT]" | sudo tee -a /etc/fail2ban/jail.local
echo "banaction=ufw" | sudo tee -a /etc/fail2ban/jail.local

restart the service and check

sudo systemctl restart fail2ban 
sudo fail2ban-client status
sudo fail2ban-client status sshd

list all banned:

sudo zgrep 'Ban' /var/log/fail2ban.log*

About

I am an engineer and educator, having spent ten years as a professor. My goal is to help you build your knowledge of design and technology, get your hardware working, and propel your startup or small business. Get in touch!