show code js

2022年11月23日 星期三

Fail2Ban With Ubuntu

 Fail2Ban


1. sudo apt install fail2ban -y

2. sudo systemctl status fail2ban.service

3. cd /etc/fail2ban

4. sudo cp jail.conf jail.local

5. sudo nano jail.local

modify bantime, findtime and maxretry

modify enabled = false to true

find [sshd] after add line: enabled = true

find [nginx-http-auth] after add line: enabled = true 

6. sudo systemctl enable fail2ban.service

7. sudo systemctl start fail2ban.service

8. sudo systemctl status fail2ban.service


if u start with error

1. sudo rm jail.local

2. sudo nano jail.local 

[sshd]

enabled  = true

port     = ssh

filter   = sshd

logpath  = /var/log/auth.log


maxretry = 5

findtime = 60m

bantime  = 60m


from: 

https://www.digitalocean.com/community/tutorials/how-to-protect-ssh-with-fail2ban-on-ubuntu-20-04

沒有留言:

張貼留言