Skip to content

Commit 36618c0

Browse files
committed
fix #80
1 parent dc575d2 commit 36618c0

File tree

1 file changed

+35
-0
lines changed
  • content/3.misc/1.tools-and-utilities/2.network

1 file changed

+35
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
---
2+
title: "Fail2ban: SSH protection"
3+
date: 2023-03-02
4+
---
5+
6+
Fail2Ban is a program that protects servers from bruteforce attacks. (attacks in which a hacker breaks the password to SSH or another service using brute force)
7+
8+
## Installation
9+
10+
```sh
11+
bash <(wget -qO- https://cesbo.com/download/astra/scripts/fail2ban.sh)
12+
```
13+
14+
First, the script will suggest changing the ssh port. For example: changing the port number from 22 to 8382 will make it harder for bots to detect ssh.
15+
Next, you will be asked for the number of failed authorization attempts: (by default, 3)
16+
The last question is how long in hours we will block the ip from which there were unsuccessful attempts to log in.
17+
After that, the script will download, install, and configure the service.
18+
The file /var/log/astra.log will also be monitored: if authorization attempts fail in the Astra web interface, the user will be blocked.
19+
If you use a different log file name for astra, fix it in /etc/fail2ban/jail.local
20+
21+
The fail2ban configuration is complete.
22+
23+
## Use
24+
25+
Viewing statistics
26+
27+
```sh
28+
fail2ban-client status
29+
```
30+
31+
To unblock the ip, run the following command:
32+
33+
```sh
34+
fail2ban-client set ssh-iptables unbanip IPADDRESS
35+
```

0 commit comments

Comments
 (0)