show code js

2022年11月23日 星期三

Fail2Ban With Ubuntu

 Fail2Ban

Ew?x$|#SM}zj(C3I[HQ~qzwGknD^@-.%<_htkWAz6*jw!x?(eymMQg6,<+UP5JJG+f&lDwfj5hT={

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

Ew?x$|#SM}zj(C3I[HQ~qzwGknD^@-.%<_htkWAz6*jw!x?(eymMQg6,<+UP5JJG+f&lDwfj5hT={

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

Ew?x$|#SM}zj(C3I[HQ~qzwGknD^@-.%<_htkWAz6*jw!x?(eymMQg6,<+UP5JJG+f&lDwfj5hT={

maxretry = 5

findtime = 60m

bantime  = 60m

Ew?x$|#SM}zj(C3I[HQ~qzwGknD^@-.%<_htkWAz6*jw!x?(eymMQg6,<+UP5JJG+f&lDwfj5hT={

from: 

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

AWS VPS

Create AWS Account

Ew?x$|#SM}zj(C3I[HQ~qzwGknD^@-.%<_htkWAz6*jw!x?(eymMQg6,<+UP5JJG+f&lDwfj5hT={

Getin Free project

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

Ew?x$|#SM}zj(C3I[HQ~qzwGknD^@-.%<_htkWAz6*jw!x?(eymMQg6,<+UP5JJG+f&lDwfj5hT={

Choose one of EC2 and Active

1、setting name

2、choose ubuntu

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

4、Create certificate*

Ew?x$|#SM}zj(C3I[HQ~qzwGknD^@-.%<_htkWAz6*jw!x?(eymMQg6,<+UP5JJG+f&lDwfj5hT={

Active

1、SSH Client

2、use ssh to login and use certificate*

Ew?x$|#SM}zj(C3I[HQ~qzwGknD^@-.%<_htkWAz6*jw!x?(eymMQg6,<+UP5JJG+f&lDwfj5hT={

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

Ew?x$|#SM}zj(C3I[HQ~qzwGknD^@-.%<_htkWAz6*jw!x?(eymMQg6,<+UP5JJG+f&lDwfj5hT={

Install Editor

1、sudo apt-get install nano -y

Ew?x$|#SM}zj(C3I[HQ~qzwGknD^@-.%<_htkWAz6*jw!x?(eymMQg6,<+UP5JJG+f&lDwfj5hT={

Comfirm Version

lsb_release -a

Ew?x$|#SM}zj(C3I[HQ~qzwGknD^@-.%<_htkWAz6*jw!x?(eymMQg6,<+UP5JJG+f&lDwfj5hT={