Showing posts from April, 2018

Prevent ssh timeouts

Locally add the following to ~/.ssh/config
ServerAliveInterval 120 # null packet every 120 seconds
On the server side add the following:
ClientAliveInterval 120 # null packet every 120 seconds
ClientAliveCountMax 720 # 24hs

fail2ban unban ip

To search all the ips that were banned we enter interactive mode:

$ fail2ban-client -i
Then we check a jail status, for example sshd: > status sshd the output: Status for the jail: sshd |- Filter |  |- Currently failed:0 |  |- Total failed:27 |  `- File list:/var/log/auth.log `- Actions    |- Currently banned:37    |- Total banned:38    `- Banned IP list:<a big list of banned ips>
So, if we want to unban a particular ip address, let's say X Then, we execute: > set ssh unbanip (within interactive mode)

Lastly, if you want to execute it directly from command line:

$ fail2ban-client get <JAIL> actionunban <IP-ADDRESS>
That's all.