prod.toml 5.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. # klt-bos 生产配置骨架(接入指南 §1、§7.1、§8.2)
  2. #
  3. # 加载顺序:default.toml → {BOS_ENV}.toml → 环境变量(优先级递增)。
  4. # 部署:`BOS_ENV=prod ./klt-bos`,或用 `KLT_BOS_*` / `SEOH_*` 环境变量覆盖下列任意键。
  5. #
  6. # 与 dev 的差异:
  7. # - listener 强制 TLS(指南 §7.1 生产用 https)
  8. # - advertise_host 必须显式给出(⛔ localhost 兜底;见 config.rs 校验)
  9. # - UDS 走正式网关地址与项目空间 ID
  10. bos_env = "prod"
  11. uds.base_url = "https://api-gateway.prod.seoh.local:3000/api/system/uds/seoh-uds-gateway"
  12. uds.seoh_env = "prod"
  13. uds.tenant_id = "org_kelantong" # 由平台在交付时确认实际 org_id
  14. uds.project_id = "376985101906509824" # 平台交付确认(2026-11-11)
  15. uds.request_timeout_ms = 3000
  16. # 方案 B(2026-11-11 平台答复后启动):UDS 身份收口至「项目作用域授权主体密钥对签名」。
  17. # 接入指南 §8.2/§9 + 《外部系统调用接入》§5.1 定案:
  18. # - 报文必须就是 RFC 8785 JCS 字节(serde_jcs::to_vec,⛔ serde_json)
  19. # - 六枚头:X-Subject-Id / X-Key-Id / X-Timestamp / X-Nonce / X-Payload-Hash / X-Signature
  20. # - 签名串 = `{ts}{nonce}{hash}` 直接相连,⛔ 分隔符/URL/method/Date/Digest
  21. # (2026-11-12 平台切换为单一三段式:X-Nonce 必填、16~128 位 [A-Za-z0-9_-]、密码学随机源;
  22. # 防重放键={subject}{nonce},X-Timestamp 只做 ±300s 窗口校验)
  23. # - ECDSA + SHA-256,DER 编码(❌ JWT ES256 的 R‖S 裸拼接)
  24. # - ⛔ 与 Authorization Bearer 同现(网关分流器 11006)
  25. # 部署侧需先完成平台侧三步(建主体 → 发凭证 → 绑角色,详见
  26. # docs/SEOH平台交互/方案B-UDS身份收口切换步骤(2026-11-11).md §二)后填入下列四键。
  27. uds.auth_mode = "signature"
  28. uds.subject_name = "klt_bos"
  29. uds.credential_id = "379286059994857472" # 本系统的授权主体凭证(主体 klt_bos 的密钥对签名凭证);2026-11-12 23:07 我方在开发者空间登记新公钥(私钥介质丢失后重生),23:18 起旧凭证 378745115235074048 与替身 378612997163073536 均已吊销 ⇒ 主体下仅此一把 valid
  30. uds.private_key_path = "/etc/seoh/klt-bos/keys/uds-signing.pem"
  31. # 兼容回滚:把 uds.auth_mode 改回 "bearer" 并 export KLT_BOS_SERVICE_TOKEN=<JWT> 即退到现状。
  32. server.host = "0.0.0.0"
  33. server.port = 3002
  34. server.shutdown_timeout_secs = 10
  35. server.tls_enabled = true
  36. # 服务端身份证书(项目 CA 签发的 leaf);与 SEOH_TLS_* / KLT_BOS_TLS_* 环境变量等价
  37. server.tls.cert_path = "/etc/seoh/klt-bos/tls/server.crt"
  38. server.tls.key_path = "/etc/seoh/klt-bos/tls/server.key"
  39. # 边缘 CA 根(验证网关出示的 C3);M2 落地后改为 true
  40. server.tls.client_ca_path = "/etc/seoh/edge/edge-ca.crt"
  41. server.tls.client_auth_required = false
  42. registry.enabled = true
  43. registry.url = "https://api-gateway.prod.seoh.local:3000/api/ext/registry"
  44. registry.service_name = "klt-bos"
  45. registry.service_version = "0.1.0"
  46. # ⛔ 不允许缺省:deploy 时由 helm/ansible 显式注入 IPv4 字面量,或与 SEOH_REGISTRY_ADVERTISE_HOST 等价
  47. registry.advertise_host = "10.0.0.0" # ⬅️ 必填占位:交付时替换为本机 IPv4
  48. registry.signature_secret = "" # 可选:32 字节 HMAC 密钥,与平台对齐后填入
  49. # 接入指南 §7.3:注册时通过 metadata.heartbeat_required=true 显式声明参与判活扫描;
  50. # 未声明 ⇒ 永远不会因心跳超时被摘除(流量持续打到已停止实例)。
  51. # 本服务通过环境变量 REGISTRY_HEARTBEAT_REQUIRED=true 开启(SDK 已实现),
  52. # 等平台 liveness.mode=enforce 上线后立即生效;上线前打开无副作用(注册中心只把字段落库)。
  53. gateway.base_url = "https://api-gateway.prod.seoh.local:3000"
  54. # 控制面 mTLS(边缘根 + 项目 CA leaf),与 uds.ca_cert_path / 数据面 cluster 根分离
  55. gateway.ca_cert_path = "/etc/seoh/edge/edge-ca.crt"
  56. gateway.client_cert_path = "/etc/seoh/klt-bos/tls/client.crt"
  57. gateway.client_key_path = "/etc/seoh/klt-bos/tls/client.key"
  58. # —— 配置中心读通道(KB-1 形态 A:直连 `seoh-config-center:3003`,⛔ 经网关)——
  59. # ⚠️ 经网关必被换成网关自己的身份(caller=seoh-api-gateway ≠ target=klt-bos)⇒ 11001;
  60. # 生产按 `colocated` 走容器网络内可达即可,⛔ 对外发布。
  61. # ⚠️ 只收 C 类三项(`uds.base_url/tenant_id/project_id`),业务配置仍以本文件+环境变量为准。
  62. # B-1(形态 A/B 与可用时点)书面确认前保持 false;确认后改 true 即生效(无需改代码)。
  63. # 形态 B(若平台改选):base_url 换成 `https://api-gateway.prod.seoh.local:3000/api/ext/config-center`。
  64. config_center.enabled = false
  65. config_center.base_url = "https://seoh-config-center:3003"
  66. config_center.env = "prod"
  67. config_center.service_name = "klt-bos"
  68. config_center.ca_cert_path = "/etc/seoh/certs/root-ca.crt"
  69. # 同一张项目 CA 身份 leaf(ServerAuth+ClientAuth 双用途)作 mTLS 客户端证书。
  70. config_center.client_cert_path = "/etc/seoh/klt-bos/tls/client.crt"
  71. config_center.client_key_path = "/etc/seoh/klt-bos/tls/client.key"
  72. config_center.timeout_secs = 3
  73. identity.mode = "trust"
  74. identity.seoh_env = "prod"
  75. identity.jwks_url = "" # trust 模式不消费 JWKS;仅 strict 需要
  76. identity.gateway_pubkey_url = "https://api-gateway.prod.seoh.local:3000/api/system/gateway/identity-pubkey"
  77. log.level = "info"
  78. log.format = "json"