Files
Andrey Lutsenko 8e2a4ac1b9 docs(security): периметр 80/443→HAProxy, 25→KSMG; UFW на .117
Переписаны docs/security под текущий этап: SSH/stats из SSH_ALLOWED,
80/443 для всех. Скрипт UFW дополнен правилом 8404.
2026-06-13 22:34:57 +10:00

62 lines
2.2 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.
# План внедрения
**Текущая остановка:** UFW на HAProxy (фаза 2). Бэкенды и KSMG — позже.
## Фаза 0 — Подготовка
- [ ] Зафиксировать DNAT на MikroTik:
- `80`, `443``192.168.160.117`
- `25``192.168.160.57` (KSMG)
- [ ] SSH на `.117` работает с `5.100.81.121` или `192.168.128.0/17`
- [ ] Backup: `haproxy.cfg`, allowlist, `sshd_config`
- [ ] `git pull` на HAProxy
- [ ] Консоль/IPMI на случай lockout SSH
---
## Фаза 1 — Подготовка хоста (без UFW)
- [ ] `apt update && apt upgrade`
- [ ] SSH: ключи, без root/password ([haproxy-host.md](haproxy-host.md))
- [ ] `haproxy -c -f /etc/haproxy/haproxy.cfg` — OK
- [ ] `fe_stats` (:8404) — закомментирован или будет под UFW
- [ ] Решить судьбу `fe_smtp` (:25): нужен из LAN или отключить
**Проверка:** `ss -tlnp` — ожидаемо 22, 80, 443; возможно 25.
---
## Фаза 2 — UFW на HAProxy ← **СТОП ЗДЕСЬ**
- [ ] `cp scripts/security/haproxy-ufw.env.example /etc/haproxy/security/haproxy-ufw.env`
- [ ] Проверить `SSH_ALLOWED="5.100.81.121 192.168.128.0/17"`
- [ ] Dry-run: `bash scripts/security/haproxy-ufw-apply.sh`
- [ ] **Вторая SSH-сессия:** `bash scripts/security/haproxy-ufw-apply.sh --apply`
- [ ] [checklist.md](checklist.md) — HAProxy
**Откат:** `ufw disable`
---
## Фаза 3 — UFW на бэкендах (позже)
По одному хосту, см. [backend-hosts.md](backend-hosts.md): Zabbix → Git → SAC → Synology → ERP → RDS → Exchange.
---
## Фаза 4 — KSMG (позже)
Периметровый **25** на `.57` — отдельный UFW и политика relay. HAProxy к inbound-почте не привязан.
---
## Фаза 5 — Усиление (позже)
Allowlist Exchange/sac-api, TLS verify на бэкендах, мониторинг UFW/fail2ban в Zabbix.
| Фаза | Риск |
|------|------|
| 1 | низкий |
| 2 | **SSH lockout** — вторая сессия + console |
| 3+ | обрыв сервиса при ошибке порта |