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