diff --git a/RUN.md b/RUN.md index 28291f2..1c3ef89 100644 --- a/RUN.md +++ b/RUN.md @@ -483,6 +483,7 @@ sudo xfs_quota -x -c "limit -p bhard=10g zcbot_" /opt | `POST /v1/files/upload` 返 413 `已达磁盘配额上限` | per-user 5GB(yaml `quotas.disk_bytes_per_user`)。让用户在 dev SPA 右侧文件栏删旧产物 / 大文件,或改 yaml 升配重启 web | | `[warn] network zcbot-sandbox-net is --internal (legacy)` | 上一版 sandbox network 创建时带了 `--internal`(完全禁 outbound),当前 dogfood 阶段放开。`docker stop $(docker ps -aq -f label=zcbot.product=sandbox) ; docker network rm zcbot-sandbox-net`,重启 web 自动 recreate 为非 internal | | tool write/edit 返 `[Error] 已达磁盘配额上限` | 同 upload 413,见上 | +| 容器内 `curl https://www.baidu.com` 报 `Temporary failure in name resolution` | iptables `127.0.0.0/8 DROP` 把 docker embedded DNS(`127.0.0.11:53`)也挡了;init.sh 已加 `127.0.0.11/32 udp/tcp 53 ACCEPT` 在 DROP 之前。重 build 镜像后,容器 `cat /etc/resolv.conf` 应该是 `nameserver 127.0.0.11`,`getent hosts www.baidu.com` 应该返 IP | | 启动报 `PLATFORM_KEY env not set` / `JWT_SECRET env not set` | D' 过渡 auth 强制双 env 必填。生成 `python -c "import secrets;print(secrets.token_urlsafe(48))"` 各填一,写 `.env` 重起 | | `/v1/auth/login_password` 返 403 `invalid email or password` | 邮箱不存在 / `password_hash` 列为空(platform_key 入口建的 user) / 密码错。`SELECT user_id, email, password_hash IS NOT NULL AS has_pw FROM users WHERE email=...` 核对;无行 → `main.py user add`;有行无密码 → `UPDATE users SET password_hash=...`(用 `.venv/Scripts/python.exe -c "from web.auth import hash_password;print(hash_password('xxx'))"` 算)或 `user add --user-id` 接到现有 user_id | | `main.py user add` 报 `IntegrityError ... uq_users_email` | 邮箱已存在,改 email 或先 `DELETE FROM users WHERE email=...`(先清该 user 的 tasks) | diff --git a/deploy/sandbox/init.sh b/deploy/sandbox/init.sh index 748531b..0e4920b 100644 --- a/deploy/sandbox/init.sh +++ b/deploy/sandbox/init.sh @@ -9,9 +9,15 @@ set -euo pipefail apply_blocklist() { + # Docker embedded DNS 例外(必须在 127.0.0.0/8 DROP 前)── + # 容器内 /etc/resolv.conf 默写 `nameserver 127.0.0.11`,挡了所有域名解析全跪。 + # 精准放行 53/udp + 53/tcp,不破坏 loopback DROP 基线(其他 127.0.0.0/8 仍挡)。 + iptables -A OUTPUT -d 127.0.0.11/32 -p udp --dport 53 -j ACCEPT + iptables -A OUTPUT -d 127.0.0.11/32 -p tcp --dport 53 -j ACCEPT + # §7.5 #1 红线段(任一缺失视为 Stage C 未完成): iptables -A OUTPUT -d 169.254.0.0/16 -j DROP # cloud metadata (Capital One 2019 SSRF) - iptables -A OUTPUT -d 127.0.0.0/8 -j DROP # IPv4 loopback (容器回头打宿主端口) + iptables -A OUTPUT -d 127.0.0.0/8 -j DROP # IPv4 loopback (容器回头打宿主端口;DNS 已上面例外) iptables -A OUTPUT -d 10.0.0.0/8 -j DROP # 内网段 A iptables -A OUTPUT -d 172.16.0.0/12 -j DROP # 内网段 B(Docker 默认 bridge 网段在此) iptables -A OUTPUT -d 192.168.0.0/16 -j DROP # 内网段 C