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

AWS VPS

Create AWS Account


Getin Free project

https://aws.amazon.com/tw/free/


Choose one of EC2 and Active

1、setting name

2、choose ubuntu

3、Storage can setting 30GB(Max) for free

4、Create certificate*


Active

1、SSH Client

2、use ssh to login and use certificate*


Frist 

1、sudo apt clean

2、sudo apt update -y

3、sudo apt upgrade -y

4、sudo apt-get clean

5、sudo apt-get update -y

6、sudo apt-get upgrade -y

7、sudo apt-get dist-upgrade -y

8、sudo apt-get autoremove -y


Install Editor

1、sudo apt-get install nano -y


Comfirm Version

lsb_release -a