feat(ql3): observe package installations in console

This commit is contained in:
whyour
2026-08-20 14:42:54 +08:00
parent 344680d64a
commit ffa4b4e7cb
29 changed files with 1259 additions and 36 deletions
+31 -2
View File
@@ -125,6 +125,15 @@ and private key, and issue a short-lived strong User assertion with only
the D-374 canonical `/api/v3/workers/management`; the Console cannot accept the
legacy credential-management path or a credential mutation command file.
To enable Plugin Package installation observation, copy
`package-management-client-config.example.json` to
`package-management-client.json`, install its CA, and issue a short-lived
strong User assertion with only `package.manage` into
`package-management-assertion.jwt`. Its endpoint is fixed to the canonical
`/api/v3/plugin-packages/management`. This authority is independent of the
Project, Run and Worker files; the Console exposes no Package command file or
lifecycle mutation.
Create an independent 256-bit browser session key without placing its value in
argv or an environment variable:
@@ -143,6 +152,9 @@ Apply the same rule to `worker-management-client.json`,
`worker-management-ca.pem`, `worker-management-client.crt`,
`worker-management-client.key` and `worker-management-assertion.jwt` when
Worker observation is enabled.
Apply the same rule to `package-management-client.json`,
`package-management-ca.pem` and `package-management-assertion.jwt` when Package
observation is enabled.
Every file must be a current-owner, non-symlink, canonical regular file. The
session file contains exactly 43 base64url characters and no newline. It is a
@@ -176,6 +188,13 @@ Worker observation uses its own pair:
--worker-management-assertion /absolute/private/ql3-copilot-console/worker-management-assertion.jwt
```
Package observation also uses an independent pair:
```sh
--package-management-config /absolute/private/ql3-copilot-console/package-management-client.json \
--package-management-assertion /absolute/private/ql3-copilot-console/package-management-assertion.jwt
```
It validates every configured private authority and performs one unauthenticated
TLS 1.3 `GET /readyz`. It does not open the Console listener or reveal paths,
endpoint, credential, Project or Cluster identity.
@@ -222,6 +241,14 @@ read; each listed Worker can be inspected only by another explicit click. The
projection contains bounded lifecycle, compatibility, architecture, protocol
and capacity facts, but no credential, raw capability, label or Secret.
Explicit Package management authority adds `package_list|package_inspect`, for
a maximum vocabulary of twenty operations when every optional authority is
enabled. The list is fixed at 16 installations with click-only pagination and
click-only inspection. The product projection includes Package version,
installation state, availability and bounded recovery codes, but omits
installation IDs, locks, record digests, transport identity and every Package
mutation. Package authority remains disabled by default.
## Export a redacted evidence bundle
After at least one successful read, **Export redacted bundle** creates one
@@ -276,8 +303,10 @@ read-only private mount; all certificate paths in the config must point into
that mount. `disabled` is the only default and unknown values fail closed.
Worker observation follows the independent
`QL3_COPILOT_CONSOLE_WORKER_MANAGEMENT=enabled` switch and reads only its
Worker config/assertion pair. Enabling one management authority does not enable
the other.
Worker config/assertion pair. Package observation follows
`QL3_COPILOT_CONSOLE_PACKAGE_MANAGEMENT=enabled` and reads only its Package
config/assertion pair. Enabling one management authority does not enable either
of the others.
| Resource class | Memory | CPU | PIDs | Console reads |
| --- | ---: | ---: | ---: | ---: |
@@ -26,6 +26,7 @@ port=${QL3_COPILOT_CONSOLE_PORT-}
resource_class=${QL3_COPILOT_CONSOLE_RESOURCE_CLASS-compact}
run_management=${QL3_COPILOT_CONSOLE_RUN_MANAGEMENT-disabled}
worker_management=${QL3_COPILOT_CONSOLE_WORKER_MANAGEMENT-disabled}
package_management=${QL3_COPILOT_CONSOLE_PACKAGE_MANAGEMENT-disabled}
printf '%s' "$image" | grep -Eq '^[A-Za-z0-9][A-Za-z0-9._/-]{0,191}@sha256:[0-9a-f]{64}$' || fail
printf '%s' "$network" | grep -Eq '^[A-Za-z0-9][A-Za-z0-9_.-]{0,62}$' || fail
@@ -67,6 +68,10 @@ case "$worker_management" in
disabled|enabled) ;;
*) fail ;;
esac
case "$package_management" in
disabled|enabled) ;;
*) fail ;;
esac
set -- docker run --rm --pull never --init --read-only \
--network "$network" \
@@ -103,6 +108,12 @@ if [ "$worker_management" = enabled ]; then
--worker-management-assertion /var/run/secrets/qinglong3/copilot-console/worker-management-assertion.jwt
fi
if [ "$package_management" = enabled ]; then
set -- "$@" \
--package-management-config /var/run/secrets/qinglong3/copilot-console/package-management-client.json \
--package-management-assertion /var/run/secrets/qinglong3/copilot-console/package-management-assertion.jwt
fi
if [ "$mode" = check ]; then
set -- "$@" --check
fi
@@ -5,5 +5,6 @@
"QL3_COPILOT_CONSOLE_PORT": "5701",
"QL3_COPILOT_CONSOLE_RESOURCE_CLASS": "compact",
"QL3_COPILOT_CONSOLE_RUN_MANAGEMENT": "disabled",
"QL3_COPILOT_CONSOLE_WORKER_MANAGEMENT": "disabled"
"QL3_COPILOT_CONSOLE_WORKER_MANAGEMENT": "disabled",
"QL3_COPILOT_CONSOLE_PACKAGE_MANAGEMENT": "disabled"
}
@@ -0,0 +1,7 @@
{
"schemaVersion": 1,
"endpoint": "https://replace-cluster-api.example.com:8443/api/v3/plugin-packages/management",
"servername": "replace-cluster-api.example.com",
"caFile": "/absolute/private/ql3-copilot-console/package-management-ca.pem",
"requestTimeoutMs": 5000
}