How to Install fail2ban on Ubuntu 24.04

To install fail2ban on Ubuntu 24.04

apt-get install fail2ban

Check if there are any new sessions

zgrep "New session" /var/log/auth.log*

Check what jails are enabled

fail2ban-client status

Now check the ssh jail that is enabled

fail2ban-client status sshd

To check the currently banned IPs

grep 'Ban' /var/log/fail2ban.log*

These are the fail2ban defaults for your Ubuntu server

/etc/fail2ban/jail.d/defaults-debian.conf -- the defaults

Get what are the default actions for the ssh jail

fail2ban-client get sshd actions

By default the command above gives nftables.

To get the blocked IPs

nft list ruleset

Reference

One Reply to “How to Install fail2ban on Ubuntu 24.04”

Leave a Reply

Your email address will not be published. Required fields are marked *