feat(firewall): implement firewall blocklist feature with client management and policy rules
CI / changes (push) Successful in 12s
CI / commitlint (push) Has been skipped
CI / openapi (push) Successful in 25s
CI / web (push) Successful in 46s
CI / go (push) Successful in 1m15s
CI / bird2 (push) Successful in 18s
CI / release (push) Successful in 3m59s

Introduced a comprehensive firewall blocklist feature, allowing for the management of firewall clients and their associated rules. This includes endpoints for enrolling clients, listing clients and rules, and reporting apply statuses. Enhanced the API to support firewall operations, including the ability to handle block/accept policies. Updated the documentation to reflect these changes and added necessary components in the web UI for better user interaction.

Additionally, modified the agent server to support firewall failover and integrated firewall functionality into the existing architecture.
This commit is contained in:
Denozordec
2026-07-08 16:37:27 +07:00
parent 276194a9d0
commit 7a3eae98b1
36 changed files with 4581 additions and 174 deletions
+195
View File
@@ -58,6 +58,8 @@ tags:
Файловые runtime-логи Docker-сервисов (каталог EVOBGP_RUNTIME_LOGS_DIR).
Доступно только в процессе evobgp-all с примонтированным volume; иначе 503.
Просмотр — viewer+; очистка — operator+ (синхронно, с audit).
- name: Firewall
description: Linux firewall blocklist clients, policy rules (block/accept), and data-plane sync.
security:
- bearerAuth: []
@@ -1579,6 +1581,68 @@ components:
type: string
format: date-time
FirewallClient:
type: object
properties:
id:
$ref: "#/components/schemas/ResourceId"
name:
type: string
hostname:
type: string
token_prefix:
type: string
status:
type: string
enum: [pending, approved, revoked]
last_seen_at:
type: string
format: date-time
last_apply_at:
type: string
format: date-time
last_apply_status:
type: string
last_apply_prefix_count:
type: integer
client_version:
type: string
FirewallRule:
type: object
properties:
id:
$ref: "#/components/schemas/ResourceId"
client_id:
$ref: "#/components/schemas/ResourceId"
nullable: true
priority:
type: integer
action:
type: string
enum: [block, accept]
community_id:
$ref: "#/components/schemas/ResourceId"
nullable: true
comment:
type: string
FirewallBlocklist:
type: object
properties:
client_id:
$ref: "#/components/schemas/ResourceId"
revision_id:
$ref: "#/components/schemas/ResourceId"
prefixes:
type: array
items:
type: string
total:
type: integer
hash:
type: string
paths:
/v1/health:
get:
@@ -4299,3 +4363,134 @@ paths:
$ref: "#/components/responses/Forbidden"
default:
$ref: "#/components/responses/DefaultProblem"
/v1/firewall/enroll:
post:
tags: [Firewall]
summary: Enroll firewall client (public, X-EvoBGP-Seed)
security: []
operationId: firewallEnroll
parameters:
- name: X-EvoBGP-Seed
in: header
required: true
schema:
type: string
requestBody:
required: true
content:
application/json:
schema:
type: object
required: [name, client_token]
properties:
name:
type: string
hostname:
type: string
client_token:
type: string
client_version:
type: string
responses:
"201":
description: Client created (pending).
default:
$ref: "#/components/responses/DefaultProblem"
/v1/firewall/clients:
get:
tags: [Firewall]
summary: List firewall clients
operationId: listFirewallClients
responses:
"200":
description: OK
content:
application/json:
schema:
type: object
properties:
items:
type: array
items:
$ref: "#/components/schemas/FirewallClient"
default:
$ref: "#/components/responses/DefaultProblem"
/v1/firewall/clients/{id}/approve:
post:
tags: [Firewall]
summary: Approve pending client
operationId: approveFirewallClient
parameters:
- name: id
in: path
required: true
schema:
$ref: "#/components/schemas/ResourceId"
responses:
"200":
description: Approved
content:
application/json:
schema:
$ref: "#/components/schemas/FirewallClient"
default:
$ref: "#/components/responses/DefaultProblem"
/v1/firewall/rules:
get:
tags: [Firewall]
summary: List firewall rules
operationId: listFirewallRules
parameters:
- name: scope
in: query
schema:
type: string
enum: [tenant, client]
- name: client_id
in: query
schema:
$ref: "#/components/schemas/ResourceId"
responses:
"200":
description: OK
default:
$ref: "#/components/responses/DefaultProblem"
post:
tags: [Firewall]
summary: Create firewall rule
operationId: createFirewallRule
responses:
"201":
description: Created
default:
$ref: "#/components/responses/DefaultProblem"
/v1/firewall/blocklist:
get:
tags: [Firewall]
summary: Get evaluated blocklist (firewall client token)
operationId: getFirewallBlocklist
responses:
"200":
description: Blocklist
content:
application/json:
schema:
$ref: "#/components/schemas/FirewallBlocklist"
default:
$ref: "#/components/responses/DefaultProblem"
/v1/firewall/apply-report:
post:
tags: [Firewall]
summary: Report last apply status
operationId: firewallApplyReport
responses:
"200":
description: OK
default:
$ref: "#/components/responses/DefaultProblem"