AGENT SKILL

AWF 防火墙调试

debug-firewall

通过检查 Docker 容器(awf-squid、awf-agent)、分析 Squid 访问日志、核查 iptables 规则,以及排查被阻止的域名或网络问题,来调试 AWF 防火墙。

适用职业SRE 工程师
License 许可
MIT
最近更新
2026-11-15
Stars
★ 160
Forks
83

01 前言 Front Matter

name
debug-firewall
description
Debug the AWF firewall by inspecting Docker containers (awf-squid, awf-agent), analyzing Squid access logs, checking iptables rules, and troubleshooting blocked domains or network issues.
allowed-tools
Bash(docker:*), Bash(sudo:*), Bash(dmesg:*), Bash(ls:*), Bash(cat:*), Read

03 SKILL.md 正文

AWF Firewall Debugging Skill

Use this skill when you need to debug the awf firewall, inspect container state, analyze traffic, or troubleshoot network issues.

Container Information

Container Names:

  • awf-squid - Squid proxy container (IP: 172.30.0.10)
  • awf-agent - Agent execution container (IP: 172.30.0.20)

Network: awf-net (subnet: 172.30.0.0/24)

Quick Debugging Commands

Check Container Status

docker ps | grep awf
docker inspect awf-squid --format='{{.State.Running}}'
docker inspect awf-agent --format='{{.State.ExitCode}}'

View Logs

# Real-time logs
docker logs -f awf-squid
docker logs -f awf-agent

# Squid access log (traffic decisions)
docker exec awf-squid cat /var/log/squid/access.log

Analyze Traffic

Squid Decision Codes:

  • TCP_TUNNEL:HIER_DIRECT = ALLOWED (HTTPS)
  • TCP_MISS:HIER_DIRECT = ALLOWED (HTTP)
  • TCP_DENIED:HIER_NONE = BLOCKED
# Find blocked domains
docker exec awf-squid grep "TCP_DENIED" /var/log/squid/access.log | awk '{print $3}' | sort -u

# Count blocked by domain
docker exec awf-squid grep "TCP_DENIED" /var/log/squid/access.log | awk '{print $3}' | sort | uniq -c | sort -rn

# All unique domains accessed
docker exec awf-squid awk '{print $3}' /var/log/squid/access.log | sort -u

# Real-time blocked traffic
docker exec awf-squid tail -f /var/log/squid/access.log | grep --line-buffered TCP_DENIED

Inspect iptables Rules

# Host-level firewall chain
sudo iptables -t filter -L FW_WRAPPER -n -v

# Agent container NAT rules (redirects to Squid)
docker exec awf-agent iptables -t nat -L OUTPUT -n -v

# Kernel logs for blocked non-HTTP traffic
sudo dmesg | grep "FW_BLOCKED"

Network Inspection

# Network details
docker network inspect awf-net

# Test Squid connectivity
docker exec awf-agent nc -zv 172.30.0.10 3128

# DNS configuration
docker exec awf-agent cat /etc/resolv.conf

View Configuration

# Squid config
docker exec awf-squid cat /etc/squid/squid.conf

# Docker compose config
cat /tmp/awf-*/docker-compose.yml

# Agent environment
docker exec awf-agent env | grep -E "PROXY|DNS"

Preserved Logs Locations

With --keep-containers: Logs remain at work directory

  • Squid: /tmp/awf-<timestamp>/squid-logs/access.log
  • Agent: /tmp/awf-<timestamp>/agent-logs/ (only if Copilot CLI logs exist)

Normal execution: Logs moved after cleanup

  • Squid: /tmp/squid-logs-<timestamp>/access.log
  • Agent: /tmp/awf-agent-logs-<timestamp>/
# Find work directories and preserved logs
ls -ldt /tmp/awf-* /tmp/squid-logs-* 2>/dev/null | head -5

# View Squid logs from work dir (with --keep-containers)
sudo cat /tmp/awf-*/squid-logs/access.log

# View preserved Squid logs (after normal cleanup)
sudo cat $(ls -t /tmp/squid-logs-*/access.log 2>/dev/null | head -1)

Debug Mode Workflow

# 1. Run with debug logging and keep containers
sudo awf \
  --allow-domains github.com \
  --log-level debug \
  --keep-containers \
  'curl https://api.github.com'

# 2. Inspect containers (they remain running)
docker ps | grep awf
docker logs awf-squid
docker exec awf-squid grep "TCP_DENIED" /var/log/squid/access.log

# 3. Check iptables
sudo iptables -t filter -L FW_WRAPPER -n

# 4. Manual cleanup when done
docker rm -f awf-squid awf-agent
docker network rm awf-net

Common Issues

Domain blocked unexpectedly:

# Check exact domain being requested
docker exec awf-squid tail -20 /var/log/squid/access.log
# Look at the Host header (3rd column) - may need subdomain allowlisted

DNS resolution failing:

# Check DNS servers in use
docker exec awf-agent cat /etc/resolv.conf
# Verify DNS allowed in iptables
sudo dmesg | grep "FW_DNS"

Cleanup

# Manual cleanup
./scripts/ci/cleanup.sh

# Or individually:
docker rm -f awf-squid awf-agent
docker network rm awf-net
sudo iptables -t filter -F FW_WRAPPER 2>/dev/null
sudo iptables -t filter -X FW_WRAPPER 2>/dev/null
rm -rf /tmp/awf-*

Start here for diagnosis

If you are diagnosing a failure rather than exploring, enter through the diagnose-awf skill and the canonical diagnosis registry in docs/diagnostics/README.md. This skill is one of the specialist references it routes to.

04 同仓库更多 Skills

github
github/gh-aw-firewall

AWF 网络隔离与域名白名单

awf-skill

使用 AWF(Agentic Workflow Firewall,智能体工作流防火墙)运行带网络隔离和域名白名单的命令。为 AI 智能体提供 L7 层 HTTP/HTTPS 出站流量控制。

安全工程师云平台安全加固
★ 160
github
github/gh-aw-firewall

AWF 智能体网络隔离与出口控制

awf-skill

使用 AWF(Agentic Workflow Firewall,智能体工作流防火墙)在网络隔离与域名白名单机制下运行命令。为 AI 智能体提供 L7 层 HTTP/HTTPS 出口(egress)控制。

安全工程师云合规与数据边界管理
★ 160
github
github/gh-aw-firewall

AWF 沙箱文件系统访问配置

sandbox-filesystem-access

为 AWF 沙箱配置文件与目录访问权限、挂载(mounts)及主机 ACL,或对这些内容进行诊断排查。

SRE 工程师开发环境与工具链管理
★ 160
github
github/gh-aw-firewall

PR 合并就绪准备

pr-finisher

为来自 GitHub Copilot 云端智能体的待合并 Pull Request 做好合并准备。推动代码审查(Reviews)、本地验证(local validation)以及 Mergeable(可合并)状态达到就绪。不执行合并操作,也无法触发 CI。

软件开发工程师代码仓库协作管理
★ 160
github
github/gh-aw-firewall

GitHub Actions 工作流调试

debugging-workflows

通过下载日志、分析摘要,并理解智能体工作流(agentic workflows)与 AWF 防火墙如何协同工作,来调试 GitHub Actions 工作流。

SRE 工程师调试与故障排查
★ 160
github
github/gh-aw-firewall

智能体工作流请求路由

agentic-workflows

将 gh-aw 的设计、创建、诊断、修补、主动调试、升级以及本地 SDLC 问题请求路由到相应的策略。

AI 工程师智能体开发
★ 160