feat(auth): добавить приложение fw для EvoFirewall
Build and Push Auth Portal Docker Image / build-and-push (push) Failing after 1m15s
Build and Push Auth Portal Docker Image / create-release (push) Skipped

Каталог permissions fw:*, app switcher и docs; убран bgp:firewall после cutover.

Co-authored-by: Cursor <[email protected]>
This commit is contained in:
Denozordec
2026-07-20 19:50:54 +07:00
co-authored by Cursor
parent 143db3d72e
commit 9b4c7b8b9d
5 changed files with 50 additions and 6 deletions
+2 -1
View File
@@ -27,7 +27,8 @@ pnpm --filter web dev # :5175
См. [`docs/integrate-cfdm.md`](docs/integrate-cfdm.md) — то же для Cloudflare Domain Manager (`cfdm:*`, порт Vite `5174`).
См. [`docs/integrate-evobgp.md`](docs/integrate-evobgp.md) — EvoBGP (`bgp:*`), dual auth JWT + API keys, ownership modules/peers/firewall.
См. [`docs/integrate-evobgp.md`](docs/integrate-evobgp.md) — EvoBGP (`bgp:*`).
См. [`docs/integrate-evofirewall.md`](docs/integrate-evofirewall.md) — EvoFirewall (`fw:*`).
Корень:
+2 -3
View File
@@ -1,6 +1,6 @@
# Интеграция auth-portal ↔ EvoBGP
Единый вход: пользователь логинится на auth-portal, получает JWT, переходит в EvoBGP с токеном в URL fragment. EvoBGP API проверяет JWT и права `bgp:*`. API-ключи EvoBGP (viewer/editor/operator/node/firewall) остаются для автоматизации и нод.
Единый вход: пользователь логинится на auth-portal, получает JWT, переходит в EvoBGP с токеном в URL fragment. EvoBGP API проверяет JWT и права `bgp:*`. API-ключи EvoBGP (viewer/editor/operator/node) остаются для автоматизации и нод. Firewall-клиенты перенесены в **EvoFirewall** (`fw:*`).
## Архитектура
@@ -27,7 +27,6 @@ App id в портале: **`bgp`**.
| `bgp:network:read` / `write` | `/network` (пиры и спикеры) |
| `bgp:directories:read` / `write` | `/directories` |
| `bgp:operations:read` / `write` / `admin` | `/operations` (admin = apply/rollback) |
| `bgp:firewall:read` / `write` | `/firewall` |
| `bgp:schedule:read` / `write` | `/schedule` |
| `bgp:monitoring:read` | `/monitoring` |
| `bgp:access:admin` | `/access` (API-ключи) |
@@ -40,7 +39,7 @@ App id в портале: **`bgp`**.
### Ownership
Ресурсы modules / peers / firewall (clients, rules), созданные через JWT, имеют `created_by_user_id`. Видят и редактируют: создатель и portal `is_admin` (или API key `operator`). API keys без user id — tenant-wide scope.
Ресурсы modules / peers, созданные через JWT, имеют `created_by_user_id`. Видят и редактируют: создатель и portal `is_admin` (или API key `operator`). API keys без user id — tenant-wide scope. Firewall — см. EvoFirewall / `docs/integrate-evofirewall.md`.
## Локальный запуск
+26
View File
@@ -0,0 +1,26 @@
# Интеграция auth-portal ↔ EvoFirewall
App id: **`fw`**.
Единый вход: JWT HS256 (общий `JWT_SECRET`), handoff через `#access_token=…`.
## Permissions
| Permission | UI |
|------------|-----|
| `fw:dashboard:read` | Dashboard |
| `fw:agents:read` / `write` | Agents |
| `fw:lists:read` / `write` | IP lists |
| `fw:policies:read` / `write` | Rules / overrides |
| `fw:stats:read` | Stats |
| `fw:settings:admin` | Settings |
## Portal checklist
1. `APP_IDS` включает `fw` (сделано)
2. Admin → Apps: URL EvoFirewall + выдача прав
3. `RETURN_TO_ALLOWLIST` — origin FW
## App env
См. EvoFirewall `docs/integrate-auth-portal.md`.
@@ -35,6 +35,7 @@ const DEFAULT_ICONS: Record<AppId, AppSwitcherIconName> = {
cfdm: 'cloud',
vps: 'server',
bgp: 'globe',
fw: 'server',
}
/** Seed / fallback when DB is empty. */
+19 -2
View File
@@ -1,6 +1,6 @@
import { z } from 'zod'
export const APP_IDS = ['cfdm', 'vps', 'bgp'] as const
export const APP_IDS = ['cfdm', 'vps', 'bgp', 'fw'] as const
export type AppId = (typeof APP_IDS)[number]
export const appIdSchema = z.enum(APP_IDS)
@@ -34,6 +34,12 @@ export const APPS: AppMeta[] = [
description: 'Модули, сеть, операции и мониторинг BGP',
url: 'https://bgp.shnt.top',
},
{
id: 'fw',
title: 'EvoFirewall',
description: 'Централизованный firewall: агенты, списки, политики',
url: 'https://fw.shnt.top',
},
]
export type CatalogSection = {
@@ -100,7 +106,6 @@ export const PERMISSION_CATALOG: AppPermissionCatalog[] = [
'write',
'admin',
]),
section('firewall', 'Файрвол', 'Клиенты и правила'),
section('schedule', 'Задачи', 'Расписание refresh'),
section('monitoring', 'Мониторинг', 'Health и BIRD', ['read']),
section('access', 'Доступ', 'API-ключи', ['admin']),
@@ -110,6 +115,18 @@ export const PERMISSION_CATALOG: AppPermissionCatalog[] = [
section('settings', 'Настройки UI', 'Токен и подключение', ['read']),
],
},
{
appId: 'fw',
title: 'EvoFirewall',
sections: [
section('dashboard', 'Дашборд', 'KPI и обзор', ['read']),
section('agents', 'Агенты', 'Linux / MikroTik клиенты'),
section('lists', 'Списки IP', 'static / JSON / domains / EvoBGP'),
section('policies', 'Правила', 'Allow/deny политики и overrides'),
section('stats', 'Статистика', 'Пакеты и история', ['read']),
section('settings', 'Настройки', 'Enroll seed и интеграции', ['admin']),
],
},
]
export function permissionKey(