Files

24 lines
1.6 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Tasks — add-vesti-fail2ban-jail
## 1. Факты и лог
- [x] 1.1 Проверить блок `vesti.nixg.ru` в `/opt/caddy/Caddyfile`: своего `log` нет, запросы идут в общий `access.log`.
- [x] 1.2 Установить фактический признак неудачного входа по коду: `web/app.py` → `302` + `Location: /login?error=1` (не 401).
- [x] 1.3 Снять бэкап Caddyfile и добавить отдельный лог `/data/logs/vesti.access.log`.
- [x] 1.4 `caddy validate` → Valid configuration; `caddy reload` без простоя.
## 2. Джейл
- [x] 2.1 Создать `/etc/fail2ban/filter.d/caddy-vesti.conf` (remote_ip + POST /login + 302 + Location error=1).
- [x] 2.2 Создать `/etc/fail2ban/jail.d/caddy-vesti.local` (maxretry 5, findtime 10m, bantime 1h, порты http,https).
- [x] 2.3 `fail2ban-regex` по реальному логу → 1 matched из 1 строки.
- [x] 2.4 `fail2ban-client -t` → OK; `systemctl restart fail2ban`; джейл `caddy-vesti` активен.
## 3. Проверка на живом трафике
- [x] 3.1 5 неверных паролей с внешнего IP → `Total failed: 5`.
- [x] 3.2 IP `178.176.197.2` в `Banned IP list`; `https://vesti.nixg.ru/login` с него → `000`.
- [x] 3.3 SSH к vps02 не затронут (бан только `http,https`).
- [x] 3.4 `unbanip` → сайт снова отдаёт 200.
- [x] 3.5 Успешный вход под фильтр не попадает (проверено по строке лога: `Location: /candidates`).