chenhui-x/toolbox/cloud-firewall-and-gateway-ops

Claude Code and agent skill by chenhui-x/toolbox

Trust tier 3
  • community
Source check pending

Checking that the SKILL.md file is still in the repository.

Use when opening cloud ports or restarting gateways.

Install

npx vskill@latest install chenhui-x/toolbox/cloud-firewall-and-gateway-ops

SKILL.md

云防火墙放行与网关重启操作

When to Use

  • 新端口要暴露公网(节点、订阅、api_server、A2A 等)
  • 用户报告服务"本机通但外面连不上"
  • 需要重启本机/远程 hermes gateway

防火墙三层模型(排障顺序)

  1. 服务监听:ss -tlnp(TCP)/ ss -ulnp(UDP)——确认进程在听、绑 0.0.0.0 而非 127.0.0.1
  2. 主机防火墙:ufw status(本机 GCP VM 无 9902 规则也能通本机回环,说明三层独立)
  3. 云防火墙:GCP Firewall Rules / AWS Security Group——本机自测公网 IP 会误判(hairpin 不成立),要用另一台外部机器实测 /dev/tcp/IP/PORT

案例:GCP 9902 本机自测通、AWS 新机实测不通 → 定位到 GCP 防火墙缺规则。

先探测云厂商再谈防火墙

GCP: curl -H 'Metadata-Flavor: Google' http://metadata.google.internal/computeMetadata/v1/project/project-id
AWS: curl -s http://169.254.169.254/latest/meta-data/instance-id

⚠️ 2026-09-02 实例:新机 195.72.189.146 想当然以为是 GCP,实测是 AWS——两台机器的防火墙体系完全不同,别混淆。

GCP 放行端口的完整自助路径

默认 compute SA(197431797765-compute@developer.gserviceaccount.com)没有 compute scope,API 调防火墙必 403。标准流程:

  1. 装 SDK(如未装):
bash
cd /tmp && curl -sSL -o gcloud.tar.gz https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/google-cloud-cli-linux-x86_64.tar.gz && tar xzf gcloud.tar.gz && ./google-cloud-sdk/install.sh --quiet
  1. metadata token 实测取证:
bash
TOKEN=$(curl -s -H 'Metadata-Flavor: Google' 'http://metadata.google.internal/computeMetadata/v1/instance/service-accounts/default/token' | python3 -c 'import sys,json;print(json.load(sys.stdin)["access_token"])')
curl -s -H "Authorization: Bearer $TOKEN" 'https://compute.googleapis.com/compute/v1/projects/<project>/global/firewalls/<rule>'
# → 403 insufficient authentication scopes = 权限不在本机
  1. 拿到 403 证据后,请用户在其已登录的 Windows gcloud 跑单行命令:
gcloud compute firewall-rules create allow-xxx --allow tcp:PORT --target-tags http-server

给用户的命令规范(踩过的坑,全部真实发生):

  • 单行,禁止换行/反斜杠续行(用户终端会自动执行断行,用户原话"一行给我 不要换行 不然自动执行了")
  • 避免 0.0.0.0/0 裸 IP 串——Telegram 打码成 [IP]/0,用户复制到的是废命令。不写 --source-ranges 参数(gcloud 默认就是全网段)
  • PowerShell 多参数逗号必须加引号:--allow "udp:65083,udp:53900"
  • 发命令前自测可达性(用户原话"你先试试通不通")

AWS 侧

Security Group 在用户 AWS 控制台操作;实例内 iptables/ufw 照常。本机 sshpass 可登(密码见 .env 或知识库)。

网关重启

  • 自我保护拦截:任何含 "restart hermes-gateway" / "stop" 字样的命令从 gateway 进程内(含 ssh 远程执行的字样)发出都会被 Block
  • 唯一出路:命令写进脚本文件 → echo "/path/script.sh" | at now + 1 minute
  • deactivating 不是卡死:SIGTERM 后 gateway 等当前活跃 turn 结束才真正退出(本机 MemoryHigh=350M 拖慢关闭,实测约 4 分钟)。正确做法是交代用户"这条消息结束后自动完成",下个 turn 验证,不要反复轮询
  • 已有脚本:/root/.hermes/scripts/restart-gateway.sh(本机)、remote-gw-ops.sh(ssh 新机)、local-gw-restart.sh(本机简版)

相关技能

  • hermes-peer-networking — peer/A2A 组网全景
  • sing-box-node-check — 节点变更检查钩子(用户自有,未 curator 托管)
  • gcp-operations — GCP VM 运维(用户自有)

Security

  • Security scanPassed, 90 of 100Pattern checks on the skill's files.
  • Model reviewPassed

Quality evaluation

  • Task evaluationNot runNo evaluation yet. Run one in Skill Studio.

Source

Popularity

7-day trend score
0

Not refreshed yet.

Works with

Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.

  • Claude Code
  • Cursor
  • GitHub Copilot
  • Windsurf
  • Codex
  • Gemini CLI
  • Cline
  • Amp
  • Roo Code
  • Goose
  • Continue
  • Kilo Code
  • Junie
  • Trae
  • OpenHands
  • Qwen Code
  • AI Agent
  • Tabnine Chat
  • Sourcegraph Cody
  • Amazon Q
  • Firebase Genkit
  • Sweep
  • Devin
  • Phind
  • Mentat
  • Claude Desktop
  • Aider
  • GPT Pilot
  • Plandex
  • bolt.new
  • v0
  • Replit Agent
  • Anse
  • TypingMind
  • BetterChatGPT
  • LibreChat
  • Warp AI
  • Pieces
  • Fig AI
Embed badge
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/chenhui-x/toolbox/cloud-firewall-and-gateway-ops/badge)](https://verified-skill.com/skills/chenhui-x/toolbox/cloud-firewall-and-gateway-ops)

Something wrong with this skill or its page? Tell us.