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:
commit
c3689d501e
21 files changed
+3964
No files matched your search
@@ -0,0 +1,121 @@
|
||||
# ipass-sso 网关镜像 —— 多阶段构建(复用 rust-nginx-base)
|
||||
#
|
||||
# 从 ipass-all 派生的精简发行版:只装 ipass-core + ipass-plugin-sso(2 个 named
|
||||
# context),gateway 装配层把内核 + sso 编进单个 libipass_sso_gateway.so。
|
||||
#
|
||||
# 设计:
|
||||
# - builder 阶段:FROM crpi-yscq976uwza88qap.cn-shenzhen.personal.cr.aliyuncs.com/ssw188/nginx:1.30.4-rust-1.89
|
||||
# base 已含 rust 1.89 + 已 configure/make 的 nginx 1.30.4 + pcre 8.45 + 编译链,
|
||||
# 这里只跑 cargo build
|
||||
# - runtime 阶段:debian:bookworm-slim,只带 nginx 二进制 + 模块 + 静态资源
|
||||
#
|
||||
# 构建命令(context = 本仓根;2 个 named context 缺一不可):
|
||||
# bash scripts/collect-plugin-dist.sh # 前置:收集壳 + sso 管理页 dist
|
||||
# docker build \
|
||||
# --build-context ipass-core=../ipass-core \
|
||||
# --build-context ipass-plugin-sso=../ipass-plugin-sso \
|
||||
# -t crpi-yscq976uwza88qap.cn-shenzhen.personal.cr.aliyuncs.com/ssw188/nginx:ipass-sso-v0.6.0 .
|
||||
#
|
||||
# named context 落位约定:COPY 到 /ipass-core、/ipass-plugin-sso —— builder 的
|
||||
# WORKDIR 是 /build,rust/Cargo.toml 里 `../../ipass-core/...` 与插件自己的
|
||||
# `../ipass-core/...` 等 path 依赖按宿主机「同级目录」布局原样解析。
|
||||
# ⚠️ 每个插件仓只 COPY 编译所需子集(Cargo.toml/src/vendor/rules),
|
||||
# 避开几百 MB 的 target/ 与 data/。
|
||||
#
|
||||
# 升级 nginx/rust 版本时:先跑 ipass-sso/deploy/build-base-image.sh 推新 base,
|
||||
# 再 bump 此处 FROM 的 tag。
|
||||
|
||||
# syntax=docker/dockerfile:1.7
|
||||
|
||||
ARG BASE_TAG=1.30.4-rust-1.89
|
||||
|
||||
# ===========================================================================
|
||||
# builder: 复用 rust-nginx-base + Rust 模块编译(nginx 二进制 base 里已 make 好)
|
||||
# ===========================================================================
|
||||
FROM crpi-yscq976uwza88qap.cn-shenzhen.personal.cr.aliyuncs.com/ssw188/nginx:${BASE_TAG} AS builder
|
||||
|
||||
WORKDIR /build
|
||||
|
||||
# 内核(含 vendored ngx-rust 与 pcre 路径依赖的源码树约定)
|
||||
COPY --from=ipass-core /rust/Cargo.toml /rust/Cargo.lock /ipass-core/rust/
|
||||
COPY --from=ipass-core /rust/crates/ /ipass-core/rust/crates/
|
||||
COPY --from=ipass-core /rust/vendor/ /ipass-core/rust/vendor/
|
||||
|
||||
# SSO 插件 crate(只 1 个 plugin)
|
||||
COPY --from=ipass-plugin-sso /Cargo.toml /Cargo.lock /ipass-plugin-sso/
|
||||
COPY --from=ipass-plugin-sso /src/ /ipass-plugin-sso/src/
|
||||
|
||||
# 装配层(本仓)
|
||||
COPY rust/ /build/rust/
|
||||
|
||||
# cargo 国内镜像源(rsproxy):base 镜像没带 cargo 配置,直连 crates.io
|
||||
# 在国内网络下会长时间悬挂在下载阶段(ipass-sso 同款)。
|
||||
RUN printf '[source.crates-io]\nreplace-with = "rsproxy-sparse"\n\n[source.rsproxy-sparse]\nregistry = "sparse+https://rsproxy.cn/index/"\n\n[net]\ngit-fetch-with-cli = true\n' \
|
||||
> "${CARGO_HOME:-/usr/local/cargo}/config.toml"
|
||||
|
||||
WORKDIR /build/rust
|
||||
# nginx 源码树路径与 base 镜像内一致(bindgen 从 objs/Makefile 抽 -I)
|
||||
ENV NGINX_SOURCE_DIR=/src/nginx-1.30.4
|
||||
ENV NGINX_BUILD_DIR=/src/nginx-1.30.4/objs
|
||||
ENV CARGO_TARGET_DIR=/build/rust/target
|
||||
|
||||
RUN cargo build --release 2>&1 | tail -15
|
||||
|
||||
# ===========================================================================
|
||||
# runtime: 极简镜像,只带 nginx 二进制 + 模块 + 静态资源 + 种子数据
|
||||
# ===========================================================================
|
||||
FROM debian:bookworm-slim AS runtime
|
||||
|
||||
ARG NGINX_VERSION=1.30.4
|
||||
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
libpcre2-8-0 \
|
||||
zlib1g \
|
||||
libssl3 \
|
||||
ca-certificates \
|
||||
curl \
|
||||
tzdata \
|
||||
python3 \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# 与 iPass 一致:TZ=Asia/Shanghai,util::day_id 按上海时区 0:00 切日(趋势/用量口径)
|
||||
ENV TZ=Asia/Shanghai
|
||||
|
||||
COPY --from=builder /src/nginx-${NGINX_VERSION}/objs/nginx /usr/local/nginx/sbin/nginx
|
||||
COPY --from=builder /src/nginx-${NGINX_VERSION}/conf/mime.types /usr/local/nginx/conf/mime.types
|
||||
COPY --from=builder /build/rust/target/release/libipass_sso_gateway.so /usr/local/nginx/modules/
|
||||
|
||||
# 生产配置(deploy/nginx.conf:全插件 location 布局 + 非 root 适配)
|
||||
COPY deploy/nginx.conf /usr/local/nginx/conf/nginx.conf
|
||||
|
||||
# 管理台前端(Ruling 16):构建前由 scripts/collect-plugin-dist.sh 把
|
||||
# ipass-core 壳收集进 deploy/shell、各插件 dist 收集进 deploy/static-plugins
|
||||
COPY deploy/shell/ /usr/local/nginx/www/
|
||||
COPY deploy/static-plugins/ /usr/local/nginx/static-plugins/
|
||||
# 装配层自定义页清单(core 壳 boot 时拉取并注册为自定义页;其他装配可没有)
|
||||
COPY deploy/custom/ /usr/local/nginx/static-custom/
|
||||
# 老管理台多页应用(collect-legacy.sh 从各仓提取,壳内 iframe 原样集成)
|
||||
COPY deploy/legacy/ /usr/local/nginx/www/legacy/
|
||||
|
||||
# 种子数据(admin/alice + OAuth 接入方 + 插件启停注册表)
|
||||
COPY data-seed/ /usr/local/nginx/data-seed/
|
||||
|
||||
# 目录与属主:k8s 租户准入强制 runAsUser=10106,data 与 /tmp/nginx 必须
|
||||
# 预先可写(挂 PVC 后属主由 fsGroup=10106 接管,chown 只保无卷直跑)。
|
||||
# 日志走 /dev/std* 符号链接(kubectl logs 直接可见)。
|
||||
RUN mkdir -p /usr/local/nginx/data /usr/local/nginx/logs /tmp/nginx \
|
||||
&& chown -R 10106:10106 /usr/local/nginx/data /tmp/nginx \
|
||||
&& ln -sf /dev/stdout /usr/local/nginx/logs/access.log \
|
||||
&& ln -sf /dev/stderr /usr/local/nginx/logs/error.log
|
||||
|
||||
# 首次启动播种 admin/alice + 渲染配置 + 起 nginx
|
||||
COPY scripts/container-entrypoint.sh /usr/local/nginx/scripts/container-entrypoint.sh
|
||||
COPY scripts/seed-data.sh /usr/local/nginx/scripts/seed-data.sh
|
||||
RUN chmod +x /usr/local/nginx/scripts/container-entrypoint.sh /usr/local/nginx/scripts/seed-data.sh
|
||||
|
||||
WORKDIR /usr/local/nginx
|
||||
EXPOSE 18098 18099
|
||||
STOPSIGNAL SIGQUIT
|
||||
|
||||
ENTRYPOINT ["/usr/local/nginx/scripts/container-entrypoint.sh"]
|
||||
CMD ["nginx", "-g", "daemon off;"]
|
||||
@@ -0,0 +1,56 @@
|
||||
#!/usr/bin/env bash
|
||||
# ============================================================================
|
||||
# build.sh —— 构建 + 推送 ipass-sso 镜像(可选手动 docker 命令见 Dockerfile 头注释)
|
||||
#
|
||||
# 从 ipass-all 派生的精简版,只装配 ipass-core + ipass-plugin-sso(2 个 named
|
||||
# context)。与 ipass-all/deploy/build.sh 同款外壳,去掉 5 个非 SSO 插件的
|
||||
# build-context。
|
||||
#
|
||||
# 用法:
|
||||
# bash deploy/build.sh # 收集 dist → docker build → push
|
||||
# bash deploy/build.sh --no-push # 只构建
|
||||
# bash deploy/build.sh --load # 构建后 load 进本地 docker(默认行为)
|
||||
# TAG=ipass-sso-v0.6.0 bash deploy/build.sh
|
||||
#
|
||||
# 镜像仓库约定(2026-09-26 拍板):只推 crpi-.../ssw188/nginx 这一个 repo 路径,
|
||||
# tag 用 <app>-vX.Y.Z;同 repo 加 tag 零成本,不要建新 repo。
|
||||
# ============================================================================
|
||||
set -euo pipefail
|
||||
|
||||
HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
ROOT="$(cd "$HERE/.." && pwd)"
|
||||
IPASS_DIR="$(cd "$ROOT/.." && pwd)"
|
||||
|
||||
REGISTRY="${REGISTRY:-crpi-yscq976uwza88qap.cn-shenzhen.personal.cr.aliyuncs.com}"
|
||||
REPO="${REPO:-ssw188/nginx}"
|
||||
TAG="${TAG:-ipass-sso-v0.6.0}"
|
||||
IMAGE="$REGISTRY/$REPO:$TAG"
|
||||
|
||||
PUSH=1
|
||||
NO_PUSH=0
|
||||
for arg in "$@"; do
|
||||
case "$arg" in
|
||||
--no-push) NO_PUSH=1 ;;
|
||||
esac
|
||||
done
|
||||
|
||||
echo "== 1/2 收集前端产物(壳 + sso 管理页)=="
|
||||
bash "$ROOT/scripts/collect-plugin-dist.sh"
|
||||
|
||||
echo "== 2/2 docker build:$IMAGE =="
|
||||
cd "$ROOT"
|
||||
docker build \
|
||||
--build-context "ipass-core=$IPASS_DIR/ipass-core" \
|
||||
--build-context "ipass-plugin-sso=$IPASS_DIR/ipass-plugin-sso" \
|
||||
-f "$HERE/Dockerfile" \
|
||||
-t "$IMAGE" \
|
||||
.
|
||||
|
||||
if [ "$NO_PUSH" = "1" ]; then
|
||||
echo "== 跳过 push(--no-push)=="
|
||||
else
|
||||
echo "== docker push:$IMAGE =="
|
||||
docker push "$IMAGE"
|
||||
fi
|
||||
|
||||
echo "完成:$IMAGE"
|
||||
@@ -0,0 +1,128 @@
|
||||
# ============================================================================
|
||||
# ipass-sso K8s 部署清单(wuguirong 租户 ns)—— SSO-only 精简版
|
||||
#
|
||||
# 集群约束(与 ipass-all 同源,2026-09-26 摸底结论):
|
||||
# - 准入 tenant-storage-guard:容器级 securityContext.runAsUser=10106(pod 级无效)
|
||||
# - SC nfs-wuguirong 的 provisioner CrashLoopBackOff,新 PVC 供给不了
|
||||
# → 复用已 Bound 共享 PVC nginx-data,subPath sso/ 隔离数据
|
||||
# - 无 Ingress → NodePort:30082(TLS only,单端口;精简版没有 LLM/域名数据面)
|
||||
# - 无 secrets 权限 → 密钥类配置明文 env(与 docker-compose 同水平)
|
||||
#
|
||||
# 硬约束:replicas=1。运行期真源是进程内共享内存 + JSON 写穿,
|
||||
# 多副本各自持 shm 互不可见(脑裂),架构上不允许横向扩。
|
||||
#
|
||||
# 应用:kubectl apply -f deploy/k8s/ipass-sso.yaml
|
||||
# 验证:curl -fs http://192.168.1.26:30082/.well-known/openid-configuration
|
||||
# ============================================================================
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: ipass-sso
|
||||
namespace: wuguirong
|
||||
labels:
|
||||
app: ipass-sso
|
||||
spec:
|
||||
replicas: 1
|
||||
strategy:
|
||||
type: Recreate # 共享 PVC RWX 但数据语义单写:滚动时新旧并存会双写 JSON
|
||||
selector:
|
||||
matchLabels:
|
||||
app: ipass-sso
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: ipass-sso
|
||||
spec:
|
||||
securityContext:
|
||||
runAsUser: 10106
|
||||
runAsNonRoot: true
|
||||
fsGroup: 10106
|
||||
# 数据子目录 bootstrap:subPath 目录必须预先存在且属主 10106
|
||||
# (kubelet 对不存在的 subPath 按 root 属主建,10106 写不进——挂载成功
|
||||
# 之后业务写盘才炸,最难查)。幂等,每次滚动都会跑。
|
||||
initContainers:
|
||||
- name: init-data-dir
|
||||
image: crpi-yscq976uwza88qap.cn-shenzhen.personal.cr.aliyuncs.com/ssw188/nginx:ipass-sso-v0.6.0
|
||||
imagePullPolicy: IfNotPresent
|
||||
command: ["bash", "-c", "mkdir -p /persist/sso && ls -la /persist"]
|
||||
securityContext:
|
||||
runAsUser: 10106
|
||||
runAsNonRoot: true
|
||||
allowPrivilegeEscalation: false
|
||||
volumeMounts:
|
||||
- name: data
|
||||
mountPath: /persist
|
||||
containers:
|
||||
- name: ipass-sso
|
||||
image: crpi-yscq976uwza88qap.cn-shenzhen.personal.cr.aliyuncs.com/ssw188/nginx:ipass-sso-v0.6.0
|
||||
imagePullPolicy: IfNotPresent
|
||||
ports:
|
||||
- name: tls
|
||||
containerPort: 18098 # TLS:NodePort 30082
|
||||
env:
|
||||
# issuer 必须与浏览器/第三方实际访问地址逐字一致
|
||||
- name: OAUTH_ISSUER
|
||||
value: "https://192.168.1.26:30082"
|
||||
# SSO cookie 域(共享 cookie 给同根域名)
|
||||
- name: OAUTH_COOKIE_DOMAIN
|
||||
value: "mayishangshu.cn"
|
||||
# 固定签名密钥:不设则 seed 随机生成,Pod 重启后已签发 token 全部失效
|
||||
- name: OAUTH_SIGNING_SECRET
|
||||
value: "ipass-sso-k8s-dev-signing-key-2026"
|
||||
securityContext:
|
||||
runAsUser: 10106
|
||||
runAsNonRoot: true
|
||||
allowPrivilegeEscalation: false
|
||||
capabilities:
|
||||
drop: ["ALL"]
|
||||
resources:
|
||||
requests:
|
||||
cpu: 100m
|
||||
memory: 128Mi
|
||||
limits:
|
||||
cpu: "1"
|
||||
memory: 512Mi
|
||||
readinessProbe:
|
||||
httpGet:
|
||||
scheme: HTTPS
|
||||
# /admin/ 走 nginx 原生 try_files 兜底到 SPA index.html(与 ipass-all 同款止血方案)
|
||||
path: /admin/
|
||||
port: 18098
|
||||
initialDelaySeconds: 5
|
||||
periodSeconds: 10
|
||||
livenessProbe:
|
||||
httpGet:
|
||||
scheme: HTTPS
|
||||
path: /admin/
|
||||
port: 18098
|
||||
initialDelaySeconds: 10
|
||||
periodSeconds: 20
|
||||
failureThreshold: 3
|
||||
volumeMounts:
|
||||
- name: data
|
||||
mountPath: /usr/local/nginx/data
|
||||
subPath: sso
|
||||
volumes:
|
||||
# 复用已 Bound 的共享 PVC(nfs-wuguirong SC,新建 PVC 供给不了);
|
||||
# sso 数据经 subPath 隔离在 sso/ 子目录,与 ipass-all/ 互不干扰
|
||||
- name: data
|
||||
persistentVolumeClaim:
|
||||
claimName: nginx-data
|
||||
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: ipass-sso
|
||||
namespace: wuguirong
|
||||
labels:
|
||||
app: ipass-sso
|
||||
spec:
|
||||
type: NodePort
|
||||
selector:
|
||||
app: ipass-sso
|
||||
ports:
|
||||
- name: tls
|
||||
port: 18098
|
||||
targetPort: tls
|
||||
nodePort: 30082
|
||||
@@ -0,0 +1,151 @@
|
||||
# ============================================================================
|
||||
# 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
Whitespace-only changes.
Whitespace-only changes.
Reference in new issue
Block a user