fail2ban-client status sshd | grep -o '[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}'
Fail2ban is a powerful tool that helps protect servers from malicious attacks by automatically banning IP addresses that are attempting to breach security measures. If you want to view a list of banned IP addresses in fail2ban, you can use the following command:
fail2ban-client status
This command will display a detailed status report of fail2ban, including a list of all currently banned IP addresses. The output will show the banned IP addresses along with other relevant information such as the corresponding jail, the date and time of the ban, and the number of failed attempts from that IP address.
The list of banned IP addresses is useful for monitoring the effectiveness of fail2ban and identifying any persistent attackers. By regularly checking the list, you can get insights into the most common sources of attacks and take appropriate action to strengthen your server's security.
In addition to the fail2ban-client status
command, you can also use the fail2ban-client status [jail]
command to view the banned IP addresses for a specific jail. This can be helpful if you want to focus on the banned IP addresses associated with a particular service or application.