create-dwy 0.16.1 → 0.17.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (104) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/bin/index.js +1 -1
  3. package/package.json +1 -1
  4. package/src/sync-all.js +303 -59
  5. package/src/sync-global-skills.js +167 -0
  6. package/src/sync.js +21 -11
  7. package/templates/ai-tools/CHANGELOG.md +134 -0
  8. package/templates/ai-tools/VERSION +1 -1
  9. package/templates/ai-tools/rules/Android/dwy-android-core.md +65 -1
  10. package/templates/ai-tools/rules/Python/dwy-python-core.md +47 -0
  11. package/templates/ai-tools/rules/Vue/dwy-vue-core.md +55 -0
  12. package/templates/ai-tools/rules/iOS/dwy-swift-core.md +46 -0
  13. package/templates/ai-tools/rules//345/274/200/345/217/221/346/265/201/347/250/213/dwy-oss-commercial-license.md +128 -0
  14. package/templates/ai-tools/skills//345/217/221/345/270/203/345/217/221/347/211/210/dwy-ios-app-store-release/SKILL.md +65 -0
  15. package/templates/ai-tools/skills//345/217/221/345/270/203/345/217/221/347/211/210/dwy-ios-app-store-release/assets/appstore-submission.yaml +43 -0
  16. package/templates/ai-tools/skills//345/217/221/345/270/203/345/217/221/347/211/210/dwy-ios-app-store-release/references/api-workflow.md +17 -0
  17. package/templates/ai-tools/skills//345/217/221/345/270/203/345/217/221/347/211/210/dwy-ios-app-store-release/references/in-app-purchase-review.md +16 -0
  18. package/templates/ai-tools/skills//345/217/221/345/270/203/345/217/221/347/211/210/dwy-ios-app-store-release/references/screenshot-workflow.md +16 -0
  19. package/templates/ai-tools/skills//345/217/221/345/270/203/345/217/221/347/211/210/dwy-ios-app-store-release/scripts/appstore_config.sh +140 -0
  20. package/templates/ai-tools/skills//345/217/221/345/270/203/345/217/221/347/211/210/dwy-publish/SKILL.md +11 -8
  21. package/templates/ai-tools/skills//345/217/221/345/270/203/345/217/221/347/211/210/dwy-publish/references/android.md +2 -1
  22. package/templates/ai-tools/skills//345/217/221/345/270/203/345/217/221/347/211/210/dwy-publish/references/backend-deploy.md +2 -1
  23. package/templates/ai-tools/skills//345/217/221/345/270/203/345/217/221/347/211/210/dwy-publish/references/changelog.md +24 -4
  24. package/templates/ai-tools/skills//345/217/221/345/270/203/345/217/221/347/211/210/dwy-publish/references/frontend-deploy.md +2 -1
  25. package/templates/ai-tools/skills//345/217/221/345/270/203/345/217/221/347/211/210/dwy-publish/references/generic-release.md +2 -1
  26. package/templates/ai-tools/skills//345/217/221/345/270/203/345/217/221/347/211/210/dwy-publish/references/git-tag.md +82 -0
  27. package/templates/ai-tools/skills//345/217/221/345/270/203/345/217/221/347/211/210/dwy-publish/references/harmony.md +2 -1
  28. package/templates/ai-tools/skills//345/217/221/345/270/203/345/217/221/347/211/210/dwy-publish/references/ios.md +3 -2
  29. package/templates/ai-tools/skills//345/217/221/345/270/203/345/217/221/347/211/210/dwy-publish/references/monitor-notify.md +2 -2
  30. package/templates/ai-tools/skills//345/217/221/345/270/203/345/217/221/347/211/210/dwy-semver/SKILL.md +1 -1
  31. package/templates/ai-tools/skills//345/237/272/347/241/200/345/272/223/dwy-eapi/references/tasks-integration-guide.md +2 -2
  32. package/templates/ai-tools/skills//350/207/252/345/252/222/344/275/223/README.md +57 -0
  33. package/templates/ai-tools/skills//350/207/252/345/252/222/344/275/223/dwy-doubao-tts/SKILL.md +147 -0
  34. package/templates/ai-tools/skills//350/207/252/345/252/222/344/275/223/dwy-doubao-tts/references/api.md +43 -0
  35. package/templates/ai-tools/skills//350/207/252/345/252/222/344/275/223/dwy-doubao-tts/references/config.example.yaml +33 -0
  36. package/templates/ai-tools/skills//350/207/252/345/252/222/344/275/223/dwy-doubao-tts/scripts/global_config.py +89 -0
  37. package/templates/ai-tools/skills//350/207/252/345/252/222/344/275/223/dwy-doubao-tts/scripts/setup_config.py +175 -0
  38. package/templates/ai-tools/skills//350/207/252/345/252/222/344/275/223/dwy-doubao-tts/scripts/synthesize.py +339 -0
  39. package/templates/ai-tools/skills//350/207/252/345/252/222/344/275/223/media-platform-packaging/SKILL.md +127 -0
  40. package/templates/ai-tools/skills//350/207/252/345/252/222/344/275/223/media-platform-packaging/assets/cover-style-master-v1.png +0 -0
  41. package/templates/ai-tools/skills//350/207/252/345/252/222/344/275/223/media-platform-packaging/references/platform-copy-examples.md +37 -0
  42. package/templates/ai-tools/skills//350/207/252/345/252/222/344/275/223/media-platform-packaging/references/platform-posting-times.md +193 -0
  43. package/templates/ai-tools/skills//350/207/252/345/252/222/344/275/223/uc-media-0005-ideation/SKILL.md +42 -0
  44. package/templates/ai-tools/skills//350/207/252/345/252/222/344/275/223/uc-media-0005-ideation/templates/topic-backlog.template.md +50 -0
  45. package/templates/ai-tools/skills//350/207/252/345/252/222/344/275/223/uc-media-0005-ideation/templates//351/200/211/351/242/230/346/261/240.template.md +16 -0
  46. package/templates/ai-tools/skills//350/207/252/345/252/222/344/275/223/uc-media-0010-product/SKILL.md +106 -0
  47. package/templates/ai-tools/skills//350/207/252/345/252/222/344/275/223/uc-media-0010-product/templates/channel-profile.template.md +52 -0
  48. package/templates/ai-tools/skills//350/207/252/345/252/222/344/275/223/uc-media-0010-product/templates//344/272/247/345/223/201/345/215/241.template.md +132 -0
  49. package/templates/ai-tools/skills//350/207/252/345/252/222/344/275/223/uc-media-0030-facts/SKILL.md +60 -0
  50. package/templates/ai-tools/skills//350/207/252/345/252/222/344/275/223/uc-media-0030-facts/scripts/build_facts_html.py +430 -0
  51. package/templates/ai-tools/skills//350/207/252/345/252/222/344/275/223/uc-media-0030-facts/scripts/generate_html.py +1287 -0
  52. package/templates/ai-tools/skills//350/207/252/345/252/222/344/275/223/uc-media-0030-facts/scripts/generate_report.py +189 -0
  53. package/templates/ai-tools/skills//350/207/252/345/252/222/344/275/223/uc-media-0030-facts/templates//344/272/213/345/256/236/350/265/204/346/226/231/345/272/223.template.md +55 -0
  54. package/templates/ai-tools/skills//350/207/252/345/252/222/344/275/223/uc-media-0040-script/SKILL.md +36 -0
  55. package/templates/ai-tools/skills//350/207/252/345/252/222/344/275/223/uc-media-0040-script/templates/README.md +10 -0
  56. package/templates/ai-tools/skills//350/207/252/345/252/222/344/275/223/uc-media-0040-script/templates//344/272/213/345/256/236.template.md +82 -0
  57. package/templates/ai-tools/skills//350/207/252/345/252/222/344/275/223/uc-media-0040-script/templates//345/215/225/351/233/206/346/226/207/346/241/243.template.md +175 -0
  58. package/templates/ai-tools/skills//350/207/252/345/252/222/344/275/223/uc-media-0040-script/templates//350/204/232/346/234/254.template.md +69 -0
  59. package/templates/ai-tools/skills//350/207/252/345/252/222/344/275/223/uc-media-0040-script/templates//351/252/250/346/236/266-v1.1.md +174 -0
  60. package/templates/ai-tools/skills//350/207/252/345/252/222/344/275/223/uc-media-0050-design/SKILL.md +55 -0
  61. package/templates/ai-tools/skills//350/207/252/345/252/222/344/275/223/uc-media-0060-assets/SKILL.md +29 -0
  62. package/templates/ai-tools/skills//350/207/252/345/252/222/344/275/223/uc-media-0070-package/SKILL.md +42 -0
  63. package/templates/ai-tools/skills//350/207/252/345/252/222/344/275/223/uc-media-0070-package/scripts/validate_shots.py +207 -0
  64. package/templates/ai-tools/skills//350/207/252/345/252/222/344/275/223/uc-media-0070-package/shots.schema.json +186 -0
  65. package/templates/ai-tools/skills//350/207/252/345/252/222/344/275/223/uc-media-0070-package//344/272/272/345/256/241/345/214/205.template.md +1 -0
  66. package/templates/ai-tools/skills//350/207/252/345/252/222/344/275/223/uc-media-0070-package//344/272/272/345/256/241/350/257/264/346/230/216.md +15 -0
  67. package/templates/ai-tools/skills//350/207/252/345/252/222/344/275/223/uc-media-0070-package//346/210/220/347/211/207/345/214/205.template.md +49 -0
  68. package/templates/ai-tools/skills//350/207/252/345/252/222/344/275/223/uc-media-0080-factory/SKILL.md +58 -0
  69. package/templates/ai-tools/skills//350/207/252/345/252/222/344/275/223/uc-media-comic-kit/SKILL.md +424 -0
  70. package/templates/ai-tools/skills//350/207/252/345/252/222/344/275/223/uc-media-comic-kit/evals.md +41 -0
  71. package/templates/ai-tools/skills//350/207/252/345/252/222/344/275/223/uc-media-flow/CONTRACT.md +123 -0
  72. package/templates/ai-tools/skills//350/207/252/345/252/222/344/275/223/uc-media-flow/SKILL.md +81 -0
  73. package/templates/ai-tools/skills//350/207/252/345/252/222/344/275/223/uc-media-flow//346/211/247/350/241/214/346/270/205/345/215/225.template.md +60 -0
  74. package/templates/ai-tools/skills//350/207/252/345/252/222/344/275/223/uc-media-knowledge-town/SKILL.md +78 -0
  75. package/templates/ai-tools/skills//350/207/252/345/252/222/344/275/223/uc-media-knowledge-town/agents/openai.yaml +4 -0
  76. package/templates/ai-tools/skills//350/207/252/345/252/222/344/275/223/uc-media-knowledge-town/assets/knowledge-town-paper-film-v1.json +80 -0
  77. package/templates/ai-tools/skills//350/207/252/345/252/222/344/275/223/uc-media-knowledge-town/assets/remotion/AudioTracks.tsx +20 -0
  78. package/templates/ai-tools/skills//350/207/252/345/252/222/344/275/223/uc-media-knowledge-town/assets/remotion/CaptionLayer.tsx +18 -0
  79. package/templates/ai-tools/skills//350/207/252/345/252/222/344/275/223/uc-media-knowledge-town/assets/remotion/CueTimeline.ts +24 -0
  80. package/templates/ai-tools/skills//350/207/252/345/252/222/344/275/223/uc-media-knowledge-town/assets/remotion/KnowledgeTownComposition.tsx +21 -0
  81. package/templates/ai-tools/skills//350/207/252/345/252/222/344/275/223/uc-media-knowledge-town/references/cinematic-direction.md +73 -0
  82. package/templates/ai-tools/skills//350/207/252/345/252/222/344/275/223/uc-media-knowledge-town/references/sticker-asset-production.md +30 -0
  83. package/templates/ai-tools/skills//350/207/252/345/252/222/344/275/223/uc-media-knowledge-town/references/style-guide.md +43 -0
  84. package/templates/ai-tools/skills//350/207/252/345/252/222/344/275/223/uc-media-knowledge-town/scripts/build_cue_timeline.py +75 -0
  85. package/templates/ai-tools/skills//350/207/252/345/252/222/344/275/223/uc-media-knowledge-town/scripts/validate_cue_timeline.py +68 -0
  86. package/templates/ai-tools/skills//350/207/252/345/252/222/344/275/223/uc-media-knowledge-town/scripts/validate_style_preset.py +22 -0
  87. package/templates/ai-tools/skills/unitcircle/uc-deploy-audit/SKILL.md +0 -511
  88. package/templates/ai-tools/skills/unitcircle/uc-deploy-audit/references/checks-data.md +0 -126
  89. package/templates/ai-tools/skills/unitcircle/uc-deploy-audit/references/checks-network.md +0 -88
  90. package/templates/ai-tools/skills/unitcircle/uc-deploy-audit/references/checks-runtime.md +0 -195
  91. package/templates/ai-tools/skills/unitcircle/uc-deploy-audit/references/security-doc-search.md +0 -179
  92. package/templates/ai-tools/skills/unitcircle/uc-deploy-audit/scripts/check_base.sh +0 -39
  93. package/templates/ai-tools/skills/unitcircle/uc-deploy-audit/scripts/check_capacity.sh +0 -278
  94. package/templates/ai-tools/skills/unitcircle/uc-deploy-audit/scripts/check_db.sh +0 -147
  95. package/templates/ai-tools/skills/unitcircle/uc-deploy-audit/scripts/check_docker.sh +0 -230
  96. package/templates/ai-tools/skills/unitcircle/uc-deploy-audit/scripts/check_env.sh +0 -64
  97. package/templates/ai-tools/skills/unitcircle/uc-deploy-audit/scripts/check_https.sh +0 -60
  98. package/templates/ai-tools/skills/unitcircle/uc-deploy-audit/scripts/check_logs.sh +0 -209
  99. package/templates/ai-tools/skills/unitcircle/uc-deploy-audit/scripts/check_nginx.sh +0 -100
  100. package/templates/ai-tools/skills/unitcircle/uc-deploy-audit/scripts/check_resilience.sh +0 -157
  101. package/templates/ai-tools/skills/unitcircle/uc-deploy-audit/scripts/check_secrets.sh +0 -265
  102. package/templates/ai-tools/skills/unitcircle/uc-deploy-audit/scripts/check_services.sh +0 -94
  103. package/templates/ai-tools/skills/unitcircle/uc-deploy-audit/scripts/check_ssh.sh +0 -56
  104. package/templates/ai-tools/skills/unitcircle/uc-deploy-audit/scripts/run_all.sh +0 -105
