Egress reject audit logging (LOG target before REJECT) #40
Copy link
Copy link
Closed
Labels
enhancementNew feature or requestNew feature or request
Milestone
Description
Problem
firewall.sh silently rejects outbound traffic that doesn't match the allowlist. There's no record of what was blocked — we can't audit agent network behavior or detect unexpected egress attempts.
Fix
Add an iptables LOG target immediately before the existing REJECT rule in firewall.sh:
_ipt -A OUTPUT -j LOG --log-prefix "CLIDE-REJECT: " --log-level 4
_ipt -A OUTPUT -j REJECT --reject-with icmp-port-unreachableSame for ip6tables.
Logs go to the kernel ring buffer (dmesg / /var/log/kern.log). For structured consumption, a future poller (v5) can tail these and write to egress_events.jsonl.
Size
XS — 15 minute change to firewall.sh.
Notes
- PR Add configurable iptables egress firewall for container network isolation #25 (egress firewall) is already merged. This is a standalone add-on.
- Current rule is
REJECT, notDROP— use prefix "CLIDE-REJECT" for clarity. - Consider rate-limiting the LOG rule (
-m limit --limit 10/min) to prevent log flooding from a looping agent.
Source: workspace/notes/research/clide_monitoring.md, final_observability_ticket_plan.md (C-2)
Reacted by Copilot
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request
Activity
itscooleric commentedon Mar 7, 2026
Copilot implementation note:
The change is entirely in
firewall.sh, section 6 (around line 101). Replace:```bash
6. Reject all other outbound traffic (REJECT gives immediate feedback vs DROP's timeout)
_ipt -A OUTPUT -j REJECT --reject-with icmp-port-unreachable
_ip6 -A OUTPUT -j REJECT
```
With:
```bash
6. Log then reject all other outbound traffic
_ipt -A OUTPUT -m limit --limit 10/min -j LOG --log-prefix "CLIDE-REJECT: " --log-level 4
_ip6 -A OUTPUT -m limit --limit 10/min -j LOG --log-prefix "CLIDE-REJECT: " --log-level 4
_ipt -A OUTPUT -j REJECT --reject-with icmp-port-unreachable
_ip6 -A OUTPUT -j REJECT
```
Notes:
dmesg//var/log/kern.loginside the container."CLIDE-REJECT: "(not CLIDE-DROP — the rule is REJECT).Testing: After applying, run a command that hits a non-allowlisted host (e.g.
curl https://example.com) and verify you see aCLIDE-REJECT:line indmesgoutput.feat: add egress reject audit logging (LOG before REJECT in firewall.sh)
Stage clean: latest code from Gitea (#107)