chore: SSO-only 精简版初始提交(从 ipass-all 派生)

**影响**:新建独立仓 ipass-sso 作为 ipass-all 的 SSO-only 精简发行版——
剔除了 domain / llm / apix / cache / waf 5 个插件及对应的 nginx location
与 LLM/域名数据面 server,PLUGINS 数组只剩 sso + core,单 .so 体积与编
译时间同步下降。镜像名沿用 ssw188/nginx(同 repo 加 tag),新 tag
`ipass-sso-v0.6.0`,K8s 部署在 wuguirong ns NodePort 30082,与生产
ipass-all-v0.5.2 (30083/30084/30085) 并存互不干扰。

**改动**:
- `rust/Cargo.toml` + `rust/gateway/Cargo.toml`:删 5 个 plugin path 依赖,
  package/lib 重命名为 `ipass-sso-gateway` / `libipass_sso_gateway`
- `rust/gateway/src/lib.rs`:PLUGINS 只剩 `&SsoPlugin` + `&CorePlugin`;
  GatewayExt 4 个方法改为 no-op / 返回默认值(无 domain/llm 装饰);
  ModuleConfig 只剩 api + iap 两个开关;NGX_HTTP_COMMANDS 数组 11→4 条;
  init_process / exit_process 删 llm audit / stats persist 调用;
  state_zone_init 删 domain/upstreams/apix 的预装载
- `rust/gateway/src/api.rs`:删除(h_admin_trend 依赖 llm + apix)
- `deploy/nginx.conf`:删 server 498 (LLM) + server 565 (域名);
  主 server 删 `/apix/` `/apixp/` `/_apix_probe/` 等 7 个 location;
  删 6 条 `proxy_cache_path` 与 8 个 cache location;删 `ipass_audit_dir` 指令
- `deploy/Dockerfile`:删 5 个 plugin named context 的 COPY 块;
  .so 文件名改 `libipass_sso_gateway.so`
- `deploy/build.sh`:TAG 默认 `ipass-sso-v0.6.0`;
  5 个 plugin build-context 删除;删 collect-legacy.sh 调用
- `data-seed/plugin-config.json`:只保留 `sso` 一个 plugin
- `scripts/collect-plugin-dist.sh`:PLUGINS 默认值改 `sso`
- `scripts/container-entrypoint.sh`:删 cache/audit 目录预创建
- `deploy/legacy/` `tests/` `docs/` `deploy/custom/` `deploy/compose.yml`:
  精简版不需要,删除
- `deploy/k8s/ipass-sso.yaml`:新建精简版 K8s manifest
  (NodePort 30082 单端口;replicas=1;同 10106 准入 + nginx-data PVC sso/ subPath;
  探针用 `/admin/` try_files 兜底,与 ipass-all 同款止血方案)

**设计**:保留 ipass-core("core 是网关身份底座,永不跳过")+ ipass-plugin-sso,
其余插件整链剥离;不再维护 ssow/ssw 时代的多插件装配文档。剔除 ipass_audit_dir
是因为精简版没有 LLM 对话审计,剔除 proxy_cache_path 同理。K8s 部署沿用
nginx-data PVC + subPath 隔离模式(sso/ 与 ipass-all/ 互不干扰)。

**已知约束**:精简版仍是单进程共享内存,pod 重启使所有管理员/用户会话失效
(与 ipass-all 同款代价)。精简版不带单元/E2E 测试,老管理台 iframe 集成
也未引入。

Co-Authored-By: Claude Code <[email protected]>
This commit is contained in:
adminandClaude Code committed 2026-09-30 12:01:38 +08:00
commit c3689d501e
21 files changed
+3964

No files matched your search

