Skip to content

Instantly share code, notes, and snippets.

@Furqanameen
Created September 15, 2023 09:15
Show Gist options
  • Save Furqanameen/45a46f4cd4001406f108810018f69ab3 to your computer and use it in GitHub Desktop.
Save Furqanameen/45a46f4cd4001406f108810018f69ab3 to your computer and use it in GitHub Desktop.
https://www.digitalocean.com/community/tutorials/how-to-protect-an-apache-server-with-fail2ban-on-ubuntu-14-04
sudo apt-get update
sudo apt-get install fail2ban
[sshd]
# To use more aggressive sshd modes set filter parameter "mode" in jail.local:
# normal (default), ddos, extra or aggressive (combines all).
# See "tests/files/logs/sshd" or "filter.d/sshd.conf" for usage example and details.
#mode = normal
enabled = true
mode = aggressive
publickey = any
port = ssh
maxretry = 3
findtime = 300
bantime = 3h
logpath = %(sshd_log)s
backend = %(sshd_backend)s
Bunch of request
while true; do ssh root@IP 2>&1; sleep 1; done
For example, to remove an IP address jailed within ssh, use the below command.
sshd will be jail name
fail2ban-client set sshd unbanip IP
fail2ban-client set sshd unbanip IP
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment