Files
buryan-infra/docs/architecture/TOOL-GATEWAY-ENFORCEMENT.md
T
architect 259ba878d7
lint / hygiene (push) Failing after 25s
lint / hygiene (pull_request) Failing after 23s
standard / check (pull_request) Successful in 14s
[STAGE5] Approval queue for gateway write tools
2026-11-29 18:10:39 +03:00

1.4 KiB
Raw Blame History

Tool Gateway enforcement — reference agent

Дата: 2026-11-29.

Что сделано

  • создан системный пользователь agent-gw (UID 999);
  • его единственный разрешённый TCP egress — 127.0.0.1:9137;
  • DNS UDP 53 разрешён;
  • остальное — REJECT;
  • агент запускается как agent-gw и ходит только через Tool Gateway.

Approvals

Write-tools требуют не строку approved, а ID из approval queue:

POST /v1/approvals           → pending id
POST /v1/approvals/decision  → approved/denied
POST /v1/call + X-Approval:id

Проверка: create=201, decision approved, write без ID=403.

Production-style agent

agent-gw.service
User=agent-gw
catalog.read every 5 min via 127.0.0.1:9137
log: /var/lib/agent-gw/agent.log

Проверка:

systemctl is-active agent-gw → active
{"tool":"catalog.read","bytes":6884}

runuser -u agent-gw -- curl http://127.0.0.1:9120/catalog
direct=000

Ограничение

Это enforcement для reference-агента.
Production-агенты (hub-bots, hub-agents) ещё не переведены; Gate G5 не закрыт.

Откат

iptables -D OUTPUT -m owner --uid-owner 999 -j AGENT_GW_OUT
iptables -F AGENT_GW_OUT
iptables -X AGENT_GW_OUT
userdel agent-gw