@@ -1,88 +0,0 @@
1
- # Deploy Audit — 网络与传输安全检查规则
2
-
3
- > **何时读这份:** 当 AI 即将运行 4.1 / 4.2 / 4.4 / 4.7 类检查或解读其输出时读取本文件。
4
-
5
- 本文件聚焦"网络与传输安全"维度的检查规则、严重度判定与输出格式。涵盖 SSH、Nginx、HTTPS 证书、依赖服务连通性。
6
-
7
- 脚本目录简称 `{scripts}` = `../scripts/`。
8
-
9
- ---
10
-
11
- ## 4.1 SSH 安全 — `{scripts}/check_ssh.sh`
12
-
13
- | 检查项 | 期望值 | 严重级 |
14
- |--------|--------|--------|
15
- | `PermitRootLogin` | `no` 或 `prohibit-password` | **critical** |
16
- | `PasswordAuthentication` | `no` (强制 key) | **high** |
17
- | `PermitEmptyPasswords` | `no` | **critical** |
18
- | `Port` | 非默认 22 (建议) | medium |
19
- | `Protocol` | 只允许 2 | high |
20
- | `MaxAuthTries` | ≤ 4 | medium |
21
- | `LoginGraceTime` | ≤ 60s | low |
22
- | `AllowUsers` / `AllowGroups` | 已配置白名单 | medium |
23
- | `/var/log/auth.log` 或 `journalctl _COMM=sshd` | 有日志 | high |
24
- | fail2ban / sshguard | 已安装并运行 | medium |
25
-
26
- ---
27
-
28
- ## 4.2 Nginx 配置 — `{scripts}/check_nginx.sh`
29
-
30
- | 检查项 | 期望值 | 严重级 |
31
- |--------|--------|--------|
32
- | HTTP → HTTPS 强制跳转 | 80 端口 return 301 至 https | **critical** |
33
- | `ssl_protocols` | 仅 `TLSv1.2 TLSv1.3` | high |
34
- | `ssl_ciphers` | 排除弱加密(RC4/3DES/MD5) | high |
35
- | `server_tokens` | `off` | medium |
36
- | `access_log` | 已开启 | **high**(用户特别要求) |
37
- | `error_log` | 已开启,级别 ≥ warn | high |
38
- | `client_max_body_size` | 显式配置,业务非上传 ≤ 10m | medium |
39
- | `limit_req_zone` 已定义 | 至少 1 个 zone(防 CC 攻击 / 暴力请求) | high |
40
- | `limit_req` 应用到敏感路由 | 登录 / 注册 / 验证码 / 高频 API 必须有 | **critical** |
41
- | `limit_conn_zone` + `limit_conn` | 限制同 IP 高并发连接 | medium |
42
- | `limit_req_status` | 建议 `429`(默认 503 易被误判为后端故障) | low |
43
- | `client_body_timeout` / `client_header_timeout` | ≤ 10s(防 slowloris 慢速攻击) | medium |
44
- | `add_header Strict-Transport-Security` | `max-age=31536000` | high |
45
- | `add_header X-Frame-Options` | `DENY` 或 `SAMEORIGIN` | medium |
46
- | `add_header X-Content-Type-Options` | `nosniff` | medium |
47
- | `add_header Content-Security-Policy` | 已配置 | low |
48
- | `autoindex` | `off` | high |
49
- | 暴露的 location | 排查 `/.git`、`/.env`、`/admin` 是否泄漏 | **critical** |
50
- | Nginx 版本 | 非已知 CVE 版本 | medium |
51
-
52
- **Nginx 版本判定补充:**
53
-
54
- - 先查官方配置语义:
55
- - headers 模块:`https://nginx.org/en/docs/http/ngx_http_headers_module.html`
56
- - SSL 模块:`https://nginx.org/en/docs/http/ngx_http_ssl_module.html`
57
- - 再查版本安全:
58
- - 搜索词:`nginx <version> security advisory`、`nginx <version> CVE`
59
- - 优先来源:Nginx 官方公告、NVD、CISA KEV
60
- - 分级规则:
61
- - 命中 **CISA KEV** 或存在明确在野利用记录 → **critical**
62
- - 命中高危 CVE(建议按 CVSS ≥ 7.0 参考),但未见在野利用 → high
63
- - 未命中高危 CVE,但版本明显老旧且缺少后续安全修复依据 → medium
64
- - 如果只是配置项(如 `ssl_protocols`、`ssl_stapling`、`add_header ... always`)语义不清,不按“版本风险”报,改为引用官方模块文档解释配置风险。
65
-
66
- ---
67
-
68
- ## 4.4 HTTPS 证书 — `{scripts}/check_https.sh`
69
-
70
- | 检查项 | 期望值 | 严重级 |
71
- |--------|--------|--------|
72
- | 证书有效期 | 剩余 > 30 天 | high (< 7 天 critical) |
73
- | 证书域名匹配 | CN/SAN 包含访问域名 | **critical** |
74
- | 证书链完整 | 中间证书已配置 | high |
75
- | 自签证书 | 仅内网允许,公网为 critical | varies |
76
- | OCSP Stapling | 已启用 | low |
77
-
78
- ---
79
-
80
- ## 4.7 依赖服务连通性 — `{scripts}/check_services.sh`
81
-
82
- | 检查项 | 期望值 | 严重级 |
83
- |--------|--------|--------|
84
- | 内部服务端口 | 仅内网/loopback 可达 | high |
85
- | 健康检查端点 | 返回 200 | medium |
86
- | 跨服务网络 | 应用 → DB/Redis 连通正常 | info |
87
- | 防火墙规则 | iptables / ufw / firewalld 已启用 | high |
88
- | 外部访问入口 | 仅 80/443 + SSH 端口 | high |
@@ -1,195 +0,0 @@
1
- # Deploy Audit — 运行时与韧性检查规则
2
-
3
- > **何时读这份:** 当 AI 即将运行 4.6 / 4.8 / 4.9 / 4.10 类检查或解读其输出时读取本文件。
4
-
5
- 本文件聚焦"运行时与韧性"维度的检查规则、严重度判定与输出格式。涵盖 Docker 安全、自愈与资源耗尽防护、日志大小与防爆、硬件识别与资源推荐。
6
-
7
- 脚本目录简称 `{scripts}` = `../scripts/`。
8
-
9
- ---
10
-
11
- ## 4.6 Docker 安全 — `{scripts}/check_docker.sh`
12
-
13
- | 检查项 | 期望值 | 严重级 |
14
- |--------|--------|--------|
15
- | `/var/run/docker.sock` 挂载到容器 | 仅可信容器 | **critical** |
16
- | 容器以 root 运行 | 应使用非 root user | high |
17
- | 端口绑定 | DB/Redis 等内部服务**不应** `0.0.0.0:5432` 暴露 | **critical** |
18
- | 镜像 tag = `:latest` 或省略 tag | 固定到具体 patch | **critical** |
19
- | 镜像 tag = 浮动 tag(`:stable` `:mainline` `:alpine` `:bookworm` `:slim` `:edge` `:nightly` 等) | 固定到具体 patch | high |
20
- | 镜像 tag = 仅 major(`:7` `:16`) | 至少到 minor,推荐到 patch | high |
21
- | 镜像 tag = `major.minor`(`:7.4`)| 固定到 patch(`:7.4.9`) | medium |
22
- | 镜像 tag = `@sha256:...` digest | — | OK 加分 |
23
- | `--privileged` 容器 | 无 | **critical** |
24
- | Docker 版本 | 非已知 CVE 版本 | medium |
25
- | Docker daemon 远程 API | 未暴露 2375/2376 公网 | **critical** |
26
- | 容器 `RestartPolicy` | `always` 或 `unless-stopped`(**服务器重启后自动起来**) | **critical** |
27
- | 容器 `RestartPolicy=no` 但正在 running | 不允许(重启会丢) | **critical** |
28
- | 容器 `RestartPolicy=on-failure` | 不推荐(手动 stop / OOM 后不会重启) | high |
29
- | daemon 日志驱动 `log-opts.max-size` | 已配置(≤ 100m,防容器日志写满磁盘) | high |
30
- | **daemon `registry-mirrors`** | 已配置至少 1 个 mirror(按服务器所在地区选择) | medium(未配置) / info |
31
- | **运行容器使用境外 registry**(`gcr.io` `ghcr.io` `k8s.gcr.io` `quay.io` `mcr.microsoft.com` `nvcr.io` `docker.elastic.co`) | `registry-mirrors` 不对它们生效, 拉取加速需自行解决 | info |
32
-
33
- **Docker 版本与暴露面判定补充:**
34
-
35
- - 官方基础文档:
36
- - Engine security:`https://docs.docker.com/engine/security/`
37
- - daemon remote access:`https://docs.docker.com/engine/daemon/remote-access/`
38
- - logging driver:`https://docs.docker.com/engine/logging/configure/`
39
- - OWASP Docker Security Cheat Sheet:`https://cheatsheetseries.owasp.org/cheatsheets/Docker_Security_Cheat_Sheet.html`
40
- - 版本安全搜索词:
41
- - `docker engine <version> CVE`
42
- - `docker <version> security advisory`
43
- - 分级规则:
44
- - 命中 **CISA KEV**,或 Docker daemon TCP 端口公网暴露且无充分保护 → **critical**
45
- - 命中高危 CVE(建议按 CVSS ≥ 7.0 参考),但当前未见在野利用 → high
46
- - 未命中高危 CVE,但版本过旧且缺少持续维护依据 → medium
47
- - `docker.sock` 挂载、`--privileged`、2375/2376 暴露属于**配置暴露面**,优先按当前表里的配置项分级,不要被“版本没问题”掩盖。
48
-
49
- ---
50
-
51
- ## 4.8 自愈与资源耗尽防护 — `{scripts}/check_resilience.sh`
52
-
53
- 服务器意外重启后能否自动恢复,以及在异常负载下能否守住底线。
54
-
55
- **B. 系统服务开机自启**(默认清单 + 自动探测)
56
-
57
- | 检查项 | 期望值 | 严重级 |
58
- |--------|--------|--------|
59
- | `sshd` is-enabled | enabled(不起就再也连不上) | **critical** |
60
- | `nginx` is-enabled | enabled | **critical** |
61
- | `docker` is-enabled | enabled(影响所有容器) | **critical** |
62
- | `postgresql` is-enabled | enabled | **critical** |
63
- | `redis` / `redis-server` is-enabled | enabled | high |
64
- | `fail2ban` is-enabled(如安装) | enabled | medium |
65
- | 应用主进程 systemd unit | enabled | **critical** |
66
- | running 但 disabled 的服务 | 不应存在(重启即丢失) | high |
67
- | 自动探测:`systemctl list-unit-files --state=enabled` | 输出供人工核对应用进程是否在内 | info |
68
-
69
- **D. 资源耗尽防护**
70
-
71
- | 检查项 | 期望值 | 严重级 |
72
- |--------|--------|--------|
73
- | `swap` 已配置 | ≥ 1GB(OOM 缓冲) | medium |
74
- | 根分区使用率 | < 80% | medium(≥ 90% critical) |
75
- | `/etc/logrotate.conf` 存在 | 是 | high |
76
- | 关键服务有 `/etc/logrotate.d/<name>` | nginx / postgresql / redis 等都应有 | high |
77
- | nginx / postgres / redis 进程 `ulimit -n` | ≥ 4096,建议 65535 | medium |
78
- | `/proc/pressure/memory`(PSI) | 输出供观察当前内存压力 | info |
79
- | 容器 `HostConfig.Memory` | 关键容器应有内存上限 | medium |
80
-
81
- ---
82
-
83
- ## 4.9 日志大小与防爆检查 — `{scripts}/check_logs.sh`
84
-
85
- 防止日志写满磁盘把整机拖垮。check_resilience.sh 的 D 节给的是宏观信号(`/var/log` 总大小、logrotate 是否存在),本节按"日志源"细化到单文件粒度,并基于容器存活时长粗估"撑天数"。
86
-
87
- | 检查项 | 期望值 | 严重级 |
88
- |--------|--------|--------|
89
- | Docker 单容器 `*-json.log` 大小 | < 500 MB(daemon 配 log-opts max-size 时自动控) | high(>500 MB) / critical(>1 GB 且 daemon 无 log-opts) |
90
- | 容器自身 `LogConfig.Config` 覆盖 | 至少有 `max-size`,否则继承 daemon | high(容器 + daemon 都没配) |
91
- | Docker daemon `log-opts.max-size` | 已配置 ≤ 100m | high(同 check_docker.sh,本节关联展开) |
92
- | Nginx access.log / error.log 单文件 | < 500 MB | high |
93
- | `/etc/logrotate.d/nginx` | 存在 | high |
94
- | `journalctl --disk-usage` | < 2 GB | medium / high(≥ 2 GB 且 SystemMaxUse 未配) |
95
- | `/etc/systemd/journald.conf` `SystemMaxUse` | 已显式配置 | low |
96
- | 应用日志目录(`/var/log/<svc>` / `/opt/*/logs` / `/home/*/logs` / `/srv/*/logs`) | 列出 Top 10 供人工核对 | info |
97
- | 日志按当前 docker 容器存活时长粗估的撑天数 | > 90 天 | high(<90) / critical(<30) |
98
-
99
- **输出规约:** 脚本会汇总 `Docker json-log + Nginx + journal + 应用日志` 总占用,对照根盘可用空间,给出"按 docker 当前增速预计可撑 N 天"的粗估。粗估只算 docker json-log 增量,不含数据库/应用日志业务增量,因此**结论偏乐观**,作为下限警示使用。
100
-
101
- ---
102
-
103
- ## 4.10 硬件识别与资源推荐 — `{scripts}/check_capacity.sh`
104
-
105
- > 脚本只输出 raw(硬件规格 + 当前容器 mem_limit + Postgres/Redis 启动参数 + compose 资源声明);主 Claude 用下表生成 "推荐 vs 当前" 对比报告。
106
-
107
- **容器资源推荐分级表(按宿主总内存)**
108
-
109
- | 宿主总内存 | Backend mem_limit | Postgres mem_limit / shm_size / shared_buffers / effective_cache_size | Redis mem_limit / maxmemory |
110
- |-----------|-------------------|--------------------------------------------------------------------|----------------------------|
111
- | 2 GB | 384m | 512m / 128m / 128MB / 384MB | 256m / 180mb |
112
- | 4 GB | 1g | 1g / 256m / 256MB / 768MB | 384m / 256mb |
113
- | 8 GB | 2g | 2g / 512m / 512MB / 1536MB | 768m / 512mb |
114
- | 16 GB | 4g | 4g / 1g / 1GB / 3GB | 1g / 700mb |
115
-
116
- **配比原则**
117
-
118
- - 容器 `mem_limit` 合计 ≤ 宿主总内存的 **65%**(预留 OS / 全局 nginx / 监控 agent 等)
119
- - Postgres `shared_buffers` = 容器 `mem_limit` 的 **25%**
120
- - Postgres `effective_cache_size` = 容器 `mem_limit` 的 **75%**
121
- - Redis `maxmemory` = 容器 `mem_limit` 的 **70%**(剩 30% 给 RDB/AOF fork 时 COW 留 buffer)
122
- - Redis `mem_limit` = `maxmemory ÷ 0.7` 向上取整
123
-
124
- **对比报告格式(主 Claude 在报告里生成)**
125
-
126
- ```
127
- | 服务 | 配置项 | 推荐(基于 X GB 宿主) | 当前 | 状态 |
128
- |------|--------|--------------------|------|------|
129
- | backend | mem_limit | 1g | 无 | ❌ 缺失 |
130
- | db | mem_limit | 1g | 1g | ✅ |
131
- | db | shared_buffers | 256MB | 128MB(默认) | ⚠️ 偏低 |
132
- | db | shm_size | 256m | 64m(默认) | ⚠️ 偏低 |
133
- | redis | maxmemory | 256mb | 256mb | ✅ |
134
- | redis | mem_limit | 384m | 384m | ✅ |
135
- | redis | appendonly | yes | no | ⚠️ 重启丢数据 |
136
- ```
137
-
138
- **严重等级标记规则**
139
-
140
- | 检查项 | 期望值 | 严重级 |
141
- |--------|--------|--------|
142
- | 关键服务(redis / postgres / mysql / mongo / clickhouse / elasticsearch)容器无 `mem_limit` | 已设置 | high |
143
- | Redis `--maxmemory` 未设置或 `0` | 已设置 | **critical** |
144
- | Postgres `shared_buffers` > 宿主总内存 50% | ≤ 宿主总内存 50% | high |
145
- | Postgres `shm_size` < 128m | ≥ 256m | medium |
146
- | Redis 未启用 AOF(`--appendonly yes`) | yes | medium |
147
- | 容器 `mem_limit` 合计 > 宿主总内存 75% | ≤ 65% | high |
148
- | `mem_limit` 偏离推荐表 ±50% 以上(主 Claude 判定) | 在分级表区间内 | medium |
149
-
150
- ---
151
-
152
- ### 日志大小推荐分级表(防容器日志无限增长撑爆磁盘)
153
-
154
- 依据是 `<根盘容量>` × `<容器规模>`,**单容器最大日志占用 = `max-size` × `max-file`**;所有容器日志合计应 ≤ 根盘可用空间的 **5%**(留磁盘给数据/swap/OS)。
155
-
156
- **daemon 兜底配置(`/etc/docker/daemon.json` `log-opts`)**
157
-
158
- | 宿主规格 | 根盘 | 容器数(估) | `max-size` | `max-file` | 单容器 quota | 备注 |
159
- |---------|------|-----------|------------|-----------|-------------|------|
160
- | 入门 | < 50 GB | 任意 | `10m` | `3` | ~30 MB | 2-4 GB VM 入门款,日志少留磁盘 |
161
- | 标准 | 50-150 GB | ≤ 5 | `50m` | `5` | ~250 MB | 4-8 GB VM 通用 |
162
- | 标准 | 50-150 GB | > 5 | `20m` | `5` | ~100 MB | 容器多则降单容器 quota |
163
- | 大型 | > 150 GB | 任意 | `100m` | `5` | ~500 MB | 16+ GB 服务器,空间充裕 |
164
-
165
- **容器级覆盖(compose `logging.options`,优先于 daemon)**
166
-
167
- | 容器类型 | `max-size` | `max-file` | 理由 |
168
- |---------|-----------|-----------|------|
169
- | 数据库 (postgres / mysql / mongo) | `20m` | `10` | 慢查询日志价值高,保留更多滚动 |
170
- | Web 反代 (nginx access log 走 stdout) | `50m` | `5` | 写入量大,单文件可放宽 |
171
- | 应用后端 (FastAPI / Node 等) | `10m` | `5` | 通用 |
172
- | Redis / 缓存类 | `10m` | `3` | 写入少,保留少 |
173
-
174
- **daemon.json 模板**
175
-
176
- ```json
177
- {
178
- "log-driver": "json-file",
179
- "log-opts": {
180
- "max-size": "50m",
181
- "max-file": "5",
182
- "compress": "true"
183
- }
184
- }
185
- ```
186
-
187
- **严重等级标记(脚本侧 + 主 Claude 对照表)**
188
-
189
- | 判定 | 严重级 |
190
- |------|--------|
191
- | daemon 无 `log-opts.max-size` 且容器也无 `LogConfig.Config` | **critical** |
192
- | daemon `max-size` > 推荐档 50% 以上(如根盘 < 50 GB 用 100m) | high |
193
- | 容器无 `LogConfig.Config` 但 daemon 有兜底 | OK(走 daemon) |
194
- | 容器 `LogConfig.Config` 设了但 max-size 偏离推荐档 ±50% | medium |
195
- | 估算所有容器日志合计 > 根盘可用 5% | high |
@@ -1,179 +0,0 @@
1
- ## 权威安全文档检索
2
-
3
- 当 `references/checks-*.md` 无法覆盖以下场景时,先查权威文档,再下结论:
4
-
5
- - 目标版本是否存在已知高危 CVE
6
- - 某个配置项语义不确定
7
- - audit 输出与经验规则冲突
8
- - 用户要求“按官方安全文档”解释
9
- - 需要把新发现沉淀回本 skill
10
-
11
- ---
12
-
13
- ## 检索优先级
14
-
15
- 1. **官方产品文档 / 官方安全页**
16
- 2. **官方维护的版本公告 / 安全公告 / release notes**
17
- 3. **CISA KEV / NVD / CVE 记录**
18
- 4. **OWASP Cheat Sheet**
19
-
20
- 禁止把论坛、博客、聚合站当一手依据。
21
-
22
- ---
23
-
24
- ## 固定检索策略
25
-
26
- ### 1. 先查“配置语义”
27
-
28
- 按产品名 + 配置项名搜索,优先官方文档:
29
-
30
- - `OpenSSH sshd_config PermitRootLogin PasswordAuthentication official`
31
- - `nginx ssl_protocols ssl_stapling add_header official`
32
- - `PostgreSQL listen_addresses ssl official`
33
- - `Redis protected mode bind requirepass official`
34
- - `Docker daemon remote access docker.sock log-driver official`
35
-
36
- 目标:确认该配置项的**官方含义、默认值、启用条件、版本约束**。
37
-
38
- ### 2. 再查“版本安全”
39
-
40
- 当 audit 输出包含版本号时,按 `产品 + 版本 + CVE` 搜:
41
-
42
- - `nginx 1.24.0 CVE`
43
- - `postgresql 15.6 CVE`
44
- - `redis 7.2.4 CVE`
45
- - `docker engine 26.1.4 CVE`
46
-
47
- 目标:确认是否存在:
48
-
49
- - 高危未修复漏洞
50
- - 该版本已被官方宣布 EOL
51
- - 配置项依赖的最小版本门槛
52
-
53
- ### 3. 最后查“硬化基线”
54
-
55
- 当官方文档只解释语义、不直接给安全基线时,补查:
56
-
57
- - `OWASP Docker Security Cheat Sheet`
58
- - `CISA Known Exploited Vulnerabilities`
59
- - 产品官方 security / advisories 页面
60
-
61
- 目标:把“语义”转成“审计期望值”。
62
-
63
- ---
64
-
65
- ## 推荐来源清单
66
-
67
- ### SSH / OpenSSH
68
-
69
- - OpenSSH `sshd_config` 手册:`https://man.openbsd.org/sshd_config`
70
-
71
- 重点看:
72
-
73
- - `PermitRootLogin`
74
- - `PasswordAuthentication`
75
- - `PermitEmptyPasswords`
76
- - `AllowUsers` / `AllowGroups`
77
-
78
- ### Nginx / HTTPS
79
-
80
- - Nginx headers 模块:`https://nginx.org/en/docs/http/ngx_http_headers_module.html`
81
- - Nginx SSL 模块:`https://nginx.org/en/docs/http/ngx_http_ssl_module.html`
82
-
83
- 重点看:
84
-
85
- - `add_header ... always`
86
- - `ssl_protocols`
87
- - `ssl_stapling`
88
- - `ssl_stapling_verify`
89
-
90
- ### PostgreSQL
91
-
92
- - 连接与认证:`https://www.postgresql.org/docs/current/runtime-config-connection.html`
93
-
94
- 重点看:
95
-
96
- - `listen_addresses`
97
- - `port`
98
- - `ssl`
99
-
100
- ### Redis
101
-
102
- - Redis Security:`https://redis.io/docs/latest/operate/oss_and_stack/management/security/`
103
-
104
- 重点看:
105
-
106
- - `bind`
107
- - `protected mode`
108
- - 外网暴露风险
109
-
110
- ### Docker
111
-
112
- - Docker Engine security:`https://docs.docker.com/engine/security/`
113
- - Docker daemon remote access:`https://docs.docker.com/engine/daemon/remote-access/`
114
- - Docker logging drivers:`https://docs.docker.com/engine/logging/configure/`
115
- - OWASP Docker Security Cheat Sheet:`https://cheatsheetseries.owasp.org/cheatsheets/Docker_Security_Cheat_Sheet.html`
116
-
117
- 重点看:
118
-
119
- - daemon attack surface
120
- - `docker.sock`
121
- - TCP remote API
122
- - capabilities / privileged
123
- - `log-driver`
124
-
125
- ### CVE / 漏洞情报
126
-
127
- - CISA KEV:`https://www.cisa.gov/known-exploited-vulnerabilities-catalog`
128
- - NVD:`https://nvd.nist.gov/`
129
-
130
- 用途:
131
-
132
- - 判断某版本是否已有**被在野利用**漏洞
133
- - 给 critical / high 分级补外部依据
134
-
135
- ---
136
-
137
- ## 审计时何时必须检索
138
-
139
- 以下情况不得只靠本地规则:
140
-
141
- 1. `references/checks-*.md` 写着“非已知 CVE 版本”,但当前没附具体依据
142
- 2. audit 输出出现明确版本号,且版本看起来偏旧
143
- 3. 某项默认值与当前发行版可能有漂移
144
- 4. 需要判断某项该算 `critical` 还是 `high`
145
- 5. 用户要求“给官方文档链接”
146
-
147
- ---
148
-
149
- ## 沉淀规则
150
-
151
- 如果检索得到**稳定、可复用、非一次性**的信息,必须回写:
152
-
153
- - 配置语义类 → 更新对应 `references/checks-network.md` / `references/checks-data.md` / `references/checks-runtime.md`
154
- - 检索方法类 → 更新本文件
155
- - 仅某产品某版本临时漏洞 → 不写入长期规则,只在本次报告引用
156
-
157
- 判断“适合沉淀”的标准:
158
-
159
- - 下次审计大概率还会遇到
160
- - 不是某个用户私有环境特例
161
- - 可以转化为明确检查项、期望值或检索模板
162
-
163
- ---
164
-
165
- ## 输出要求
166
-
167
- 当使用了外部文档,报告里的失败项详情至少补 1 个权威链接:
168
-
169
- - 官方文档优先
170
- - 漏洞项可追加 CISA KEV 或 NVD
171
- - 不引用二手博客作唯一依据
172
-
173
- 格式建议:
174
-
175
- ```markdown
176
- - 参考:
177
- - https://www.postgresql.org/docs/current/runtime-config-connection.html
178
- - https://nvd.nist.gov/
179
- ```
@@ -1,39 +0,0 @@
1
- #!/usr/bin/env bash
2
- # 基础环境识别: OS / 监听端口 / 运行服务 / Docker
3
- TARGET="$1"; shift
4
- SSH_OPTS=("$@")
5
-
6
- ssh "${SSH_OPTS[@]}" "${TARGET}" bash -s <<'REMOTE'
7
- echo "--- OS ---"
8
- cat /etc/os-release 2>/dev/null | grep -E "^(NAME|VERSION|ID)=" || echo "unknown"
9
- uname -a
10
-
11
- echo "--- KERNEL ---"
12
- uname -r
13
-
14
- echo "--- LISTENING PORTS (TCP) ---"
15
- (ss -tlnp 2>/dev/null || netstat -tlnp 2>/dev/null) | head -50
16
-
17
- echo "--- LISTENING PORTS (UDP) ---"
18
- (ss -ulnp 2>/dev/null || netstat -ulnp 2>/dev/null) | head -30
19
-
20
- echo "--- ESTABLISHED CONNECTIONS (sample) ---"
21
- (ss -tn state established 2>/dev/null || netstat -tn 2>/dev/null) | head -20
22
-
23
- echo "--- RUNNING SERVICES ---"
24
- systemctl list-units --type=service --state=running --no-pager 2>/dev/null | head -40
25
-
26
- echo "--- INSTALLED RELEVANT BINARIES ---"
27
- for cmd in nginx postgres psql redis-cli docker openssl ufw firewall-cmd iptables fail2ban-client; do
28
- path=$(command -v "$cmd" 2>/dev/null || true)
29
- printf " %-20s %s\n" "$cmd" "${path:-<not installed>}"
30
- done
31
-
32
- echo "--- PUBLIC IP (best effort) ---"
33
- curl -fsS --max-time 5 https://api.ipify.org 2>/dev/null || hostname -I | awk '{print $1}'
34
- echo
35
-
36
- echo "--- USER & SUDO ---"
37
- id
38
- sudo -n -l 2>/dev/null | head -5 || echo "no passwordless sudo"
39
- REMOTE