Внедрение KESL на ВМ2 + замена CLAMAV на KESL

This commit is contained in:
mi
2026-09-08 01:39:37 +03:00
parent 85df788f2d
commit fdfdeaffb4
43 changed files with 2210 additions and 329 deletions
+16 -7
View File
@@ -39,7 +39,7 @@
- **Safety Service Owner**: API/data contract, capacity result и v2 cutover/rollback sign-off.
- **Rule Pack Owner**: rules bundle, corpus, monitor report и version release.
- **Product Owner**: mnemonic `safety.chat.blocked` и business acceptance chat flow.
- **Operations Owner**: VM2 alerts, ClamAV signatures, incident/reprovision/restore rehearsal.
- **Operations Owner**: VM2 alerts, host KESL/broker и database updates, incident/reprovision/restore rehearsal.
```text
<PUBLIC_HOST> например chat.example.ru
@@ -93,7 +93,7 @@ Sizing и load gates конкретной машины — профильный
| ВМ2 collector | private SigNoz | TCP 4317 | allow |
| ВМ2 workers | S3 endpoints | TCP 443 | allow |
| ВМ2 `bitrix-sync` | approved Bitrix portal | TCP 443 | allow |
| ВМ2 `freshclam` | approved signature CDN | TCP 443/80 по vendor manifest | allow |
| host KESL ВМ2 | approved update sources по operator KESL runbook | vendor-required destinations/ports | allow |
| ВМ2 | trusted DNS/NTP | UDP/TCP 53, UDP 123 | allow |
| internet | managed PG | any | deny |
| internet | ВМ2 | any кроме nginx 80/443 | deny ingress |
@@ -237,11 +237,20 @@ Host ВМ1 — `<PUBLIC_HOST>`, ВМ2 — `<PROCESSING_PUBLIC_HOST>`; private `8
## 10. Сквозной порядок startup и cutover
1. На ВМ2 unit поднимает Redis Safety и local Collector.
2. Затем `clamd`/`freshclam`, Safety API/worker и `bitrix-sync`.
3. Последним на ВМ2 — nginx public `80/443` и private `8443`.
4. На ВМ1Redis/Collector, API, SMS, Keycloak, local app, edge nginx.
5. Только private `MESSAGE_SAFETY_URL` ВМ1 переключается на ВМ2 после Safety gates. Public CRM webhook DNS/routes ВМ2 не требуют изменения ВМ1.
1. На ВМ2 оператор выполняет KESL runbook: KESL 12.4 standalone, database update/canary.
2. Затем enable/start root-owned broker socket/service и проверяет status/permissions `/run/han-kesl/scan.sock`.
3. Unit ВМ2 поднимает Redis Safety и local Collector, затем Safety API/worker и `bitrix-sync`.
4. Последним на ВМ2nginx public `80/443` и private `8443`.
5. На ВМ1 — Redis/Collector, API, SMS, Keycloak, local app, edge nginx.
6. Только private `MESSAGE_SAFETY_URL` ВМ1 переключается на ВМ2 после Safety gates. Public CRM webhook DNS/routes ВМ2 не требуют изменения ВМ1.
Broker — custom integration: до cutover target VM2 обязана подтвердить точный
формат/exit semantics `kesl-control --scan-file --action Inform`, socket
permissions/cleanup и throughput. Только `clean` допускает allow; `infected`
даёт deny; scanner error или stale database остаются retryable и завершаются
`503`, не allow. Runtime фиксирует `scanner_engine=kesl` и
`signatures_version=hash(KESL version + database date)`; KESL update выполняется
ежечасно.
Legacy single-VM `docker compose up` не является evidence готовности target ВМ2. Один `message_id` нельзя одновременно отправлять в v1 и v2. После cutover ВМ1 не содержит local Safety/Redis DB2.