**影响**:新建独立仓 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]>
151 lines
6.3 KiB
Nginx Configuration File
151 lines
6.3 KiB
Nginx Configuration File
# ============================================================================
|
||
# ipass-sso 容器运行配置(精简版:身份/IdP + 管理台)
|
||
#
|
||
# 从 ipass-all/deploy/nginx.conf 派生的 SSO-only 版(2026-09-30 拍板):
|
||
# 剔除了 domain / llm / apix / cache / waf 5 个插件对应的 location 与
|
||
# 整个 LLM 数据面 server、动态域名 server;只保留身份 / 管理台 / API 端点。
|
||
#
|
||
# 指令清单 = 本仓 gateway 注册的 4 条:
|
||
# main : ipass_state / ipass_data_dir
|
||
# loc : ipass_api / sso_iap
|
||
#
|
||
# 非 root 适配(k8s 租户准入强制 runAsUser=10106):
|
||
# pid/lock/temp 全部挪 /tmp
|
||
# ============================================================================
|
||
|
||
worker_processes auto;
|
||
error_log /usr/local/nginx/logs/error.log info;
|
||
pid /tmp/nginx/nginx.pid;
|
||
lock_file /tmp/nginx/nginx.lock;
|
||
|
||
load_module /usr/local/nginx/modules/libipass_sso_gateway.so;
|
||
|
||
# 模块读取的 env 白名单(nginx 默认剥离全部环境变量;漏一条 = worker 里恒空)
|
||
env ADMIN_INIT_PASSWORD;
|
||
env OAUTH_SIGNING_SECRET;
|
||
env OAUTH_ISSUER;
|
||
env OAUTH_COOKIE_DOMAIN;
|
||
env SYNC_DINGTALK_URL;
|
||
env SYNC_WORKWECHAT_URL;
|
||
env SYNC_FEISHU_URL;
|
||
env PASSWORD_RESET_TOKEN_SINK;
|
||
env PASSWORD_RESET_TTL;
|
||
|
||
events {
|
||
worker_connections 2048;
|
||
}
|
||
|
||
http {
|
||
include /usr/local/nginx/conf/mime.types;
|
||
default_type application/json; # 业务侧默认 JSON,静态页在对应 location 覆盖
|
||
sendfile on;
|
||
keepalive_timeout 65;
|
||
|
||
# ------------------------------------------------------------------
|
||
# 非 root 适配:临时目录默认在编译前缀下(root 属主),10106 建不了
|
||
# ------------------------------------------------------------------
|
||
client_body_temp_path /tmp/nginx/client_body;
|
||
proxy_temp_path /tmp/nginx/proxy;
|
||
fastcgi_temp_path /tmp/nginx/fastcgi;
|
||
|
||
# ------------------------------------------------------------------
|
||
# 日志:带身份维度(WAF/缓存/域名等插件字段在精简版省略),排障不翻模块日志
|
||
# ------------------------------------------------------------------
|
||
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
|
||
'$status $body_bytes_sent "$http_referer" "$http_user_agent" '
|
||
'"$upstream_addr" "$upstream_status" "$upstream_response_time" '
|
||
'auth_user=$auth_user';
|
||
access_log /usr/local/nginx/logs/access.log main;
|
||
|
||
# ------------------------------------------------------------------
|
||
# 内核:共享内存 + 数据目录(必须显式,理由见文件头)
|
||
# ------------------------------------------------------------------
|
||
ipass_state state 16m; # 身份会话+账号 Key(精简版无域名/用量/缓存/WAF)
|
||
ipass_data_dir /usr/local/nginx/data;
|
||
|
||
# ==================================================================
|
||
# 主 server(NodePort 30082):管理台 + IdP 全部端点
|
||
# ==================================================================
|
||
# 证书:多域名证书(SAN 含 *.mayishangshu.cn / mayishangshu.cn 等,
|
||
# 2026-11-04 到期);证书放**数据目录**(PVC:/usr/local/nginx/data/tls/),
|
||
# 换证书 = 换文件 + 重启,不用重打镜像。
|
||
# ⚠️ nginx 同一端口不能既明文又 TLS:18098 = TLS only(NodePort 30082);
|
||
# 明文入口 = 18097(同端口)。
|
||
ssl_certificate /usr/local/nginx/data/tls/fullchain.cer;
|
||
ssl_certificate_key /usr/local/nginx/data/tls/tls.key;
|
||
ssl_trusted_certificate /usr/local/nginx/data/tls/ca.cer;
|
||
ssl_protocols TLSv1.2 TLSv1.3;
|
||
|
||
server {
|
||
listen 18098 ssl default_server; # TLS
|
||
listen 18097; # 明文(内网调试)
|
||
server_name _;
|
||
|
||
absolute_redirect off;
|
||
port_in_redirect off;
|
||
|
||
# 管理台核心壳(ipass-core www dist)+ sso 管理页
|
||
root /usr/local/nginx/www;
|
||
index index.html;
|
||
|
||
client_max_body_size 10m;
|
||
client_body_buffer_size 1m;
|
||
|
||
# ---- 管理/身份 API(content 阶段读体后按 PLUGINS 顺序分发)----
|
||
# 认领方:sso(身份端点/OIDC/SCIM/CAS/门户)+ core(账号/插件启停注册表)
|
||
location /api/ {
|
||
ipass_api on;
|
||
}
|
||
|
||
# OIDC/身份协议端点挂在根路径(/oauth/* /login /logout /userinfo
|
||
# /.well-known/* /apps /reset /cas/*),由 sso 插件认领
|
||
location / {
|
||
ipass_api on;
|
||
}
|
||
|
||
# ---- 管理台静态资源(这些 location 不开 ipass_api:静态文件走 nginx)----
|
||
location = / {
|
||
return 302 /admin/;
|
||
}
|
||
location = /admin {
|
||
return 302 /admin/;
|
||
}
|
||
location = /index.html {
|
||
add_header Cache-Control "no-store" always;
|
||
}
|
||
location /admin/ {
|
||
try_files $uri $uri/ /index.html; # SPA history 深链兜底
|
||
add_header Cache-Control "no-store" always;
|
||
}
|
||
# 插件面板路由(/plugin-<name>)走壳 SPA:直链/刷新时回 index.html
|
||
location /plugin- {
|
||
try_files $uri /index.html;
|
||
add_header Cache-Control "no-store" always;
|
||
}
|
||
# 壳内置面板路由(/manage/*,网关管理三页)同上
|
||
location /manage/ {
|
||
try_files $uri /index.html;
|
||
add_header Cache-Control "no-store" always;
|
||
}
|
||
location /assets/ {
|
||
add_header Cache-Control "no-store" always;
|
||
}
|
||
|
||
# 插件管理页 UMD 产物(壳按 /static/plugins/<name>/dist/<name>-admin.umd.js 拉取)
|
||
location /static/plugins/ {
|
||
alias /usr/local/nginx/static-plugins/;
|
||
add_header Cache-Control "no-store" always;
|
||
}
|
||
# 装配层自定义页清单(壳 boot 时拉取 /static/custom/custom-pages.json 注册自定义页)
|
||
location /static/custom/ {
|
||
alias /usr/local/nginx/static-custom/;
|
||
add_header Cache-Control "no-store" always;
|
||
}
|
||
|
||
# 老管理台多页应用(壳内 iframe 原样集成;纯静态,不开 ipass_api)
|
||
location /legacy/ {
|
||
alias /usr/local/nginx/www/legacy/;
|
||
add_header Cache-Control "no-store" always;
|
||
}
|
||
}
|
||
} |