Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 0 additions & 10 deletions .claude/settings.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,4 @@
{
"env": {
"CRABBOX_PROVIDER": "proxmox",
"CRABBOX_PROXMOX_API_URL": "https://192.168.250.2:8006",
"CRABBOX_PROXMOX_TOKEN_ID": "crabbox@pve!ci",
"CRABBOX_PROXMOX_NODE": "babo",
"CRABBOX_PROXMOX_TEMPLATE_ID": "9400",
"CRABBOX_PROXMOX_STORAGE": "raid5",
"CRABBOX_PROXMOX_BRIDGE": "vmbr1",
"CRABBOX_PROXMOX_INSECURE_TLS": "1"
},
"permissions": {
"allow": [
"Bash(crabbox run:*)",
Expand Down
16 changes: 12 additions & 4 deletions .claude/skills/test/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,15 @@ which the sandboxed dev box lacks. This suite is **authored here, run by the
operator**: crabbox leases an ephemeral Proxmox VM, rsyncs the working tree, runs
the suite, and tears down.

Provider env (proxmox) comes from `.claude/settings.json` (the **non-secret** provider
config). The `CRABBOX_PROXMOX_TOKEN_SECRET` lives **only** in the gitignored
`.claude/settings.local.json` — never commit it. Confirm with `crabbox doctor`.
The provider settings (`CRABBOX_PROVIDER`, `CRABBOX_PROXMOX_*`: API URL, token id and
secret, node, template, storage, bridge) live **only** in the gitignored
`.claude/settings.local.json` (`env` block) — never in the versioned `.claude/settings.json`,
which holds only the crabbox permissions: they are internal details of Kevin's lab and this
repository is public. Confirm with `crabbox doctor`.

> **State (2026-09-27): crabbox cannot lease boxes right now** — its Proxmox user was
> removed. Until Kevin sets it up again, the heavy tier does not run; say so in every
> report instead of claiming the E2E.

## Single-box flow (warm once → reuse the slug → stop)

Expand All @@ -37,7 +43,9 @@ config). The `CRABBOX_PROXMOX_TOKEN_SECRET` lives **only** in the gitignored
`.crabbox/captures/*.tar.gz` (logs, timings, ready-made stop command).
5. **Stop** when done: `crabbox stop --id <slug>`.

`run.sh` prints `N passed, M failed, K skipped` and exits non-zero on any failure.
`run.sh` prints `N passed, M failed, K skipped` plus every step that was not checked, and
exits 0 only if every step ran and passed: 1 on a failure, 77 if a step was skipped (a missing
tool, e2e without `LMNRADIUS_ALLOW_REAL=1`). `LMNRADIUS_ALLOW_SKIP=1` accepts skips on purpose.
`e2e`/`all` refuse to run without `LMNRADIUS_ALLOW_REAL=1` (a guard so heavy suites
never fire by accident on the dev box).

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ jobs:
# build-requirements.in (an extra or missing pin), a pin younger than seven days, a hash PyPI
# does not publish, or a locked version without a wheel for the target (CPython 3.12,
# glibc 2.39, x86_64). The fast tier and the build (packaging/build-venv.sh) run the same
# gate first; release.yml carries this job character for character.
# gate first; release.yml carries this job character for character, but for its display name.
lockfile:
runs-on: ubuntu-24.04
steps:
Expand Down
27 changes: 23 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,11 @@ on:
default: ''

jobs:
# Every job carries a display name with the prefix 'release: '. The main ruleset requires the
# ci.yml jobs BY NAME; a release run on the same commit (workflow_dispatch on a PR branch)
# with a job of the same name could otherwise stand in for a red ci.yml check.
gate:
name: 'release: gate'
runs-on: ubuntu-latest
outputs:
image: ${{ steps.meta.outputs.image }}
Expand All @@ -72,10 +76,12 @@ jobs:
echo "image=$IMG" >> "$GITHUB_OUTPUT"; echo "version=$VERSION" >> "$GITHUB_OUTPUT"

# The lock gate (scripts/check-lockfiles.sh) as a release gate of its own (release needs it),
# character for character the `lockfile` job of ci.yml: a tag cannot be published while a
# lock drifted from its inputs (cold verification of the debian umbau, finding 5). The build
# runs the same gate first (packaging/build-venv.sh); nothing is installed around it (R2).
# character for character the `lockfile` job of ci.yml (but for the display name, see above):
# a tag cannot be published while a lock drifted from its inputs (cold verification of the
# debian umbau, finding 5). The build runs the same gate first (packaging/build-venv.sh);
# nothing is installed around it (R2).
lockfile:
name: 'release: lockfile'
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
Expand All @@ -87,6 +93,7 @@ jobs:
run: bash scripts/check-lockfiles.sh

build:
name: 'release: build'
needs: gate
runs-on: ubuntu-latest
container:
Expand Down Expand Up @@ -133,6 +140,7 @@ jobs:
# freeze == lock gates of the build. This gate is permanent, and release.yml carries the
# same job (the run blocks are character-identical).
file-tree:
name: 'release: file-tree'
needs: build
runs-on: ubuntu-latest # GitHub-hosted: gh is installed here, not in the container
permissions:
Expand Down Expand Up @@ -237,6 +245,7 @@ jobs:
PY

install-smoke:
name: 'release: install-smoke'
needs: build
runs-on: ubuntu-24.04
steps:
Expand Down Expand Up @@ -272,6 +281,7 @@ jobs:
# puts realistic config/state in place, upgrades to the freshly built package and
# checks that nothing was lost. It skips itself on the very first release.
upgrade-smoke:
name: 'release: upgrade-smoke'
needs: build
runs-on: ubuntu-24.04
permissions:
Expand Down Expand Up @@ -525,6 +535,7 @@ jobs:
run: sudo journalctl -u linuxmuster-radius.service --no-pager | tail -60 || true

release:
name: 'release: release'
needs: [gate, lockfile, build, file-tree, install-smoke, upgrade-smoke]
if: github.ref_type == 'tag'
runs-on: ubuntu-latest
Expand Down Expand Up @@ -652,7 +663,15 @@ jobs:
[ "$i" = 3 ] || sleep $((i * 5))
done
if [ "$immutable" != true ]; then
echo "::error::$TAG is published but NOT immutable (immutable=${immutable:-unreadable}), its assets can still be replaced: delete release $rid (the tag stays), turn immutable releases on, re-run this job"
if [ "$immutable" = false ]; then
echo "::error::$TAG is published but NOT immutable, its assets can still be replaced: delete release $rid (the tag stays), turn immutable releases on, re-run this job"
else
# Unreadable is not "false": the release may well be immutable (and then cannot be
# replaced anyway), so never tell anyone to delete it on a failed read. One line, or
# the annotation shows only the first line of a multi-line error answer.
shown=${immutable//$'\n'/ }
echo "::error::$TAG is published, but whether it is immutable could not be read (${shown:-no answer}). Do not delete it: check with gh api repos/$GH_REPO/releases/$rid --jq .immutable; only if that prints false, delete release $rid (the tag stays), turn immutable releases on and re-run this job"
fi
exit 1
fi
echo "$TAG is published and immutable"
7 changes: 4 additions & 3 deletions .github/workflows/renovate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@
#
# SPDX-License-Identifier: GPL-3.0-or-later

# DISABLED (Kevin, 2026-09-25): this workflow is turned off in the repository settings until
# Renovate is re-enabled with a GitHub App; until then no Renovate PRs are opened and pins and
# locks are raised by hand. The rest of this header describes the workflow once re-enabled.
# STATE (Kevin, 2026-09-25): this workflow is disabled in every faircomp repo (gh workflow disable,
# shown as disabled_manually). Nothing below runs and no Renovate pull requests arrive; pinned
# versions move only in reviewed pull requests raised by hand, until Renovate returns as a
# GitHub App, which replaces this workflow. The rest of this header describes it when enabled.
#
# Self-hosted Renovate — so digest bumps work without depending on the org-level
# Renovate/Mend GitHub App. Runs weekly and on demand. It opens PRs that bump the
Expand Down
47 changes: 37 additions & 10 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,34 @@ conventions are `../../docs/paket-konventionen.md` there. The rules that bite he
gate) install fixture locks that pin only the test wheel, never the checkout's. It verifies
all three locks — grammar, every hash on PyPI, pin set == closure of the declared inputs
(uv re-resolves `pyproject.toml`/`build-requirements.in`) — and installs the uv it needs
itself, from the verified uv lock into an isolated venv, called by absolute path. The
gates run `/usr/bin/python3 -I`, set a fixed PATH and drop `VIRTUAL_ENV`, `PYTHON*`,
`UV_*` and `PIP_*` (and pip/uv config files), so an activated venv or a `.venv` in the
checkout takes no part. Not neutralized, a stated limit: `BASH_ENV`, exported shell
functions and proxy/CA variables (`HTTPS_PROXY`, `SSL_CERT_FILE`, `REQUESTS_CA_BUNDLE`, …)
— whoever sets those already runs code as the caller, or decides whom the gate trusts as PyPI.
itself, from the verified uv lock into an isolated venv, called by absolute path.
**The caller's environment (P1, an allowlist):** `scripts/check-lockfiles.sh`,
`packaging/build-venv.sh`, `packaging/make-deb.sh`, `scripts/tests/run.sh`,
`scripts/tests/lock_gates.sh` and `scripts/tests/make_deb_checks.sh` start with one and the same
block (`test_packaging.py` keeps it equal and first): unless it is the clean run already, the
script starts itself again under `env -i` through `/bin/bash -p` (which imports no function and
reads no `BASH_ENV`, `ENV`, `SHELLOPTS`, `BASHOPTS`) with exactly this environment:
`PATH=/usr/sbin:/usr/bin:/sbin:/bin`, `LANG`/`LC_ALL=C.UTF-8`, and where set `HOME`, `TMPDIR`,
the proxy variables (`http_proxy`, `https_proxy`, `no_proxy` and the upper-case three), the CA
variables (`SSL_CERT_FILE`, `SSL_CERT_DIR`, `REQUESTS_CA_BUNDLE`, `PIP_CERT`) and the switches
the repository's scripts pass each other (`LMNRADIUS_ALLOW_REAL`, `LMNRADIUS_ALLOW_SKIP`,
`LMNRADIUS_CALLER_PATH`, `LOCK_GATES_DEB`, `LOCK_GATES_VERBOSE`). Everything else is gone
without a list: venvs, `PYTHON*`, `UV_*`, `PIP_*`, `GIT_*`, Perl, make (`make -i deb` cannot
build past a failed gate, `make deb DEST=...` cannot move the venv), `TAR_OPTIONS`,
`GCONV_PATH`, `LD_LIBRARY_PATH`, `CDPATH`, and every function (`builtin`, `exec` included). Up
to the restart only keywords, assignments and `exec /usr/bin/env` run, with `POSIXLY_CORRECT`
set so that the special builtin `exec` comes before any function. The gates also read no
pip/uv config file and run `/usr/bin/python3 -I`. The Makefile starts `make-deb.sh`, and
`run.sh` its gate, with `/bin/bash -p`. `run.sh` keeps the caller's PATH aside
(`LMNRADIUS_CALLER_PATH`) and gives it back only after the gate passed: lint, unit and e2e use
the caller's tools on purpose. **Limit:** only what runs before the restart: the caller's shell
with its `BASH_ENV` and `SHELLOPTS` (`noexec` makes a directly started script do nothing and
end 0 — no verdict line, no summary line), `LD_PRELOAD` for that shell and `/usr/bin/env`, the
caller's own `make` of `make deb` (it reads `MAKEFLAGS`/`MAKEFILES` itself), and passing the
restart marker `--lmnradius-clean-env` as first argument by hand; plus what the allowlist
passes on purpose: files under `HOME` (git's and dpkg-buildpackage's configuration, pip/uv
caches: every installed file is hash-checked) and the proxy/CA variables, which decide whom
the gate trusts as PyPI. Whoever sets those already runs code as the caller.
Limit: pins are compared with the closure by name; another real release of a pinned
package (older or newer, a week old, genuine hashes) that satisfies the declared
requirements passes every gate — only the review of the lockfile diff catches it.
Expand Down Expand Up @@ -246,16 +268,21 @@ real docker-compose winbind/EAP E2E (**Samba AD DC + joined FreeRADIUS +
`eapol_test` supplicant**) that proves *teacher→Access-Accept (+correct VLAN) /
student-on-teacher-SSID→Access-Reject / wrong-password→Reject / non-`wifi` user→Reject*,
as well as multischool, update/rollback, and `.deb` install tests — needs real Linux
with **Docker**. **crabbox** leases an ephemeral Proxmox VM for this (provider in
`.claude/settings.json`, token only in the gitignored `.claude/settings.local.json`;
`crabbox doctor`). Rules/details: the `/test` skill (`.claude/skills/test/SKILL.md`).
with **Docker**. **crabbox** leases an ephemeral Proxmox VM for this (provider settings and
token only in the gitignored `.claude/settings.local.json`, never in the versioned
`.claude/settings.json`; `crabbox doctor`). **Not usable at the moment** (2026-09-27): its
Proxmox user was removed, so the heavy tier does not run until Kevin sets it up again.
Rules/details: the `/test` skill (`.claude/skills/test/SKILL.md`).

- **One aggregate runner:** `bash scripts/tests/run.sh [gate|lint|unit|quick|locks|e2e|all]`
(created in P0/P1). Every mode but `e2e` runs the lock gate first (network needed); if it
fails, run.sh stops there and runs nothing else. `quick` (default) = gate + lint + unit +
the lock regression test; `e2e`/`all` run the
Docker suites and **refuse without `LMNRADIUS_ALLOW_REAL=1`**. Summary:
`N passed, M failed, K skipped` (exit ≠ 0 on failure); steps dep-gated.
`N passed, M failed, K skipped`, then everything that was not checked (skipped, or not run
after a failed gate); steps dep-gated. Exit 0 only if every step ran and passed, 1 on a
failure, **77 if a step was skipped** (a missing tool, e2e without `LMNRADIUS_ALLOW_REAL=1`);
`LMNRADIUS_ALLOW_SKIP=1` accepts skips on purpose (exit 0, the last line still names them).
- **Box lifecycle:** `crabbox warmup` → `crabbox run --id <slug> -- 'bash scripts/tests/crabbox_bootstrap.sh'`
→ `crabbox run --id <slug> -- 'LMNRADIUS_ALLOW_REAL=1 bash scripts/tests/run.sh e2e'`
→ `crabbox stop --id <slug>`.
Expand Down
6 changes: 5 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,14 @@
# ghcr.io/linuxmuster/lmndev-runner:24.04@sha256:6b0c8ac994cf1d2da44b0b36ebd7b3b125094886e78293e04b9db5e515b8209e \
# bash -c 'apt-get update -qq && apt-get build-dep -y -qq . && runuser -u build -- make deb'
# git's ownership guard stays on: the checkout must belong to uid 1000 (the image's `build`).
# make-deb.sh starts itself again under `env -i` with an allowlist (CLAUDE.md, "Python
# dependencies"); -p keeps the caller's SHELLOPTS (noexec would make bash run nothing and end 0),
# BASH_ENV and exported functions from the one bash that does that. This make itself reads the
# caller's MAKEFLAGS and MAKEFILES (the stated limit); none of them reaches debian/rules.
.PHONY: deb clean

deb:
/bin/bash packaging/make-deb.sh
/bin/bash -p packaging/make-deb.sh

clean:
debian/rules clean
4 changes: 3 additions & 1 deletion controlplane/lmnradius/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,9 @@ def create_app(
) -> FastAPI:
"""Build the FastAPI app wiring routes to the store, reconciler and docker service."""
verify = make_verify_token(settings)
app = FastAPI(title="linuxmuster-radius control plane")
# The OpenAPI document carries the package version (debian/changelog via setup.py), like
# GET /v1/version; without it FastAPI reports its own default, 0.1.0.
app = FastAPI(title="linuxmuster-radius control plane", version=dist_version("lmnradius"))

@app.exception_handler(DockerException)
async def _docker_unreachable(_request: Request, exc: DockerException) -> JSONResponse:
Expand Down
8 changes: 8 additions & 0 deletions controlplane/tests/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,14 @@ def test_version(client: TestClient, auth_headers: dict[str, str]) -> None:
assert resp.json() == {"version": dist_version("lmnradius")}


def test_openapi_reports_the_package_version(client: TestClient) -> None:
# Up to 7.3.4 /openapi.json said "0.1.0" (FastAPI's default), whatever the package was.
resp = client.get("/openapi.json")
assert resp.status_code == 200
assert resp.json()["info"]["version"] == dist_version("lmnradius")
assert resp.json()["info"]["version"] != "0.1.0"


def test_missing_token_is_401(client: TestClient) -> None:
resp = client.get("/v1/instances")
assert resp.status_code == 401
Expand Down
Loading
Loading