Files
sso/source/conf/tls/README.md
T
ssw c8a02b8c49 feat: 从网关项目剥离为独立 SSO 统一认证服务
定位:身份层(IdP + IAP),不含动态域名转发 / LLM 上游代理 / 用量计费。

代码(source/rust,nginx 动态模块 + Rust,单进程零外部依赖)
- IdP:authorization_code(含 PKCE)/ refresh_token / client_credentials / password
  四种 grant,含 discovery / introspect / userinfo / jwks 占位
- IAP:access 阶段门禁,注入 X-Auth-* 到后端,客户端伪造同名头被覆盖
- MaxKey 互通:/oauth/v20/* 与 /oauth2.0/* 别名 + context-path 归一化 + 扁平字段
- 管理接口:账号(含角色/部门/用户组)与 OAuth 接入方注册表,热写穿共享内存
- 模块改名 ngx_http_sso_module,指令 sso_state / sso_data_dir / sso_api / sso_iap,
  Cookie sso_sid(终端用户)与 sso_admin_session(管理员)两套身份两套会话

配置(source/conf)
- nginx.conf 生产模板(TLS、IAP 子域、含 auth_sub 的日志格式)
- nginx.test.conf 本机验证配置(明文 18095-18099)
- tls/README.md 证书约定与公钥比对校验

前端(source/www/admin.html)
- 三 tab:账号管理 / 接入方 / 接入指南;去掉审核队列、域名、LLM 上游、用量统计

测试与脚本
- tests/ 三套端到端:协议基线 14 项 · MaxKey 互通与接入 24 项 · 管理接口 31 项,全绿
- tests/demo-system 演示业务系统(Python 标准库),覆盖应用自建客户端与 IAP 零改造两种姿势
- scripts/run-local-e2e.sh 本机一键起停;scripts/seed-data.sh 物化运行时数据目录

文档
- README.md 概览与快速开始;CLAUDE.md 硬约定与排障速查
- docs/design.md 完整设计;docs/roadmap.md 待执行任务(v2 RS256+JWKS、用户管理界面)
2026-09-12 21:42:06 +08:00

40 lines
1.5 KiB
Markdown
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.
# conf/tls —— TLS 证书
生产 `conf/nginx.conf` 的 443 server 直接引用本目录下的证书文件。
**证书与私钥绝不入库**——`.gitignore` 已排除常见后缀与本目录下的证书子目录;
本 README 是目录里唯一入库的文件。
## 约定
* 一个域名一个子目录:`conf/tls/<域名>/fullchain.cer` + `conf/tls/<域名>/<域名>.key`。
* `conf/nginx.conf` 里的路径就是按这个约定写的,换证书只换文件、不改配置。
* 目录为空时 `include /usr/local/nginx/conf/tls/*.conf;` 是空匹配,不影响启动。
## 签发(acme.sh DNS-01,泛域名)
```bash
acme.sh --issue --dns dns_ali -d example.com -d '*.example.com'
mkdir -p conf/tls/example.com
acme.sh --install-cert -d example.com \
--fullchain-file conf/tls/example.com/fullchain.cer \
--key-file conf/tls/example.com/example.com.key
```
## 校验配对(重要)
证书与私钥**必须用公钥比对**:
```bash
openssl x509 -in fullchain.cer -noout -pubkey | openssl md5
openssl pkey -in example.com.key -pubout | openssl md5
```
两条 md5 必须一致。注意:如果证书是 ECC 的,**不要**用 `openssl rsa -modulus`
——它对 EC 私钥输出为空,会误报「不匹配」。
## 生效方式
只换证书:`nginx -s reload` 即可(新 worker 重新加载证书文件)。
改 `conf/*.conf` 或 Rust 源码才需要重启进程——动态模块常驻内存,`reload` 不会
重新 `load_module`,改了 `.so` 必须真重启。