Tag: fail2ban

  • Unblock an IP from fail2ban

    To check if an IP is banned by fail2ban, run

    zgrep "Ban" /var/log/fail2ban.log* | grep IP_ADDR_HERE

    To unblock an IP, you should find the jail that caused the IP to be blocked.

    In the following example, IP 152.67.19.86 is blocked by the sshd jail

    2020-07-28 00:47:09,763 fail2ban.actions        [3494]: NOTICE  [sshd] Ban 152.67.19.86
    2020-07-28 00:47:11,928 fail2ban.filter         [3494]: INFO    [sshd] Found 152.67.19.86 - 2020-07-28 00:47:11

    To unban the IP, run

    root@controlpanel:~# fail2ban-client set sshd unbanip 152.67.19.86
    152.67.19.86
    root@controlpanel:~# 

    You can see all jails with the command fail2ban-client status

    root@controlpanel:/var/log# fail2ban-client status 
    Status
    |- Number of jail:	4
    `- Jail list:	dovecot, postfix, pure-ftpd, sshd
    root@controlpanel:/var/log#

    See fail2ban

  • fail2ban

    fail2ban-client status

    To install fail2ban on Deban/Ubuntu, run

    apt install fail2ban -y
  • Install fail2ban on CentOS

    To install fail2ban on CentOS, first, enable the epel repo by running

    yum install epel-release -y

    Now install fail2ban with

    yum install fail2ban -y

    Enable fail2ban with

    systemctl enable fail2ban

    Basck to fail2ban