+74
View File
@@ -0,0 +1,74 @@
#!/usr/bin/env bash
# ============================================================================
# 容器入口脚本(首发 + 每次启动都跑)
#
# 干的事:
# 1. 首次启动:data/ 为空时跑 seed-data.sh,生成 admin/123456 + alice/alice123
# 2. 每次启动:把容器外的 env(OAUTH_ISSUER 等)打印出来供排障
# 3. nginx -t 语法预检
# 4. exec nginx(让 nginx 拿到 PID 1,否则 stop signal 收不到)
#
# 设计:
# - nginx.test.conf 用了 env 占位(OAUTH_ISSUER / OAUTH_SIGNING_SECRET 等),
# nginx 启动时会从环境变量读取,无需重新渲染模板
# - seed-data.sh 用 python3 算 SHA-256 散列(与 rust/src/util.rs::hash_password
# 逐位一致:sha256("salt:password") 后迭代 1000 轮 sha256(x + salt))
# ============================================================================
set -euo pipefail
DATA_DIR="/usr/local/nginx/data"
SEED_DIR="/usr/local/nginx/data-seed"
NGINX_CONF="/usr/local/nginx/conf/nginx.conf"
LOG_DIR="/usr/local/nginx/logs"
c_ok() { printf '\033[32m✓\033[0m %s\n' "$*"; }
c_warn() { printf '\033[33m!\033[0m %s\n' "$*"; }
c_err() { printf '\033[31m✗\033[0m %s\n' "$*" >&2; }
# ---------------------------------------------------------------- 0. 基础目录
mkdir -p "$DATA_DIR" "$LOG_DIR"
# ---------------------------------------------------------------- 1. 打印关键 env(排障)
printf '\n== ipass-sso 启动参数 ==\n'
c_ok "OAUTH_ISSUER = ${OAUTH_ISSUER:-<未设置,默认走 nginx.conf 占位>}"
c_ok "OAUTH_COOKIE_DOMAIN= ${OAUTH_COOKIE_DOMAIN:-<未设置>}"
c_ok "ADMIN_USER = ${ADMIN_USER:-admin}"
if [ -n "${ADMIN_PASSWORD:-}" ]; then
c_ok "ADMIN_PASSWORD = <已注入>"
else
c_warn "ADMIN_PASSWORD = <未注入>,seed 将使用默认 123456"
fi
if [ -n "${OAUTH_SIGNING_SECRET:-}" ]; then
c_ok "OAUTH_SIGNING_SECRET= <已注入>"
else
c_warn "OAUTH_SIGNING_SECRET= <未注入>,seed 将生成随机值(重启即丢!)"
fi
# ---------------------------------------------------------------- 2. 数据物化(首次启动)
NEED_SEED=0
[ ! -f "$DATA_DIR/users.json" ] && NEED_SEED=1
[ ! -f "$DATA_DIR/oauth_clients.json" ] && NEED_SEED=1
if [ "$NEED_SEED" = "1" ]; then
printf '\n== 首次启动:seed-data.sh 物化 admin/alice ==\n'
# nginx worker 是 nobody(uid 65534),必须可写
chown -R 65534:65534 "$DATA_DIR" 2>/dev/null || c_warn "chown 65534 失败(继续)"
ADMIN_PASSWORD="${ADMIN_PASSWORD:-123456}" \
ALICE_PASSWORD="${ALICE_PASSWORD:-alice123}" \
DATA_DIR="$DATA_DIR" \
SEED_DIR="$SEED_DIR" \
bash /usr/local/nginx/scripts/seed-data.sh || \
{ c_err "seed-data.sh 失败"; exit 1; }
c_ok "data 目录物化完成"
else
c_ok "data 目录已有,跳过 seed"
fi
# ---------------------------------------------------------------- 3. nginx 语法预检
printf '\n== nginx -t ==\n'
/usr/local/nginx/sbin/nginx -t -c "$NGINX_CONF" 2>&1 || { c_err "nginx 配置语法错误"; exit 1; }
# ---------------------------------------------------------------- 4. exec nginx(PID 1 拿信号)
printf '\n== 起 nginx ==\n'
exec /usr/local/nginx/sbin/nginx -c "$NGINX_CONF" -g 'daemon off;'