Files
sso/deploy/nginx.conf
T
adminandClaude Code cd4936c9dc fix(deploy): 临时去掉 TLS 以跑通 K8s 部署
影响:
- 之前:nginx -t 因 /usr/local/nginx/data/tls/ 三件套缺失启动即 EMERG,
  Pod CrashLoopBackOff
- 现在:明文 HTTP 18098 跑通,OIDC discovery / JWKS / admin / login 全绿

改动:
- deploy/nginx.conf:去掉 listen 18098 ssl + 三条 ssl_certificate 指令;
  listen 改回明文 default_server;注释写明 TLS 后续接入
- deploy/k8s/ipass-sso.yaml:image tag v0.6.0 → v0.6.1(强制 IfNotPresent
  节点重拉),OAUTH_ISSUER 改 http://,probes 去 scheme: HTTPS,
  ports name tls → http

设计:
- 本次部署为明文 HTTP 临时方案;TLS 后续由 PVC sso/tls/ + 外部流程接入

Co-Authored-By: Claude Code <[email protected]>
2026-09-30 12:42:04 +08:00

137 lines
5.8 KiB
Nginx Configuration File
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# ============================================================================
# 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 全部端点
# ==================================================================
# ⚠️ 本次部署为明文 HTTP(2026-09-30 临时方案,TLS 后续接入)。
# 历史:本想用 K8s ConfigMap 把 self-signed cert 注入到
# /usr/local/nginx/data/tls/,但本 SA 在当前受限会话里没有
# 创建 ConfigMap 的工具调用授权。先用 18098 明文把 SSO + OIDC
# discovery 链路跑通,证书走 PVC sso/tls/ + 外部流程接入时再切回
# `listen 18098 ssl default_server` + 三条 ssl_certificate 指令。
server {
listen 18098 default_server; # 明文(NodePort 30082)
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;
}
# 装配层自定义页清单(精简版不挂自定义页,无 /static/custom/)
# 老管理台多页应用(精简版不集成老管理台,无 /legacy/)
}
}