Compare commits
27
Commits
v0.4.1_0
...
c89aeb9c29
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c89aeb9c29 | ||
|
|
97cc9b8d5e | ||
|
|
87a6f219d1 | ||
|
|
c6ad02d0a7 | ||
|
|
10907a6276 | ||
|
|
6c4e0045ec | ||
|
|
80ca6feced | ||
|
|
576011e224 | ||
|
|
eb6671580f | ||
|
|
05866d146a | ||
|
|
4f8a8e12b0 | ||
|
|
2668a7fd15 | ||
|
|
918eff9612 | ||
|
|
4b233f2755 | ||
|
|
ca44fb5ef9 | ||
|
|
b662784087 | ||
|
|
850c94dcd6 | ||
|
|
a77797ed12 | ||
|
|
c5501c1019 | ||
|
|
c2e51d09f6 | ||
|
|
12148db477 | ||
|
|
2e116b9965 | ||
|
|
415af8bdf7 | ||
|
|
fa38277468 | ||
|
|
37c01787f7 | ||
|
|
f3a0fcf8c0 | ||
|
|
60436c6910 |
No files matched your search
@@ -6,7 +6,23 @@ Develop it inside a StartOS packaging workspace created by `start-cli s9pk init-
|
||||
which provides the packaging guide and agent context one level up. If you're reading this in a
|
||||
bare clone with no workspace, the full guide is at <https://docs.start9.com/packaging>.
|
||||
|
||||
Work this package's `TODO.md` from top to bottom. Keep `README.md` (technical reference for an AI support or administering agent) and `instructions.md` (end-user docs) in sync with your changes.
|
||||
**Start every task at the recipe index** — `../start-technologies/projects/start-sdk/docs/src/recipes.md`
|
||||
(or <https://docs.start9.com/packaging/recipes.html>). It maps an intent ("prompt the user to create
|
||||
admin credentials", "expose a web UI") to the constructs, the reference pages, and a named production
|
||||
package to copy. Find the recipe before you read this package's neighbours: a package you reach by
|
||||
grepping may be non-conformant, and the recipe outranks it.
|
||||
|
||||
Freshly scaffolded? Work the
|
||||
[New Package Checklist](../start-technologies/projects/start-sdk/docs/src/new-package-checklist.md)
|
||||
(or <https://docs.start9.com/packaging/new-package-checklist.html>) from top to bottom. It is a
|
||||
guide page, not a file in this repo — read it, don't copy it in.
|
||||
|
||||
Keep `README.md` (technical reference for an AI support or administering agent) and
|
||||
`instructions.md` (end-user docs) in sync with your changes.
|
||||
|
||||
**Bugs and feature requests are GitHub issues on this repo** — file them as you find them.
|
||||
Don't record work in the repo instead: no `TODO.md`, no `NOTES.md`, no `PLAN.md`. What you
|
||||
verified, tried, and decided belongs in the commit message and the PR body.
|
||||
|
||||
## This repo
|
||||
|
||||
|
||||
@@ -11,8 +11,24 @@
|
||||
|
||||
[PPQ Private Mode](https://github.com/PayPerQ/ppq-private-mode-proxy) is a local proxy that encrypts AI requests on your server and only lets them be decrypted inside an attested hardware enclave, so neither PPQ.AI nor the model host can read them. This package runs that proxy and points any OpenAI- or Anthropic-compatible client at it.
|
||||
|
||||
- **Upstream repo:** <https://github.com/PayPerQ/ppq-private-mode-proxy>
|
||||
- **Wrapper repo:** <https://github.com/Start9-Community/ppq-private-mode-startos>
|
||||
- **Upstream proxy repo:** <https://github.com/PayPerQ/ppq-private-mode-proxy>
|
||||
- **Upstream wrapper (this is a fork of it):** <https://github.com/Start9-Community/ppq-private-mode-startos>
|
||||
|
||||
---
|
||||
|
||||
## Changes in this fork
|
||||
|
||||
Forked from [Start9-Community/ppq-private-mode-startos](https://github.com/Start9-Community/ppq-private-mode-startos). Tracks upstream `ppq-private-mode-proxy` v0.6.0:
|
||||
|
||||
- **Upstream v0.6.0 updates:** Updated model catalog (`private/glm-5-3`, `private/glm-5-3-flash`, `private/deepseek-v4-flash`), host and origin security hardening against browser CSRF/DNS rebinding.
|
||||
- **DNS-rebinding hardening (default on).** StartOS now sets `PPQ_ALLOWED_HOSTS` automatically to the exact hostnames the API interface is served on (LAN IP, `.local`, private/public domains, the bridge address and loopback). A hostile web page can no longer reach the proxy as "same-origin" or overwrite the stored API key via `/setup/api-key`. The list is resolved reactively, so adding a domain later is picked up on the next restart.
|
||||
- **New action — Service-to-Service URL.** Resolves the internal LXC-bridge address and prints the `http://<bridge-ip>:<port>/v1` base URL that Open WebUI (or any service container on this same StartOS server) should dial — plain HTTP, no TLS or cert handling. This is what an on-box client must use instead of the LAN `https://` address, which fails certificate validation inside another container's runtime.
|
||||
- **Key validation matches upstream.** `configureApiKey` uses the exact same API-key shape check as upstream v0.6.0 (`^sk-[A-Za-z0-9]{16,64}$`), so a key accepted in StartOS is never rejected later by the proxy itself.
|
||||
- **No glוןouble restart on configure.** The action only writes settings that actually changed (both `debug` and the API key are compared against the stored value first), so toggling logging or replacing the key restarts the service once — and only when something really changed.
|
||||
- **Stable consumer contract.** `startos/utils.ts` exports `apiHostId` (`'main'`) and `apiPort` (`8787`) for dependents to import, mirroring the pattern Open WebUI already uses for its other AI backends.
|
||||
- **Docs.** `README.md` and `instructions.md` document the same-server / Open WebUI connection flow and updated models.
|
||||
|
||||
Version: `0.6.0:4`, built with SDK 2.0.9.
|
||||
|
||||
---
|
||||
|
||||
@@ -78,7 +94,6 @@ Two models, and keeping them apart is the point.
|
||||
**The proxy's config file is co-owned, and its shape must stay exactly upstream's.** The proxy rewrites the whole file when a key is saved on its status page, so anything else stored there would be destroyed — which is why the verbose-logging setting lives in a separate file the container cannot see.
|
||||
|
||||
**The API key is not passed as an environment variable**, though upstream supports that. Leaving it out means the proxy's own key store is the single owner of the key, so a key set through the status page and a key set through the action are the same key rather than two competing sources.
|
||||
|
||||
The config file is read reactively, which is what makes a key saved by the action take effect: the write restarts the daemon, and the proxy reloads the file at start.
|
||||
|
||||
## Dependencies
|
||||
@@ -100,6 +115,10 @@ Both are exported from the **same binding**, because they are the same server: o
|
||||
|
||||
**Neither is authenticated by StartOS**, and the status page is where the API key can be saved — so anyone who can reach the address can read the attestation state, use your key for inference, and replace it. Treat the address as a credential.
|
||||
|
||||
Since 0.6.0:4 the package sets **`PPQ_ALLOWED_HOSTS`** automatically to the hostnames StartOS serves this binding on (LAN IP, `.local`, private/public domains, plus the bridge IP and loopback). This thwarts DNS-rebinding: a request whose `Host` is not one of those names is refused by the proxy before any request handling, so a hostile web page cannot act as "same-origin" against it.
|
||||
|
||||
**Same-server consumption (service-to-service).** A client running in *another service's container on this same server* — Open WebUI, a custom agent — must not use the LAN `https://` address: the calling runtime does not trust this server's self-signed Root CA, so the dial fails certificate verification. What it *should* use is the LXC-bridge address, which is plain HTTP — no TLS, no cert handling. Run the **Service-to-Service URL** action and paste the returned `http://<bridge-ip>:<port>/v1` URL into the client. The LAN `https://` address (e.g. `https://192.168.0.158:56849`) remains correct for off-box clients — a browser with the server's Root CA trusted, or `curl -k`.
|
||||
|
||||
## Installation and First-Run Flow
|
||||
|
||||
Install seeds nothing and raises an `important` task asking for the PPQ.AI API key.
|
||||
@@ -112,7 +131,7 @@ So the proxy starts without a key. It serves its status page, performs attestati
|
||||
|
||||
## Actions
|
||||
|
||||
One action.
|
||||
Two actions, both available whether or not the service is running.
|
||||
|
||||
### Configure PPQ API Key
|
||||
|
||||
@@ -122,10 +141,20 @@ Sets the API key and the verbose-logging switch.
|
||||
- **Cost:** the service restarts, since the proxy reads its config at start.
|
||||
- **Repeat safety:** idempotent. **Leaving the key blank keeps the existing one** rather than clearing it, so the action can be used to toggle logging without re-entering the key.
|
||||
- **The key is never echoed back into the form.** The logging toggle is pre-filled; the key is not.
|
||||
- **The key's shape is checked before it is written.** Upstream's status page rejects a malformed key outright, but a bad key written straight into the config file would only surface later as a failed request — so the same check is applied here.
|
||||
- **The key's shape is checked before it is written**, with the exact same pattern upstream v0.6.0 uses (`^sk-[A-Za-z0-9]{16,64}$`) — so a key accepted here is never rejected later by the proxy's own status-page endpoint.
|
||||
- **Only changed settings are written.** Each value (`debug`, `apiKey`) is compared against the stored value first; nothing is written when it did not change, so no spurious restarts.
|
||||
|
||||
**Requests are billed to whichever key is set.**
|
||||
|
||||
### Service-to-Service URL
|
||||
|
||||
Resolves the internal LXC-bridge address another service on this same server (Open WebUI) dials to reach the proxy.
|
||||
|
||||
- **What it returns:** the copyable base URL `http://<bridge-ip>:<assigned-port>/v1`.
|
||||
- **Why it exists:** the LAN `https://` address fails from another container, because that container's runtime does not trust this server's Root CA; the bridge address is plain HTTP and needs no trust setup.
|
||||
- **Usage:** in Open WebUI, Admin Panel → Connections → OpenAI API, paste the URL, Save, and add the `private/` model IDs shown on the Status Page.
|
||||
- **Cost:** none; the service does not restart.
|
||||
|
||||
## Tasks
|
||||
|
||||
One, and it is advisory.
|
||||
@@ -165,6 +194,9 @@ A restored instance comes back with the same key and works immediately, since no
|
||||
5. **The API key cannot be cleared from the action** — leaving the field blank preserves it.
|
||||
6. **The package cannot add settings to the proxy's config file**, which upstream rewrites wholesale.
|
||||
7. **The only package-level setting is verbose logging.** Everything else is upstream's.
|
||||
8. **Same-server clients must use the bridge address, not the LAN `https://` URL** — see [Network Access and Interfaces](#network-access-and-interfaces).
|
||||
9. **Known SDK listener warning (accepted).** `main` reads the files reactively with `.const()` — necessary so a key saved on the Status Page clears the setup task. That hits the known Start9 SDK pattern around `FileHelper.produce` that can emit a cosmetic `MaxListenersExceededWarning` (start9labs/start-technologies#3182). It is library-side and cosmetic; the reactive reads are required, so we deliberately do not "fix" it.
|
||||
10. **Upstream request bodies are unbounded (accepted, documented).** Upstream v0.6.0 does not cap HTTP request-body size, so a client that can reach the API could spend memory with very large POSTs (a potential DoS). This is upstream code — this wrapper cannot fix it without forking the proxy — so the mitigation is to keep the API interface private (LAN/VPN/Tor) and never expose it on the public internet. The interface is unauthenticated anyway (see #3), so it should never be publicly reachable.
|
||||
|
||||
---
|
||||
|
||||
@@ -189,6 +221,7 @@ startos_managed_env_vars:
|
||||
- HOST
|
||||
- PORT
|
||||
- DEBUG
|
||||
- PPQ_ALLOWED_HOSTS # set automatically from the binding's addresses (v0.6.0:4+)
|
||||
# PPQ_API_KEY is deliberately NOT set — the proxy's key store owns the key
|
||||
dependencies: [] # but requires internet and a funded PPQ.AI account
|
||||
interfaces:
|
||||
@@ -196,8 +229,11 @@ interfaces:
|
||||
api: { type: api, port: 8787 } # same binding, exported as a second interface
|
||||
actions:
|
||||
- configure-api-key # blank key field preserves the existing key
|
||||
- show-service-to-service-url # prints http://<bridge-ip>:<port>/v1 for same-server clients (Open WebUI)
|
||||
tasks:
|
||||
- { action: configure-api-key, severity: important } # not critical, by design
|
||||
health_checks:
|
||||
- proxy # the port opens only after enclave attestation succeeds
|
||||
```
|
||||
|
||||
**Stable contract for dependents:** `startos/utils.ts` exports `apiHostId` (`'main'`) and `apiPort` (`8787`) — the values a package like Open WebUI imports rather than hardcoding (`sdk.host.getBridgeAddress(effects, { packageId: 'ppq-private-mode', hostId: apiHostId, internalPort: apiPort, ssl: false })`).
|
||||
+18
-2
@@ -48,7 +48,7 @@ Point any OpenAI-compatible client at the API address:
|
||||
|
||||
```
|
||||
POST <api-address>/v1/chat/completions
|
||||
{"model": "private/glm-5-2", "messages": [{"role": "user", "content": "Hello"}]}
|
||||
{"model": "private/glm-5-3", "messages": [{"role": "user", "content": "Hello"}]}
|
||||
```
|
||||
|
||||
Anthropic-SDK clients (including Claude Code) can use the native endpoint at
|
||||
@@ -56,7 +56,7 @@ Anthropic-SDK clients (including Claude Code) can use the native endpoint at
|
||||
|
||||
```
|
||||
export ANTHROPIC_BASE_URL="<api-address>"
|
||||
export ANTHROPIC_MODEL="private/glm-5-2"
|
||||
export ANTHROPIC_MODEL="private/glm-5-3"
|
||||
```
|
||||
|
||||
`GET <api-address>/v1/models` lists the available private models, and the Status
|
||||
@@ -65,6 +65,22 @@ Page shows the same list.
|
||||
Requests are billed to your saved API key by default. To bill a different
|
||||
PPQ.AI key per request, pass it as an `Authorization: Bearer` header.
|
||||
|
||||
### Open WebUI (or any service on this same server)
|
||||
|
||||
Open WebUI and this proxy are separate StartOS services. From one container to
|
||||
another, the LAN `https://` address fails certificate validation — the calling
|
||||
container does not trust this server's self-signed Root CA. Use the internal
|
||||
LXC-bridge address instead, which is plain HTTP (no TLS involved):
|
||||
|
||||
1. On this service, run the **Service-to-Service URL** action (Actions tab).
|
||||
2. Copy the URL it prints — `http://<bridge-ip>:<port>/v1`.
|
||||
3. In Open WebUI: **Admin Panel → Connections → OpenAI API**, paste the URL in
|
||||
the URL field, click **Save**, and add the `private/` model IDs shown on the
|
||||
Status Page (for example `private/glm-5-3`).
|
||||
|
||||
Any other service container on the same server can use the same URL. It is not
|
||||
reachable from your browser — that is what the LAN `https://` address is for.
|
||||
|
||||
### Replacing the key
|
||||
|
||||
Either surface works, and both write the same place: **Replace key** on the
|
||||
|
||||
+1
-1
Submodule ppq-private-mode-proxy updated: 3ba4ac9431...214656ded6.
@@ -15,9 +15,8 @@ const inputSpec = InputSpec.of({
|
||||
default: null,
|
||||
masked: true,
|
||||
placeholder: 'sk-...',
|
||||
// Upstream's own shape check, applied here too — the Status Page rejects a
|
||||
// malformed key outright, but a key written straight to config.json would
|
||||
// only surface as a 401 on the first request.
|
||||
// Same exact shape check as upstream v0.6.0, so a key accepted here is
|
||||
// never later rejected by the proxy's own status-page endpoint.
|
||||
patterns: [
|
||||
{
|
||||
regex: '^sk-[A-Za-z0-9]{16,64}$',
|
||||
@@ -56,9 +55,20 @@ export const configureApiKey = sdk.Action.withInput(
|
||||
}),
|
||||
|
||||
async ({ effects, input }) => {
|
||||
// Write each setting only when it actually changed. main.ts re-runs — and
|
||||
// the daemon restarts — on every file change, so writing values
|
||||
// unconditionally would restart the service (possibly twice) for nothing.
|
||||
const currentDebug = (await storeJson.read((s) => s.debug).once()) ?? false
|
||||
if (input.debug !== currentDebug) {
|
||||
await storeJson.merge(effects, { debug: input.debug })
|
||||
}
|
||||
|
||||
const apiKey = (input.apiKey ?? '').trim()
|
||||
if (apiKey) await configJson.merge(effects, { apiKey })
|
||||
if (apiKey) {
|
||||
const currentKey = (await configJson.read((c) => c.apiKey).once()) ?? ''
|
||||
if (apiKey !== currentKey) {
|
||||
await configJson.merge(effects, { apiKey })
|
||||
}
|
||||
}
|
||||
},
|
||||
)
|
||||
@@ -1,4 +1,8 @@
|
||||
import { sdk } from '../sdk'
|
||||
import { configureApiKey } from './configureApiKey'
|
||||
import { showServiceUrl } from './showServiceUrl'
|
||||
|
||||
export const actions = sdk.Actions.of().addAction(configureApiKey)
|
||||
export const actions = sdk
|
||||
.Actions.of()
|
||||
.addAction(configureApiKey)
|
||||
.addAction(showServiceUrl)
|
||||
@@ -0,0 +1,65 @@
|
||||
import { sdk } from '../sdk'
|
||||
import { apiHostId, apiPort } from '../utils'
|
||||
import { i18n } from '../i18n'
|
||||
|
||||
/**
|
||||
* Surfaces the internal (service-to-service) base URL another StartOS service
|
||||
* on this same server — e.g. Open WebUI — should be pointed at.
|
||||
*
|
||||
* The LAN `https://` address fails from another container on the box, because
|
||||
* the calling runtime does not trust this server's self-signed Root CA. The
|
||||
* LXC bridge address is plain HTTP, so no TLS/cert handling is involved. We
|
||||
* resolve it from our own binding rather than assuming anything about the
|
||||
* bridge IP or the assigned external port.
|
||||
*/
|
||||
export const showServiceUrl = sdk.Action.withoutInput(
|
||||
'show-service-to-service-url',
|
||||
|
||||
async ({ effects }) => ({
|
||||
name: i18n('Service-to-Service URL'),
|
||||
description: i18n(
|
||||
'Resolve the internal URL that services on this same StartOS server (e.g. Open WebUI) can use to reach this proxy over the LXC bridge, without TLS.',
|
||||
),
|
||||
warning: null,
|
||||
allowedStatuses: 'any',
|
||||
group: null,
|
||||
visibility: 'enabled',
|
||||
}),
|
||||
|
||||
async ({ effects }) => {
|
||||
const bridge = await sdk.host
|
||||
.getBridgeAddress(effects, {
|
||||
// Explicit self-reference: `packageId` may be omitted (it then defaults
|
||||
// to this package), but naming it keeps the call in lockstep with the
|
||||
// documented service-to-service contract in README.md.
|
||||
packageId: 'ppq-private-mode',
|
||||
hostId: apiHostId,
|
||||
internalPort: apiPort,
|
||||
ssl: false,
|
||||
})
|
||||
.once()
|
||||
|
||||
if (!bridge) {
|
||||
throw new Error(
|
||||
i18n(
|
||||
'Could not resolve the service-to-service address for this package.',
|
||||
),
|
||||
)
|
||||
}
|
||||
|
||||
return {
|
||||
version: '1',
|
||||
title: i18n('Service-to-Service Base URL'),
|
||||
message: i18n(
|
||||
'Paste this URL into Open WebUI (Admin → Connections → OpenAI API, URL field), Save, then add the private/ model IDs shown on the Status Page. This address only works from services on this same server — it is not reachable from your browser.',
|
||||
),
|
||||
result: {
|
||||
type: 'single',
|
||||
value: `http://${bridge}/v1`,
|
||||
copyable: true,
|
||||
qr: false,
|
||||
masked: false,
|
||||
},
|
||||
}
|
||||
},
|
||||
)
|
||||
@@ -21,6 +21,12 @@ const dict = {
|
||||
'Set the PPQ.AI API key the proxy uses to authenticate. Requests are billed to this key.': 14,
|
||||
// init/taskConfigureApiKey.ts
|
||||
'Add your PPQ.AI API key here, or start the service and save one on the Status Page': 15,
|
||||
// actions/showServiceUrl.ts
|
||||
'Service-to-Service URL': 16,
|
||||
'Resolve the internal URL that services on this same StartOS server (e.g. Open WebUI) can use to reach this proxy over the LXC bridge, without TLS.': 17,
|
||||
'Service-to-Service Base URL': 18,
|
||||
'Paste this URL into Open WebUI (Admin → Connections → OpenAI API, URL field), Save, then add the private/ model IDs shown on the Status Page. This address only works from services on this same server — it is not reachable from your browser.': 19,
|
||||
'Could not resolve the service-to-service address for this package.': 20,
|
||||
} as const
|
||||
|
||||
/**
|
||||
|
||||
@@ -18,6 +18,11 @@ export default {
|
||||
13: 'Configurar clave API de PPQ',
|
||||
14: 'Establece la clave API de PPQ.AI que el proxy usa para autenticarse. Las solicitudes se facturan a esta clave.',
|
||||
15: 'Añade aquí tu clave API de PPQ.AI, o inicia el servicio y guárdala en la Página de estado',
|
||||
16: 'URL de servicio a servicio',
|
||||
17: 'Resuelve la URL interna que los servicios de este mismo servidor StartOS (p. ej. Open WebUI) pueden usar para llegar a este proxy a través del puente LXC, sin TLS.',
|
||||
18: 'URL base de servicio a servicio',
|
||||
19: 'Pega esta URL en Open WebUI (Admin → Connections → OpenAI API, campo URL), guarda y añade los IDs de modelo private/ que muestra la Página de estado. Esta dirección solo funciona desde servicios del mismo servidor — no es accesible desde tu navegador.',
|
||||
20: 'No se pudo resolver la dirección de servicio a servicio de este paquete.',
|
||||
},
|
||||
de_DE: {
|
||||
0: 'Starte PPQ Private Mode!',
|
||||
@@ -36,6 +41,11 @@ export default {
|
||||
13: 'PPQ-API-Schlüssel konfigurieren',
|
||||
14: 'Lege den PPQ.AI-API-Schlüssel fest, mit dem sich der Proxy authentifiziert. Anfragen werden diesem Schlüssel in Rechnung gestellt.',
|
||||
15: 'Füge deinen PPQ.AI-API-Schlüssel hier hinzu, oder starte den Dienst und speichere ihn auf der Statusseite',
|
||||
16: 'Service-to-Service-URL',
|
||||
17: 'Ermittelt die interne URL, über die Dienste auf diesem StartOS-Server (z. B. Open WebUI) den Proxy über die LXC-Brücke ohne TLS erreichen können.',
|
||||
18: 'Service-to-Service-Basis-URL',
|
||||
19: 'Füge diese URL in Open WebUI ein (Admin → Connections → OpenAI API, URL-Feld), speichere und füge dann die private/ Modell-IDs von der Statusseite hinzu. Diese Adresse funktioniert nur für Dienste auf demselben Server — aus deinem Browser ist sie nicht erreichbar.',
|
||||
20: 'Die Service-to-Service-Adresse für dieses Paket konnte nicht ermittelt werden.',
|
||||
},
|
||||
pl_PL: {
|
||||
0: 'Uruchamianie PPQ Private Mode!',
|
||||
@@ -54,6 +64,11 @@ export default {
|
||||
13: 'Skonfiguruj klucz API PPQ',
|
||||
14: 'Ustaw klucz API PPQ.AI, którym proxy się uwierzytelnia. Żądania są rozliczane na ten klucz.',
|
||||
15: 'Dodaj tutaj swój klucz API PPQ.AI albo uruchom usługę i zapisz go na Stronie stanu',
|
||||
16: 'Adres URL między usługami',
|
||||
17: 'Ustala wewnętrzny adres URL, pod którym usługi na tym samym serwerze StartOS (np. Open WebUI) mogą dotrzeć do proxy przez most LXC, bez TLS.',
|
||||
18: 'Podstawowy adres URL między usługami',
|
||||
19: 'Wklej ten adres URL w Open WebUI (Admin → Connections → OpenAI API, pole URL), zapisz, a następnie dodaj identyfikatory modeli private/ widoczne na Stronie stanu. Adres działa tylko z usług na tym samym serwerze — nie jest dostępny z przeglądarki.',
|
||||
20: 'Nie udało się ustalić adresu między usługami dla tego pakietu.',
|
||||
},
|
||||
fr_FR: {
|
||||
0: 'Démarrage de PPQ Private Mode !',
|
||||
@@ -72,5 +87,10 @@ export default {
|
||||
13: 'Configurer la clé API PPQ',
|
||||
14: "Définissez la clé API PPQ.AI avec laquelle le proxy s'authentifie. Les requêtes sont facturées sur cette clé.",
|
||||
15: "Ajoutez ici votre clé API PPQ.AI, ou démarrez le service et enregistrez-la sur la Page d'état",
|
||||
16: 'URL de service à service',
|
||||
17: "Résout l'URL interne que les services de ce même serveur StartOS (p. ex. Open WebUI) peuvent utiliser pour joindre ce proxy via le pont LXC, sans TLS.",
|
||||
18: 'URL de base de service à service',
|
||||
19: "Collez cette URL dans Open WebUI (Admin → Connections → OpenAI API, champ URL), enregistrez, puis ajoutez les identifiants de modèles private/ affichés sur la Page d'état. Cette adresse ne fonctionne que depuis des services sur ce même serveur — elle n'est pas accessible depuis votre navigateur.",
|
||||
20: "Impossible de résoudre l'adresse de service à service de ce package.",
|
||||
},
|
||||
} satisfies Record<string, LangDict>
|
||||
+45
-2
@@ -1,7 +1,8 @@
|
||||
import { utils } from '@start9labs/start-sdk'
|
||||
import { i18n } from './i18n'
|
||||
import { sdk } from './sdk'
|
||||
import { manifest } from './manifest'
|
||||
import { apiPort, dataDir } from './utils'
|
||||
import { apiHostId, apiPort, dataDir } from './utils'
|
||||
import { configureApiKey } from './actions/configureApiKey'
|
||||
import { configJson } from './fileModels/config.json'
|
||||
import { storeJson } from './fileModels/store.json'
|
||||
@@ -23,6 +24,40 @@ export const main = sdk.setupMain(async ({ effects }) => {
|
||||
await sdk.action.clearTask(effects, `${manifest.id}:${configureApiKey.id}`)
|
||||
}
|
||||
|
||||
// DNS-rebinding hardening. Upstream's proxy is bound to 0.0.0.0, and without
|
||||
// PPQ_ALLOWED_HOSTS it accepts any Host header — a hostile web page could
|
||||
// reach it as "same-origin" and even overwrite the stored API key via
|
||||
// /setup/api-key. Pin the accepted Hosts to exactly the addresses StartOS
|
||||
// serves this binding on, plus loopback and the bridge (what Open WebUI
|
||||
// dials). Resolved reactively so an address added later is picked up on the
|
||||
// next restart.
|
||||
const servedHosts = await sdk.host
|
||||
.getOwn(
|
||||
effects,
|
||||
apiHostId,
|
||||
(host) =>
|
||||
host
|
||||
? utils
|
||||
.filledAddress(host, {
|
||||
hostId: apiHostId,
|
||||
internalPort: apiPort,
|
||||
username: null,
|
||||
scheme: null,
|
||||
sslScheme: null,
|
||||
suffix: '',
|
||||
})
|
||||
.matchesAny([{ visibility: 'private' }, { visibility: 'public' }])
|
||||
.filter({ exclude: { kind: ['localhost', 'link-local'] } })
|
||||
.hostnames.map((h) => h.hostname)
|
||||
: [],
|
||||
)
|
||||
.const()
|
||||
|
||||
const osIp = await sdk.getOsIp(effects)
|
||||
const allowedHosts = Array.from(
|
||||
new Set(['localhost', '127.0.0.1', osIp, ...servedHosts].filter(Boolean)),
|
||||
).join(',')
|
||||
|
||||
const subcontainer = sdk.SubContainer.of(
|
||||
effects,
|
||||
{ imageId: 'proxy' },
|
||||
@@ -48,7 +83,15 @@ export const main = sdk.setupMain(async ({ effects }) => {
|
||||
subcontainer,
|
||||
exec: {
|
||||
command: ['node', '/app/dist/bin/server.js'],
|
||||
env: {
|
||||
env: allowedHosts
|
||||
? {
|
||||
PPQ_DATA_DIR: dataDir,
|
||||
HOST: '0.0.0.0',
|
||||
PORT: apiPort.toString(),
|
||||
DEBUG: debug ? 'true' : 'false',
|
||||
PPQ_ALLOWED_HOSTS: allowedHosts,
|
||||
}
|
||||
: {
|
||||
PPQ_DATA_DIR: dataDir,
|
||||
HOST: '0.0.0.0',
|
||||
PORT: apiPort.toString(),
|
||||
|
||||
@@ -5,7 +5,7 @@ export const manifest = setupManifest({
|
||||
id: 'ppq-private-mode',
|
||||
title: 'PPQ Private Mode',
|
||||
license: 'MIT',
|
||||
packageRepo: 'https://github.com/Start9-Community/ppq-private-mode-startos',
|
||||
packageRepo: 'https://github.com/sondreolav/ppq-private-mode-startos',
|
||||
upstreamRepo: 'https://github.com/PayPerQ/ppq-private-mode-proxy',
|
||||
marketingUrl: 'https://ppq.ai',
|
||||
donationUrl: null,
|
||||
|
||||
@@ -3,6 +3,11 @@
|
||||
// Port the proxy listens on inside the container (upstream default).
|
||||
export const apiPort = 8787
|
||||
|
||||
// Host id of the binding the proxy's API and Status Page are served from.
|
||||
// Dependents import this along with apiPort (the stable contract) rather than
|
||||
// hardcoding either — mirroring the open-webui KNOWN_BACKENDS pattern.
|
||||
export const apiHostId = 'main'
|
||||
|
||||
// Upstream's PPQ_DATA_DIR inside the container: where it persists the API key
|
||||
// saved from the status page.
|
||||
export const dataDir = '/data'
|
||||
@@ -2,13 +2,18 @@ import { IMPOSSIBLE, VersionInfo } from '@start9labs/start-sdk'
|
||||
|
||||
export const current = VersionInfo.of({
|
||||
// Tracks upstream ppq-private-mode-proxy (package.json version).
|
||||
version: '0.4.1:0',
|
||||
version: '0.6.0:4',
|
||||
releaseNotes: {
|
||||
en_US: 'Initial release for StartOS',
|
||||
es_ES: 'Lanzamiento inicial para StartOS',
|
||||
de_DE: 'Erstveröffentlichung für StartOS',
|
||||
pl_PL: 'Pierwsze wydanie dla StartOS',
|
||||
fr_FR: 'Version initiale pour StartOS',
|
||||
en_US:
|
||||
'DNS-rebinding hardening: PPQ_ALLOWED_HOSTS is now set automatically from the actual hostnames StartOS serves this API on (addresses, .local, domains, plus bridge and loopback), so a hostile page can no longer reach the proxy as same-origin or overwrite the stored key. Configure PPQ API Key now only writes the API key when it actually changed (no unnecessary restart).',
|
||||
es_ES:
|
||||
'Refuerzo contra DNS-rebinding: PPQ_ALLOWED_HOSTS ahora se establece automáticamente a partir de los hostnames reales que StartOS sirve en esta API (direcciones, .local, dominios, más bridge y loopback), de modo que una página hostil ya no puede llegar al proxy como mismo-origen ni sobrescribir la clave guardada. Configure PPQ API Key ahora solo escribe la clave API cuando realmente cambia (sin reinicio innecesario).',
|
||||
de_DE:
|
||||
'DNS-Rebinding-Härtung: PPQ_ALLOWED_HOSTS wird jetzt automatisch aus den tatsächlichen Hostnamen gesetzt, die StartOS für diese API bedient (Adressen, .local, Domains sowie Bridge und Loopback), sodass eine bösartige Seite den Proxy nicht mehr als Same-Origin erreichen oder den gespeicherten Schlüssel überschreiben kann. „Configure PPQ API Key“ schreibt den API-Schlüssel jetzt nur noch, wenn er sich tatsächlich geändert hat (kein unnötiger Neustart).',
|
||||
pl_PL:
|
||||
'Wzmocnienie przed atakiem DNS-rebinding: PPQ_ALLOWED_HOSTS jest teraz ustawiane automatycznie na podstawie rzeczywistych nazw hostów, które StartOS serwuje dla tego API (adresy, .local, domeny oraz most i loopback), dzięki czemu wroga strona nie może już dotrzeć do proxy jako same-origin ani nadpisać zapisanego klucza. Akcja Configure PPQ API Key zapisuje teraz klucz API tylko wtedy, gdy faktycznie się zmienił (bez zbędnego restartu).',
|
||||
fr_FR:
|
||||
"Durcissement anti DNS-rebinding : PPQ_ALLOWED_HOSTS est désormais défini automatiquement à partir des noms d'hôte réels servis par StartOS pour cette API (adresses, .local, domaines, pont et loopback), de sorte qu'une page hostile ne peut plus atteindre le proxy en same-origin ni écraser la clé enregistrée. L'action Configure PPQ API Key n'écrit la clé API que lorsqu'elle change réellement (pas de redémarrage inutile).",
|
||||
},
|
||||
migrations: {
|
||||
up: async ({ effects }) => {},
|
||||
|
||||
Reference in new issue
Block a user