57 lines
1.4 KiB
Markdown
57 lines
1.4 KiB
Markdown
# 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:
|
||
|
||
```text
|
||
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
|
||
|
||
```text
|
||
agent-gw.service
|
||
User=agent-gw
|
||
catalog.read every 5 min via 127.0.0.1:9137
|
||
log: /var/lib/agent-gw/agent.log
|
||
```
|
||
|
||
Проверка:
|
||
|
||
```text
|
||
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 не закрыт.
|
||
|
||
## Откат
|
||
|
||
```text
|
||
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
|
||
```
|