Repository navigation
Conversation
added 29 commits
November 23, 2026 11:41
Prepares a second binary package from the same source: debian/install, links, preinst, postinst, prerm and postrm only apply to the first package, so they become debian/linuxmuster-squid.*. No content change.
… API clients With tls_bind_host set in config.yml a second uvicorn server serves the same app over TLS on that management address (default port 8443), next to the unchanged plain listener on 127.0.0.1 that the CLI and the maintainer scripts use. Without it the service starts exactly as before. tls_bind_host must be an IP literal and never 0.0.0.0/::; a missing certificate or key, a port clash or a bad tls_allowed_clients entry stop the service with a reason in the journal. tls_allowed_clients answers 403 to every other peer of the TLS listener. The postinst makes a self-signed EC certificate once (tls/api.key 0600, api.crt), never replacing an existing one; `lmnsquid tls fingerprint` prints its SHA-256 fingerprint for clients to pin. GET /v1/status (state of all instances in one call) and GET /v1/schema (the instance model's JSON schema with its defaults) are added for the WebUI plugin; no existing endpoint changes. Docs and ADR-018 follow with the plugin.
…ter-squid-webui The plugin for linuxmuster-webui7 (lmn73) manages one or more control planes from the school server: a connection list (name, display name, URL, token, pinned certificate fingerprint, optional school tags) in /etc/linuxmuster-squid-webui/config.yml (0600 root, atomic, locked), and for each server everything the API offers: instances with state, create/edit/ delete (keep logs), start/stop/restart, update/rollback, update-all, reconcile, logs and access log, blocklist and noauth list with reload, version. Every endpoint names its connection in the path; an unknown one is 404. Access is for global administrators only, twice: lm:squid:list/change and the sidebar entry are true for globaladministrator only (permissions.yml), and every endpoint checks the session's sophomorixRole again. Tokens never go back to the browser. The client is standard library only: with a fingerprint no CA is trusted and the certificate hash must match before anything is sent; without one the system CAs and the host name are checked; plain http to loopback only. Control-plane 401/403 reach the browser as 502 (a 401 would log the admin out). Packaging: Architecture all, Depends linuxmuster-webui7 (>= 7.3), (<< 7.4); debian/rules builds resources/build/all.js and the locale JSON with webui/build_plugin.py (ES5 sources, no node/babel in the build, ES2015 syntax is refused); postinst runs merge-permissions.py, sophomorix-ui and try-restarts the WebUI, postrm undoes that, purge removes the connection list. German and English. Docs: ADR-018 (TLS listener), ADR-019 (plugin), threat model T5/T18, architecture, install (9a), operations, README, test strategy, changelog.
No job is added, renamed or removed (the required checks stay as they are). - fast: mypy and pytest for the WebUI plugin as extra steps; shellcheck covers the per-package maintainer scripts (debian/*.preinst|postinst|prerm|postrm). - package / release build: exactly two .debs, md5sums checked for each; lintian lints both. - file-tree, install-smoke, upgrade-smoke: select the control-plane package (linuxmuster-squid_*_amd64.deb); the upgrade expects the TLS certificate the postinst now makes once (tls/ 0700, api.key 0600, api.crt 0644). - install-smoke: new step scripts/tests/webui_deb_smoke.sh installs the plugin package without linuxmuster-webui7 next to recording stand-ins of merge-permissions.py and sophomorix-ui (file tree, permissions.yml, configure/remove/purge, __pycache__ cleanup). - run.sh unit and make_deb.sh (identical builds) include the plugin.
… linuxmuster-squid_* make-deb.sh moved only files named linuxmuster-squid_* out of its build directory, so the linuxmuster-squid-webui .deb was built and then dropped.
… instance, validate early Findings of the first test in linuxmuster-webui7 7.3.44 on the lab server: - A create or edit that the control plane stored but whose container did not become healthy answered 5xx and left the dialog open without a visible error, so a second save ended in a conflict. Now the plugin checks after any non-422 error whether the instance (create) or the change (edit) was stored; if so the dialog closes, the server reloads and a warning says "Instance created, but the container is not healthy: <reason>". Otherwise the error stays visible in an alert at the top of the dialog instead of a fading notification only. - The connection form checks name, URL (https), token length and fingerprint before sending and shows a readable, translated sentence at the field; field errors of the API (422) are mapped to the same sentences, never a raw regex. - Create asks for the target server when no single server is selected; the API's defaults (port, cache, log days, clock skew) are filled in as values. - Container state as label class + translated text; yes/no for the status view; confirmation texts for restart, own button labels for each confirmation.
…dable German
- Buttons as in the official plugins: btn-lmn for primary actions (the dialogs'
btn-primary rendered as an unreadable dark box), btn-success to create,
btn-danger to delete, btn-default btn-flat to close; <button> with
ng:disabled while busy.
- Lifecycle and image actions in one uib-dropdown "Container actions"; logs,
lists, edit and delete stay visible; icon buttons have translated titles.
The redundant server column inside a server panel is gone.
- Container state as a coloured label; status tab as a translated key/value
table (exists, running, health check, running and configured image).
- Logs: aligned inline form, monospaced scroll box, "No entries." when empty;
lists say "The list is empty.".
- Edit dialog shows server, school and role as read-only text.
- Placeholders start with "e.g."; the client subnets help says what empty means
instead of suggesting 0.0.0.0/0; the image help shows the default digest.
- Message ids are specific ("Container state", "Update image", "all schools"):
all plugins share one catalogue and "State" got another plugin's "Bundesland".
German catalogue rebuilt for all 166 texts; the test also extracts
'...' | translate expressions.
… the create form
Leftovers of the browser check at 1366 px:
- The detail dialog is modal-lg (dialog-class, as lmn_clients does it), so the
five tabs fit one row.
- Logs ("Lines | Search text | Show log") and the list tabs ("domain | Add
domain", "Reload list on the proxy") are input groups in a grid row; the
buttons no longer drop below the inputs.
- Create from the top bar without a server: the fields are disabled and a hint
says to choose the server first; choosing it fills the API defaults (port,
cache, log retention, clock skew), also when a field was cleared to null.
The create button stays disabled until then.
A button group at the top switches the page; the choice is kept in the
browser's localStorage (lmn_squid.view). "By proxy server" is the layout so
far. "By school" shows one panel per school (from the instances of all servers
plus schools named in a connection's tags without an instance yet; default-
school first, then alphabetically), each with that school's instances from every
server, a "Proxy server" column and the same row actions. Server-level actions
stay reachable in a compact server list on top (state, version, instance count,
test, update all, reconcile, edit, remove), and an unreachable server is named
as a warning ("its instances are missing in this view"). Server and school
filters work in both views. "New proxy instance" in a school panel fills in the
school and preselects the server when exactly one connection carries that school
tag. The groups are rebuilt when data or filters change, not inside a watched
expression (no digest loop).
webui/tests/js/controller_check.js runs the built controller in node against
stand-ins (views, grouping and order, filters, preselection, defaults after
choosing a server); pytest runs it where node is installed (CI runner yes, the
build image no).
…rt creates a missing container
Two findings of the lab test:
- An instance whose keytab_secret was not in secrets_dir got a container all
the same: the volume bind of the missing path made Docker create a root-owned
DIRECTORY with the keytab's name on the host, squid failed and the API said
only "did not become healthy". ensure_running now checks first that the
keytab is a regular, non-empty file (no symlink, no directory) and raises
KeytabMissing, answered with 409 and a sentence naming the file, the
directory and docs/keytab-and-dns.md; nothing is pulled or created. The
keytab is passed to Docker as a Mount, which fails on a missing source
instead of creating it; the container spec and its fingerprint keep the
volume form, so no running container is replaced by this change. create and
edit keep the definition (the admin provisions the keytab, then starts);
/v1/status and /v1/instances/{name}/status report "problem": "keytab" with
"problem_detail" (additive). A group/world-readable keytab only warns.
- POST /v1/instances/{name}/start (and restart) on an instance without a
container answered 200 with exists: false and did nothing. They now create
the container from the stored definition, health-gated, like reconcile for
that one instance (409 for a missing keytab, 500 with the reason if it does
not come up). A stopped container is only started, as before.
Docs: operations, keytab-and-dns, threat model T1, changelog.
- No dialog could be closed in webui7 7.3.44: Cancel/Close used inline assignments (ng:click="detail = null"); the <dialog> directive transcludes into its own scope, so the assignment set a shadow property and the controller's dialog stayed open. All close paths are controller functions now (closeConnForm, closeInstForm, closeDelete, closeDetail); save/delete keep closing as before. Ajenti's <dialog> has no Escape/backdrop close, so there is nothing else to wire. A test refuses any assignment in an ng:click/submit/ change handler of the partial (it would have caught this); the node controller check calls every close handler. - Toolbar on one row at 1366 px: narrower filter selects, view toggle "by server | by school", reload as an icon, actions on the right. - An instance whose keytab is missing shows a red "keytab missing" label and the reason in its status tab (control plane "problem": "keytab"). The warning after a stored-but-failed create/edit says "saved, but its container is not running: <reason>" (it is not always about health).
PUT /v1/secrets/{name} writes a keytab into secrets_dir: name checked like
keytab_secret (a file name, no '..'), 1 byte to 64 KiB, 0600 as the service
user, atomically (temporary file, fsync, rename; a symlink is replaced, never
written through; an empty directory left by Docker for a missing keytab is
removed, a non-empty one is 409), audit-logged with name and size only.
GET /v1/secrets/{name} says only whether it exists and its mtime; there is no
way to read a secret back. Used by the WebUI plugin (ADR-020).
lmnsquid tls enable --bind-host <ip> [--port 8443] [--allow <cidr>]... sets the
TLS listener keys in config.yml, keeping every other line and comment, mode and
owner, atomically; refuses 0.0.0.0/:: and host names (same rules as the
service). Used by the WebUI setup over SSH and for manual setups.
…up (D0)
Before anything happens on a new host the plugin checks, without writing
anything (devices.csv is never edited by the plugin, Kevin 2026-11-23):
- input: school, FQDN in the domain of setup.ini, IPv4 address;
- the target is not this server (setup.ini serverip/servername, local
addresses) and not yet a connection;
- the proxy's row in the school's devices.csv, path as sophomorix names it
(devices.csv / <school>.devices.csv): exactly one row, host name and IP match;
- its role gets no computer account per COMPUTER_ACCOUNT in sophomorix.ini
(not a fixed role name);
- linuxmuster-import-devices ran: A and PTR resolve to the address, no
computer account <NAME>$, no HTTP/ or host/ SPN of the proxy on another
account (the checks of provision-keytab.sh, via ldbsearch, argument list).
Every failure names the fix in German ("Zeile ... mit Rolle iponly anlegen,
linuxmuster-import-devices ausführen"). Client networks cannot be detected
reliably, so that is a hint only.
…background jobs (D1, D2) D1 (sshsetup.py, paramiko from the WebUI's Python, no new dependency): - step 1 fetches the host key and shows its SHA256 fingerprint (as ssh-keygen -lf); the key stays in the worker, the browser only confirms the fingerprint; - step 2 runs only with that confirmation, against exactly that key: RejectPolicy with the key as the only known host key, never AutoAddPolicy, allow_agent=False, look_for_keys=False, timeouts; password login only, no key is generated or left on the target; - passwords reach the job process on stdin only (never argv, env, file, log or an answer to the browser); sudo -S -k -p '' reads it from the channel; the job state file is scrubbed of passwords and the token as a second line of defence; - a fixed step list, every input checked by pattern and passed through shlex.quote: preflight (Ubuntu 24.04, amd64, RAM, disk, clock), time from the DC (timesyncd or chrony), DNS on the DC if needed, host name, /etc/hosts and the cloud-init template, docker.io, the bundled linuxmuster-squid .deb of the same version (SFTP, sha256 checked locally and remotely), lmnsquid tls enable (school server as the only client), token and fingerprint read over the same session, connection created and tested; temp files removed, sudo -K. Every step is idempotent. D2 (keytab.py): one service account per host (squid-<host>, within the 20 characters of sAMAccountName), created with --random-password and no expiry, keytab exported by provision-keytab.sh (argument list) into tmpfs, read, sent with PUT /v1/secrets to every keytab name the host's instances use, deleted; all instances restarted (new KVNO). Also as a button for existing connections. Jobs (jobs.py, setup_runner.py) run detached (start_new_session) and write their progress to /run/lmn_squid/jobs/<id>.json (0600); one job per target (flock). Endpoints: GET site, POST setup/precheck|hostkey|start, GET jobs/<id>, POST <conn>/keytab; all global-admin only. Connections may carry the host's FQDN. Tests with fake paramiko, fake samba-tool and a real control plane on TLS.
The "Add proxy server" button is a dropdown: "Set up a new VM (SSH)" or "Connect an existing host" (the old form). The wizard asks for school, FQDN and address, runs the precheck and lists its results with the fix for every failure; then SSH user and passwords, connection name (from the host name), "create the keytab too"; it fetches the SSH host key and shows its SHA256 fingerprint with the ssh-keygen command for the VM's console, and starts only after the admin ticked that it is the same. The passwords leave the browser model with the start request. Progress is polled every 2 s and shown as the step list with status and output; closing the dialog does not stop the job. At the end "New proxy instance" opens the instance form with realm, the host's FQDN and proxy.keytab filled in. Every server gets a "Keytab" button (create the keytab on the DC, send it, restart the instances) with the same progress view. German texts for all new strings; the node controller check covers the wizard flow, polling and the prefilled instance form.
…-keytab.sh in the plugin package The setup over SSH installs exactly this build's control plane without any download (the lab has no release): execute_before_dh_builddeb-indep packs the finished arch tree of the same run with dpkg-deb into /usr/share/linuxmuster-squid-webui/ next to its .sha256 and refreshes the plugin package's md5sums; an indep-only build stops with a clear message. provision-keytab.sh (the keytab logic the plugin runs on the DC) is installed there too. The WebUI package smoke checks the bundled .deb (single file, sha256, same version as the plugin) and the script's mode.
…at model T19/T20, install section 0 ADR-009 is superseded for hosts managed from the WebUI; the manual path stays. install.md gets the WebUI way next to the manual one; architecture, test strategy and changelog describe the setup wizard, the keytab button and the write-only secrets endpoint.
…he WebUI worker paramiko's Transport is a thread; the WebUI worker runs under gevent's monkey patch. The scan of setup step 1 now runs as setup_runner.py --scan <ip> (JSON on stdout, 40 s limit), like the setup job itself; the worker only reads the result.
Found in the lab: the jobs directory was created with mkdir(parents=True) under the WebUI worker's umask 0, which left the missing parent /run/lmn_squid drwxrwxrwx root root; a local user could plant entries (symlinks, lock files) in a path root uses. - runtime.secure_dir creates every directory from /run/lmn_squid down 0700 by an explicit chmod and checks each with lstat before use: a real directory, not a symlink, owned by root; a symlink or another owner is refused, a directory of ours open to others is removed (rmtree, does not follow symlinks) and created again empty. - Lock files, job logs and the connection list's lock are opened with O_NOFOLLOW (a planted symlink is refused, never followed); job logs O_EXCL. - The keytab export directory is created below the checked directory. - The package ships a tmpfiles.d entry (d /run/lmn_squid 0700 root root); its postinst removes an existing /run/lmn_squid that is not a 0700 root directory (the state left by earlier builds) before the entry recreates it. Tests: umask 0, world-writable dir recreated empty, symlink refused, foreign owner refused, planted lock symlink not followed.
The step "Uhrzeit mit dem Schulserver synchronisieren" showed a raw epoch. It now waits up to 20 s for the first sync and reports "NTP-Server <dc>, synchronisiert: ja, Abweichung +1.2ms" (timesyncd or chrony); not yet synchronised is a warning with the Kerberos 5-minute limit.
The status tab showed the control plane's English problem_detail only. A known problem (keytab) is now explained in German with what to do (the server's "Keytab" button or by hand, then start); the exact detail stays below in a smaller line.
… start
The TLS socket is bound before uvicorn sees it, so a bind error (address
no longer on the host, port taken) or a key that does not load is logged
and reported in /v1/health ("tls": "failed: ...") instead of ending
the whole service. PUT /v1/secrets enforces its size limit while reading
the body (declared length and stream), not after buffering it.
- Refuse cross-site state-changing requests: Content-Type application/json and a same-origin Origin/Referer (aj has no CSRF protection). - A changed URL or fingerprint of a connection needs the token again. - Connection file: YAML errors and invalid entries are reported per entry in German, never block the valid ones; format version + migrate. - Jobs: runner via systemd-run outside the WebUI cgroup, SIGTERM and an overall time limit end a job cleanly, a dead runner is shown as aborted, start failures leave a failed job, one lock per host shared by setup and keytab, 409 busy names the running job, GET /jobs, prune logs and locks. - Setup: settle step (cloud-init, interrupted dpkg), long apt steps as transient units on the target polled over SSH, apt-get update retried, conffiles kept, an existing Docker left alone (--no-remove), .deb checked and installed from a root-only copy, preserve_hostname, preflight checks the bind address, tls step shows why it failed, SSH keepalive and timeouts, stdin of remote scripts is /dev/null, pre-release versions compared like setup.py does, allowlist 403 told apart from a bad token. - Keytab: an existing account is rotated (setpassword --random-password; previous key kept unless dropped), reused only if the plugin made it and it is not privileged; restarts one by one, health-gated; the job sets only fqdn on the current connection; removing a connection can disable the account.
…s; postinst checks the WebUI came back; postrm removes /run/lmn_squid
…ADR-018/020/021, threat model, install, keytab-and-dns, test strategy, changelog)
…qdn was cleared) An update merges the request over the stored connection, so a field the form does not send keeps its value; the form now also has and sends the FQDN. The page no longer shows the empty-list hint next to a load error. Findings of the lab test 2026-11-24: - precheck recognises a re-setup of the same connection and refuses the name of a connection to another host - aborted-job text no longer blames a WebUI restart - a dropped SSH session is explained in German with "start again" - a newer linuxmuster-squid on the VM stops the package step before apt; an apt downgrade refusal gets a German first line - dpkg progress noise removed from step output, Dpkg::Progress-Fancy=0 - connection file errors answer 409 (no WebUI 500 dialog) - status files of detached steps root-only (0700/0600), polled as root; status and staging dirs removed after every job unless a step still runs - a re-enabled service account (setpassword enables it) is reported
…ly service account - the FQDN must be the proxy of the chosen connection (A record on its address, equal to a stored fqdn) and pass the setup's rules (domain, PTR, no computer account, no foreign SPN); checked in the endpoint and again in the job, the dialog lists the reasons - before the rotation the control plane is asked (version with token, instances, GET /v1/secrets: 404 = control plane too old) - the keytab PUT is retried; a failure after the rotation says that the key changed and the button must be pressed again on the right connection - msDS-SupportedEncryptionTypes = 24 on new accounts and in the rotate modes of provision-keytab.sh (service tickets were RC4); a keytab without AES keys is not sent - setup removes upload/staging dirs of earlier, killed runs - provision_keytab_smoke: krb5.conf for kinit in the DC (case I was vacuous), case J (AES attribute, AES keys, AES service ticket) - docs: ADR-020, keytab-and-dns (klist -e check), install (keytab checks, downgrade below 7.3.10 needs the tls_* keys removed)
Ajenti's <dialog> renders a Bootstrap 3 .modal (position fixed, overflow hidden; it scrolls only while <body> has .modal-open, which the directive never sets), so a dialog taller than the window was cut off. Every dialog now carries the reusable class lmn-squid-dialog (resources/css/dialogs.css, built into all.css): the dialog is at most the window height, header and footer stay, the body scrolls. build_plugin concatenates .css resources; a static test checks every dialog uses the class and the header/body/footer structure.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
First of four stacked PRs for 7.3.11 (merge in order: webui-plugin, filter-categories, activity-log, edulution).
New binary package
linuxmuster-squid-webui: the "Squid proxy" page in the linuxmuster.net 7.3 WebUI (global administrators), plus what the control plane needs for it: optional TLS listener,GET /v1/status,GET /v1/schema, write-onlyPUT /v1/secrets/<name>, keytab checks (409 instead of an empty bind-mount directory), SSH setup of a new proxy VM and keytab rotation from the WebUI. Details: the 7.3.11 entries indebian/changelog.Tested: fast tier, install/upgrade smoke from v7.3.10 and file-tree check emulated locally, lab tests on lmn 7.3 and a cold verification.