# Fail2ban

# Install on local drive

Start with installing it.   
`sudo apt install fail2ban`

Is it running?  
`systemctl status fail2ban`

what is fail2ban doing right now?  
sudo fail2ban-client status

Copy the config file in the OS  
`cd /etc/fail2ban`  
`sudo cp jail.conf jail.conf.local`  
 Fail to ban will not overwrite the .local file and will also prefer to use it over the .conf

Edit config file  
\- edit: `ignoreip =` and IP address you always want to be allowed `192.168.1.103/24 192.168.1.129/24` or something like that.  
\- `bantime =` keep this at 10 minutes

Ban or Unban an IP address  
`sudo fail2ban-client set sshd banip 192.168.1.1`  
`sudo fail2ban-client set sshd unbanip 192.168.1.1`