Files
ModelRouter/packaging/nfpm.yaml
JianFeeeee 7e33d11d15 fix(packaging): 发行包不再内置可用的 admin key
打包时把本地 config.yaml(gitignored,含运维真实密钥)原样复制成
config.example.yaml,而 postinst 在首次安装且 /etc 无配置时又把它
cp 成生产配置 ⇒ 每次安装都得到一个同值的、公开已知的 admin key。
实测该 key(sk-gw-local-0001)在生产上真实有效(/v1/models 返回 200,
而网关监听 0.0.0.0)。

三处修正:
- 新增 packaging/config.example.yaml(受 git 跟踪的净化模板),
  gateway_keys 留空、sources 留空,并写明不要填死值。
- core-dist.sh / nfpm.yaml 改为打包该模板,不再碰本地 config.yaml。
- postinst.sh 不再投递示例配置:留空文件会让网关启动但拒绝所有请求
  (无门可入)。改为让二进制首启时自行生成随机 admin key 并打印 ——
  每次安装都不同,且开箱可用。示例文件仅作为 /usr/share 下的参考保留。

实测首启:生成 sk-gw-838d66a1... 并打印,与旧的共享固定值不同。
2026-09-28 23:27:42 +08:00

63 lines
1.9 KiB
YAML

# nfpm config for the llmsproxy core gateway binary.
# The version placeholder below is substituted by packaging/core-dist.sh (nfpm v2
# here does not honour {{ .Env.VERSION }} template rendering), so do not edit it
# by hand.
name: llmsproxy
arch: amd64
platform: linux
version: __VERSION__
epoch: "1"
section: net
priority: optional
maintainer: JianFeeeee <dev@modelrouter.local>
description: |
Unified OpenAI-compatible multi-source LLM gateway.
Routes requests across multiple upstream LLM providers with Lua adapters,
model scheduling, quota windows, an elastic Lua worker pool, and a Web UI.
vendor: ModelRouter
homepage: https://gitcode.com/JianFeeeee/ModelRouter
license: MIT
contents:
# binary
- src: ./cmd/build/llmsproxy
dst: /usr/bin/llmsproxy
file_info:
mode: 0755
# systemd unit (memory tuning baked in)
- src: ./packaging/llmsproxy.service
dst: /etc/systemd/system/llmsproxy.service
file_info:
mode: 0644
# example config (seeded to /etc/llmsproxy on first install by postinst).
# Must be the tracked sanitised template: ./config.yaml is the operator's own
# gitignored config and shipping it would leak real credentials — it shipped a
# working admin key (sk-gw-local-0001) to every install for a while.
- src: ./packaging/config.example.yaml
dst: /usr/share/llmsproxy/config.example.yaml
file_info:
mode: 0644
# built-in Lua adapters (deployed to /etc/llmsproxy/adapters)
- src: ./internal/lua/adapters/*.lua
dst: /usr/share/llmsproxy/adapters/
file_info:
mode: 0644
# README pointer
- src: ./README.md
dst: /usr/share/doc/llmsproxy/README.md
file_info:
mode: 0644
scripts:
postinstall: ./packaging/postinst.sh
preremove: ./packaging/prerm.sh
rpm:
group: Applications/Internet
summary: Unified OpenAI-compatible multi-source LLM gateway
compression: gzip
deb:
compression: gzip
fields:
Recommends: ca-certificates