Repository navigation
Conversation
added 30 commits
November 25, 2026 11:29
…t is on squid sends one lmnactivity line per request (epoch second, user, domain, status, size, filter category; no URL, no client address) to a receiver in the container that writes finished files into the instance's spool. UDP and not squid's daemon: module, because squid ends itself when its log daemon dies (measured with squid 6.14, also with on-error=drop).
…ol mount lmnsquid-activity collect reads the finished spool files of every instance with the log on, sums them per user, domain and minute into one SQLite file per local day (tables per minute, per hour, per day and domain) and deletes them. The file name is stored in the same transaction, so a run that stops anywhere neither loses nor double-counts. Whole day files expire with the retention (1-365 days, default 7). The container gets the spool and ACTIVITY_LOG_ENABLED only while the log is on: other instances keep their spec, an upgrade replaces nothing. Queries with hard limits and a time budget; an audit log module.
GET/PUT /v1/instances/{name}/activity (switching on needs who confirmed the
privacy notice; recorded in the definition), DELETE .../activity/data, and
POST /v1/activity/{users,timeline,domains,search,export} restricted to the
users list the caller sends. Every query is written to the activity audit
log first (503 when it cannot be); GET /v1/activity/audit reads it. Deleting
an instance deletes its activity data.
…ata/users/timeline/domains/search/export/audit
…directories, purge The spool lives in /var/spool/linuxmuster-squid (its files belong to the containers' proxy user, and the configure resets the ownership of /var/lib/linuxmuster-squid); the day files in /var/lib/linuxmuster-squid/ activity (0700). The timer is enabled like the catalog timer and does nothing while no instance has the log on. Purge removes both.
csv's default \r\n made the WebUI keep each proxy's header when it merges exports from several proxies.
…dministrators A second view with its own permission lm:squid:activity (permissions.yml: globaladministrator, schooladministrator, teacher; the management stays global-admin only). The scope is computed on the server from the AD the way the official plugins read it (linuxmusterTools /users, /rawusers, /projects): teachers see only students of their own school in classes and projects they are a member or admin of (also through a project's member groups), never teachers; school administrators their school; other roles 403 also with the permission granted by hand. Only that users list goes to the proxies, which filter and audit with the person. Overview per class with active-now and blocked attempts, top domains, domain search, a heat map of the last 7 days per student with the minutes of an hour, live reload, CSV export for administrators, settings with the privacy notice and the audit log for global administrators. Proxies are asked in parallel; one that does not answer is named and does not block.
…ime and RSS, day file size, query times
…umbers, data protection), threat model T24-T26, test strategy, architecture, changelog
…lector logs only runs that stored something The health check every 30 s made a spool file and a journal line every 30 s on an idle instance; lines without a user were never stored anyway.
…ain, 403 and category in the spool, no URL or address, collected into a day file
…trictions; feat: day, blocked and drill-down queries Fixes from the lab test of 2026-11-25: - The spool is 1733 without a set-group-id bit (RestrictSUIDSGID=yes of the service refused 3733 with a 500); the receiver writes 0644 behind the 0750 parent. Checked under systemd-run with the unit's own restrictions. - Switching on or off writes the definition only after the container matches it; a failure leaves the instance unchanged and says why (code apply_failed). Switching on again applies a definition the running container lacks. Switching off removes the empty spool. - One HTTPS visit is one request: squid's NONE_NONE side lines (the SNI peek, the error page of a refused CONNECT) go with their CONNECT line and only mark it blocked when the SNI is in a category. - The collector unit has LogLevelMax=notice: idle runs leave no journal lines (systemd's own included); runs with work are notice. For the student-centred view: - POST /v1/activity/day: a user's active minutes and the domains with the minutes they were used in, from the primary key only, with a part of the day and a live delta (since_minute); POST /v1/activity/blocked; timeline per minute for one domain (drill-down). - GET /v1/activity?usage=false: the light overview with the oldest day, lesson hours (activity_lesson_hours) and the catalog's category labels. - Categories of allowed domains too (catalog and own lists) and a background flag (ads, telemetry) with hide_background for top domains. - ETag on day and timeline answers, 304 after the audit line. - Limit errors carry a code; queries over 1 s are logged without names. - The domain search over a partial day is one statement. - CLI: lmnsquid activity day, blocked, timeline --domain.
…ings and audit in the management - Menu: "Internetnutzung" (msgid "Internet use") under upstream's category Klassenzimmer (category:class, weight 30); the management stays under Software. Category and name are kept in one place (main.py). - /scope lists classes and projects with counts only; members per group on request (GET /group/<kind>/<name>/members), teachers of a class only for administrators and only on request (E3); a teacher never sees teachers. - GET /people?q=: up to 10 people of the scope by login or name, from the AD only (no proxy, no activity data). - POST /query/day (one student's day merged over the proxies, ETags passed through: unchanged answers are not sent again, the proxies audit every one), /query/blocked, /query/timeline with a domain (drill-down), /query/domains with hide_background, /query/users without the domain count by default. - Performance: the computed scope is cached 10 s, a project's member groups 300 s, every proxy's light overview 60 s (dropped on a settings change); never activity data. All proxies are asked in parallel from one pool with an overall deadline of 5 s (2 s connect, 5 s read); answers carry timing per proxy. - Failures are typed (unreachable, timeout, too_old, auth, tls, limit with the proxy's code and words, error) instead of "not reachable"; an export is refused as a whole when a proxy cannot deliver its part or truncated it (lab A2). - Every request of the view is written to the system log (tag lmn-squid-activity, authpriv), also refused ones and those that needed no proxy (lab A4). - E1: the activity settings and the proxies' audit log are endpoints of the management (global administrators): GET /<conn>/activity, PUT /<conn>/instances/<name>/activity, GET /<conn>/activity/audit (paged).
…s list, student page One route, the page in the query string (links open in a new tab, Back works): - Start: student search (typeahead from the AD, no proxy request) and tiles of the person's classes and projects; a teacher without classes is told where to join them; a global administrator chooses a school first. No "all users" query any more. - Class: members with last seen, requests and blocked attempts from one cheap list query (no domain count), teachers only on request for administrators (E3), live every 60 s while visible; blocked attempts, top domains (background services hidden) and "who was on …" in this class, each loaded when opened. - Student page instead of the dialog: date navigation down to the oldest stored day, whole day / school hours / this hour, key figures, the day as sessions (gaps up to 4 minutes) with blocked minutes in red, domains with active minutes and category names, a domain's minutes on click, the domains of one session, a 7-day heat map that fits 1366 px (an hour opens that day); live every 30 s as a delta of minutes, paused while the tab is hidden, ended after 15 minutes. - German numbers and times in the proxies' time zone (filters lmnNum and lmnTime), range buttons translated, one line for proxies that delivered nothing with the reason per proxy (lab A2, A3). - The settings and the audit log left this page (E1).
…ance, the instance as a page - Sections "Servers and instances", "Internet use: settings" and "Access log of the internet use" (E1: switching on with the privacy notice, retention, switching off with deletion; the proxies' audit log per server, 100 per page, kinds in words). A failed switch-on says that nothing changed (lab A1) instead of "500". - Toolbar in one row at 1366 px: filters, view, reload, filter per school and one "Add" menu (new instance, new VM, existing host). - One row template for both views: name (opens the instance), state with a direct "Create keytab" link when the keytab is missing, filter summary, internet use on/off with its retention, a Filter button and one actions menu (open, start/stop/restart, update/roll back, edit, delete); the server actions in one Server menu. - The instance is a page (?conn=&name=&tab=) instead of a dialog with seven tabs: Overview, Filter, Lists (blocklist, exceptions, without proxy login as pills), Logs (container, access), Internet use; reload and links keep it, Back leaves it; unsaved filter changes are not lost silently (asked before a tab change, closing or leaving). List changes apply at once. - German numbers and times in the settings (no raw UTC timestamps).
… lab fixes), operations, threat model, test strategy, changelog; load script measures the new queries The load script measures the day query, the drill-down, blocked attempts, the one-statement partial-day search and the same queries through the API including the audit line; --queries-only reuses generated data.
Teachers' WebUI workers run with the teacher's UID and cannot read the proxies' tokens (lab A7, 409); the worker's module-level thread pool did not survive aj's gevent fork (lab A6, 'operation on destroyed loop'). The view logic moves to activity_core.py, run by bridge.py (root, unix socket): the caller's identity comes from SO_PEERCRED, only root callers (administrators' workers) name the person, the scope is computed from the AD in the bridge, requests are size, time and rate limited. The WebUI endpoints only forward over the socket (cooperative under gevent) and map a missing bridge to 503. Proxies tagged for other schools are not asked and old control planes no longer fail an export (lab A8).
linuxmuster-squid-webui-activity.socket (0666, authorisation per request) starts the bridge service as root with systemd hardening. The maintainer scripts enable and start the socket on install, restart the service on upgrade, stop it on remove and drop its state on purge.
The core builds the sidebar in plugin load order and fails on a missing attachment point; with only 'core' as dependency aj loaded lmn_squid before lmn_common and the whole menu answered 500 (lab A5). Depend on lmn_common like every upstream lmn_* plugin, and attach to category:class only when lmn_common was imported first (Software otherwise).
The proxies' failure details were translated when the controller started, before the catalogue arrived, and stayed English. Translate at display time; German texts for a bridge that does not answer, the rate limit, an unreadable AD, a missing keytab and an unhealthy container.
webui_ajenti_it.sh loads the plugin into aj 2.2.16 with the real lmn_common and linuxmusterTools (lmn73), builds the sidebar for every role and calls the activity view in forked gevent workers demoted to the teacher's and the student's UIDs, through the bridge against a real control plane; then asks the bridge directly under those UIDs. Fails against the previous commit with the lab's A5, A6 and A7 errors. Part of the e2e tier.
webui_bridge_systemd.sh installs linuxmuster-squid-webui in a container with systemd as PID 1 and checks the socket, socket activation as root, SO_PEERCRED through the systemd-passed socket, reinstall, remove and purge.
A failing linuxmusterTools import (lab B1: 'net conf list' in the sandbox) escaped as a 500 with the exception class 'CalledProcessError', Ajenti added its English 'Server error' dialog, and the journal line of the failed request had no UID or identity. Any failure of the AD becomes a German 503 'directory', any unexpected error a German 502 'bridge'; class and traceback go to the journal only. Every request is logged with UID and identity, failed ones included. The worker maps any other 5xx of the bridge to 502. The activity page's helpers also tolerate undefined arguments.
samba's 'net conf list', run when linuxmusterTools is imported, lists the network interfaces over netlink; the unit refused AF_NETLINK and the bridge could not read the AD (lab B1). Allow it. Removing the package left the socket's enable symlink behind; replacing it by a build without the bridge left the socket listening (lab rollback). postrm remove/purge stop both units and drop their enable state; postrm upgrade starts a transient job that does the same once dpkg is done, if the new version has no socket unit. webui_bridge_systemd.sh imports the real linuxmusterTools with samba's net under exactly the unit's sandbox and checks remove, purge and the downgrade.
stateText(detail.inst) threw on every digest while no instance page was open; Ajenti turned each exception into a toast, the toast into the next digest: infdig, 'Angular bootstrap has failed' (lab B2). Every helper a template evaluates now answers on undefined arguments, and the school menu iterates a list kept with the groups instead of a new array per digest. A node check calls every helper the templates evaluate on the freshly started page of both controllers.
webui_ajenti_it.sh now runs the real ajenti-panel and drives headless Chromium through every page, tab and dialog of the plugin as global admin, school admin, teacher and student. Console errors, page errors, bootstrap failures, Ajenti's error dialog, 5xx and unexpected 4xx fail a step. Red against e77bf1e (the lab's B2).
added 15 commits
November 28, 2026 04:36
When every failing proxy refused the export for its answer size, the page said a proxy could not deliver its part; it is the same case as a merged CSV that is too large and now gets that message.
linuxmusterTools' YAML loader chmods every file it opens as root, also for reading: the WebUI's config.yml and any school's custom_fields.yml under /etc. ProtectSystem=full made /etc read-only and every AD read failed with EROFS (lab B3). Use ProtectSystem=true (/usr and /boot stay read-only); a list of writable paths would have to follow the loader's internals, and a single-file ReadWritePaths pins the inode so a config replaced by rename would stay stale. ADR-023 addendum 4. webui_bridge_systemd.sh now runs real requests through the installed unit against an OpenLDAP stand-in of the AD (LDAPS, sophomorix-like tree, a school with custom_fields.yml) and checks that a connection added by rename is used by the running bridge.
… failures The collector read a spool file whole and kept every parsed line: about 285 MiB for a 16-MiB file under the unit's MemoryMax=256M; a bigger file was OOM-killed in every run and stopped the collection of every instance (cold check M1). Files are now read line by line and stored in chunks of 20 000 lines, each chunk per day in one transaction with the ledger name <file>#<chunk>, so a run killed mid-file continues without counting twice. HTTPS side lines pair with their CONNECT line across chunks through a short time window; a partner stored with an earlier chunk is corrected in the current chunk's transaction. Peak RSS stays at 63-74 MiB from 16 to 200 MiB. Each file is attempted on its own (counted before it is read); a failing file stops neither the other files nor the other instances, and after three attempts it moves to the instance's quarantine folder with an error in the journal; usage reports the number. Removing the data removes the quarantine.
Browsers send at least one of them for the plugin's POST, PUT, PATCH and DELETE requests; a request with neither was accepted (cold check m4).
Ajenti answers every 403 with an English 'Security error' toast on top of the page's German message (cold check m1). The WebUI now answers a scope refusal of the bridge with 404, like a person that does not exist for the caller; aj's own permission refusals stay 403. The browser test fails on such a toast.
The management page shows spool files the collector quarantined (count per instance, German hint where they are and what to do). Whose data an access log line concerns is stored machine-readable and now shown in German (cold check m3). The catalog column of 'Filter per school' wraps instead of being cut off at 1366 px (m5).
…r poorer image Every package upgrade runs update-all onto DEFAULT_IMAGE. While that pin still names an older image (the log rotation build, without the filter and activity labels), the upgrade moved the instances onto it and turned the category filter and the activity log off without a word (cold recheck N1). update-all now inspects the target image first and keeps an instance on its image when the target is older, has an older capability label, or lacks the category filter (categories or SafeSearch in use) or the activity log (on) the instance uses. The result says why, the audit log warns, lmnsquid update-all exits 1 and the postinst shows the reason in the apt output. An explicit 'lmnsquid update NAME IMAGE' still applies. RELEASE.md: the pin comes before the tag.
…ool repair; quarantine beside the spool Switching the activity log on creates the spool, replaces the container (~10 s) and only then writes 'on'. A collector run in between took the definition's 'off' and removed the fresh spool; Docker then created the mount source as root, squid could not write, every collector run and every update failed (cold recheck N2). The control plane now holds the collector's lock while it switches the log (waits up to 120 s for a busy run, else 409 busy). Start, restart, update and reconcile repair a missing spool or one that is not the control plane's (removed or put aside, created again, a running container restarted so its mount sees it). The overview reports spool_ok and last_data. The quarantine moves beside the spools (<spool>/.quarantine/<instance>/, same filesystem): an atomic rename that also works for a file the collector cannot read, and leaves no copy behind; a failed move keeps the attempt counter (N3). A file stored completely is never a failed attempt, even when it cannot be removed (N4).
… hints; filter overview actions in view The page took only a 403 as 'not in your classes'; since the WebUI answers such a refusal with 404 it showed two toasts and an empty student page (cold recheck m1). It now recognises the error 'scope'. The browser test opens a person outside the scope for every role and requires the inline message without a toast. update-all results name instances kept on their image (N1). An instance with the log on shows 'An, aber keine Daten seit ...' or a missing spool (N2); the quarantine hint names its new place (N3). The action column of 'Filter per school' stays in view when the table scrolls sideways (m5), checked by the browser test with a long server name.
…the spool (ADR-023 addendum 6)
Kevin 2026-11-26 (scope 'own classes' = a + b): a teacher's scope holds the classes they are a member or admin of and no projects, also when they are in one: no project tile, a project's members answer like any group outside the scope (404 scope), and a student reached only through a project is outside the scope (day, timeline, search, users). School and global administrators keep their view with projects; every access stays audited. ADR-023 addendum 7, operations, test strategy, threat model, README and the changelog line follow.
WEBUI_BASE/WEBUI_PASSWORD and the lab's names (connection, class, student, domain, other student) as environment; IT_TEACHER=0 when no test teacher is in a class; IT_ALLOW_409=1 accepts the 409 too_old of connections to proxies with an older control plane. Defaults unchanged: the in-core run is the same.
…ojects Cold check m1: _members compared the group name against a user's classes and projects together, so a project whose cn equals a teacher's class would have added its members to that class. A class now matches schoolclasses only; a project matches its cn against projects and its member and admin groups against both. The new test is red before the change.
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.
Third of four stacked PRs for 7.3.11, based on
feat/filter-categories.Activity log per instance (off by default, privacy notice, retention 1-365 days, audit log) and the WebUI page "Internetnutzung" for teachers (own classes only, no projects), school and global administrators, served through the socket-activated root service
linuxmuster-squid-webui-activitythat computes the scope from the AD. update-all never moves an instance onto an older image or one without the features it uses. Also fixeswebui_deb_smoke.shfor the new permissions.Tested: fast tier, install/upgrade smoke emulated locally, lab tests with a real AD project and a cold verification. The DEFAULT_IMAGE pin follows in its own PR after this merges.