LINUX_SRV Telegram 535
Fail2Ban: Шпаргалка по настройке


Fail2Ban — инструмент для защиты сервера от перебора паролей (brute-force) и других атак, блокируя IP-адреса через iptables, firewalld, nftables и др.


Установка

Debian/Ubuntu:

sudo apt update && sudo apt install fail2ban


RHEL/CentOS:

sudo dnf install fail2ban



Базовая настройка

1. Создаём локальную копию конфига:

sudo cp /etc/fail2ban/jail.conf /etc/fail2ban/jail.local


2. Открываем для редактирования:

sudo nano /etc/fail2ban/jail.local


3. Ключевые параметры:


[DEFAULT]
bantime = 3600 # Время бана (в секундах)
findtime = 600 # Интервал поиска неудачных попыток
maxretry = 5 # Сколько раз можно ошибиться

ignoreip = 127.0.0.1/8 ::1 192.168.1.0/24 # IP без блокировки



Пример: защита SSH


[sshd]
enabled = true
port = ssh
logpath = %(sshd_log)s
maxretry = 3
bantime = 1h



Проверка и управление

- Запуск/остановка:

sudo systemctl start fail2ban
sudo systemctl enable fail2ban


- Статус:

sudo fail2ban-client status


- Статус конкретного jail:

sudo fail2ban-client status sshd


- Разбанить IP:

sudo fail2ban-client set sshd unbanip 1.2.3.4



Полезные логи

- Fail2Ban логи:

/var/log/fail2ban.log


- Проверка правил iptables:

sudo iptables -L -n



Советы :

Создавайте .local -файлы вместо правки .conf
Добавляйте свои фильтры в /etc/fail2ban/filter.d
Используйте fail2ban-regex для теста фильтров
👍3



tgoop.com/linux_srv/535
Create:
Last Update:

Fail2Ban: Шпаргалка по настройке


Fail2Ban — инструмент для защиты сервера от перебора паролей (brute-force) и других атак, блокируя IP-адреса через iptables, firewalld, nftables и др.


Установка

Debian/Ubuntu:


sudo apt update && sudo apt install fail2ban


RHEL/CentOS:

sudo dnf install fail2ban



Базовая настройка

1. Создаём локальную копию конфига:

sudo cp /etc/fail2ban/jail.conf /etc/fail2ban/jail.local


2. Открываем для редактирования:

sudo nano /etc/fail2ban/jail.local


3. Ключевые параметры:


[DEFAULT]
bantime = 3600 # Время бана (в секундах)
findtime = 600 # Интервал поиска неудачных попыток
maxretry = 5 # Сколько раз можно ошибиться

ignoreip = 127.0.0.1/8 ::1 192.168.1.0/24 # IP без блокировки



Пример: защита SSH


[sshd]
enabled = true
port = ssh
logpath = %(sshd_log)s
maxretry = 3
bantime = 1h



Проверка и управление

- Запуск/остановка:

sudo systemctl start fail2ban
sudo systemctl enable fail2ban


- Статус:

sudo fail2ban-client status


- Статус конкретного jail:

sudo fail2ban-client status sshd


- Разбанить IP:

sudo fail2ban-client set sshd unbanip 1.2.3.4



Полезные логи

- Fail2Ban логи:

/var/log/fail2ban.log


- Проверка правил iptables:

sudo iptables -L -n



Советы :

Создавайте .local -файлы вместо правки .conf
Добавляйте свои фильтры в /etc/fail2ban/filter.d
Используйте fail2ban-regex для теста фильтров

BY Типичный Сисадмин


Share with your friend now:
tgoop.com/linux_srv/535

View MORE
Open in Telegram


Telegram News

Date: |

Co-founder of NFT renting protocol Rentable World emiliano.eth shared the group Tuesday morning on Twitter, calling out the "degenerate" community, or crypto obsessives that engage in high-risk trading. Private channels are only accessible to subscribers and don’t appear in public searches. To join a private channel, you need to receive a link from the owner (administrator). A private channel is an excellent solution for companies and teams. You can also use this type of channel to write down personal notes, reflections, etc. By the way, you can make your private channel public at any moment. Hashtags are a fast way to find the correct information on social media. To put your content out there, be sure to add hashtags to each post. We have two intelligent tips to give you: The court said the defendant had also incited people to commit public nuisance, with messages calling on them to take part in rallies and demonstrations including at Hong Kong International Airport, to block roads and to paralyse the public transportation system. Various forms of protest promoted on the messaging platform included general strikes, lunchtime protests and silent sit-ins. Ng, who had pleaded not guilty to all charges, had been detained for more than 20 months. His channel was said to have contained around 120 messages and photos that incited others to vandalise pro-government shops and commit criminal damage targeting police stations.
from us


Telegram Типичный Сисадмин
FROM American