LordOS — a free, fast and secure GNU/Linux distribution based on Debian, with its own desktop environment: display server and Wayland compositor in C, a React UI engine on QuickJS, and private native apps.
C cdebiandesktop-environmentebpffirewalllandlocklinuxlinux-distributionopen-sourceprivacyquickjsraspberry-pi-5reactsecuritywaylandwayland-compositor
Docs: Monitor → Network second generation, components in their own scopes, system services, blocklists, deny mode; roadmap, changelog, VM-SETUP step 41 and screenshots
Federico Pereirac9284b1d984b
diff --git a/docs/ARCHITECTURE.md b/docs/ARCHITECTURE.mdindex e7af8af..ce88a8c 100644--- a/docs/ARCHITECTURE.md+++ b/docs/ARCHITECTURE.md@@ -57,6 +57,7 @@ like React Native but on top of our display server.| `server/src/vault/`, `js_vault.c`, `sdk/vault.js`, `apps/passwords` | **M9** | Passwords and the system keyring: the sandboxed helper `lord-vault` (Monocypher: XChaCha20-Poly1305, Argon2id), own `.lvault` format, FIDO2/CTAP2 client, session keyring opened at login, Secret Service on D-Bus with own code (see `PASSWORDS.md`) || `server/src/net/netd.c`, `remote/netsup.c` | **M9** | `lord-netd`: the network belongs to the system. A root service started and supervised by `lord-sessiond` at boot, serving the `net-*` actions for every session (see `NETWORK.md`) || `server/src/disk/`, `js_disk.c`, `sdk/disks.js`, `apps/disks` | **M9** | Disks: listing without root (sysfs, udev database, mountinfo), our own SMART reader (ATA PASS-THROUGH over SG_IO, NVMe health log), closed `disk-*` actions, bootable USB verified with SHA-256 (see `SYSTEM.md`) |+| `server/src/fw/fwlists.c`, `fwsub.c`, `server/src/fetch/`, `server/src/sec/netconn.c`, `apps/monitor/NetTree.jsx`, `Blocklists.jsx`, `sdk/netmodel.js`, `sdk/netstatus.jsx` | **0.8.4** | Monitor → Network, second generation: blocklists (the sandboxed downloader `lord-fetch`, compiled into lord-netperm's maps), the deny mode, LordOS's components in their own scopes (the `--net-connector` processes), the system services' traffic, the tree, chips and view menu, the menu bar network item (see `MONITOR.md`, `FIREWALL.md`) || `server/src/mail/`, `js_mail.c`, `sdk/{mail,calendar,contacts}.js`, `apps/{mail,calendar,contacts,reminders}` | **M9** | Mail, Calendar, Contacts and Reminders: the sandboxed helper `lord-maild` (IMAP with IDLE/CONDSTORE, SMTP, CalDAV/CardDAV, OpenSSL) with no sockets of its own — `lord-server` connects only to configured servers and hands it the fd; own MIME, HTML sanitizer, iCalendar, vCard and XML parsers (see `MAIL.md`) || `server/src/backup/`, `js_backup.c`, `sdk/backup.js`, `apps/backup` | **M9** | Backups: hard-link snapshots in a lord-server thread (nice 19, idle I/O), hourly/daily/weekly retention, optional encryption with the vendored Monocypher; no root and no `admin.c` actions (see `SYSTEM.md`) || `server/src/logs/`, `js_logs.c`, `sdk/logs.js`, `apps/logs` | **M9** | Logs: our own systemd journal reader (no libsystemd), LordOS logs, system logs for admins through a closed action, live follow with inotify (see `SYSTEM.md`) |@@ -86,7 +87,7 @@ Besides the kernel and libc, only these are allowed:| QuickJS | ES2023 JavaScript engine, ~1 MB, written in C | vendored|| `stb_truetype`, `stb_image` | fonts and images; public domain, a single header | vendored|| `stb_image_write` | PNG and JPEG for the remote desktop (`lord-sessiond` only); public domain | vendored|-| OpenSSL (`libssl`, `libcrypto`) | TLS. **Only two binaries link it**: `lord-sessiond` (remote desktop on the LAN, `REMOTE.md`) and `lord-maild` (IMAP/SMTP/CalDAV/CardDAV, certificates checked against the system CA store, `MAIL.md`). Never `lord-server` | system |+| OpenSSL (`libssl`, `libcrypto`) | TLS. **Only three binaries link it**: `lord-sessiond` (remote desktop on the LAN, `REMOTE.md`), `lord-maild` (IMAP/SMTP/CalDAV/CardDAV, certificates checked against the system CA store, `MAIL.md`) and (0.8.4) `lord-fetch` (the blocklist downloads, sandboxed, no sockets of its own, `FIREWALL.md` "Blocklists"). Never `lord-server` | system || `libcrypt` | verifying passwords against `/etc/shadow` (`lord-sessiond`, `admin.c`) | system || FFmpeg (`libavcodec`, `libavformat`, `libavutil`, `libswscale`, `libswresample`) and `libva` (+ `libva-drm`) | Decoding and encoding video, audio and images; VA-API for hardware decoding (M9, approved by the user). **Only `lord-media` links them**, the sandboxed helper; the player, synchronization and interface are our own. Never `lord-server` (`MEDIA.md`) | system || Poppler (`libpoppler-glib`) and libarchive | PDF and archives (M9, approved by the user). **Only `lord-doc` links them**, the sandboxed helper; Poppler brings cairo, FreeType and fontconfig, which `lord-doc` also uses for font samples and for building PDFs. Never `lord-server` (`DOCUMENTS.md`) | system |@@ -146,6 +147,18 @@ Since M8 there are two programs, and since M9 two helpers:of the accounts file (or, after *Load Images*, to public addresses for remote images) and passesthe connected fd. Its only writable folder is its cache. See `MAIL.md`.+- **`lord-fetch`** (0.8.4): the blocklist downloader. Same rules as `lord-maild` (fixed path, no+ arguments, minimal environment, `sandbox_apply_helper` after loading the CA bundle, no sockets of+ its own); it lives for one download job, gets each list's already-connected socket, speaks TLS+ and one HTTP GET with a size limit, parses the list strictly and returns normalized lines in a+ sealed memfd. See `FIREWALL.md`, "Blocklists".++- **The components' connectors** (0.8.4): `lord-server --net-connector mail|print|lists`, the same+ binary re-executed with a fixed argv (like the terminal holders), each in its own+ `lordos-net-<name>.scope`, only creating and connecting sockets for lord-server so the kernel+ counts and decides them as that component (`sec/netconn.h`, `FIREWALL.md`, "LordOS components in+ their own scopes").+`lord-server` can still run on its own, with its own DRM and evdev, for development.Data shipped with LordOS for the Monitor (`MONITOR.md`): `assets/monitor/geoip-country.mmdb.xz`diff --git a/docs/FIREWALL.md b/docs/FIREWALL.mdindex 90be780..3e1bccc 100644--- a/docs/FIREWALL.md+++ b/docs/FIREWALL.md@@ -11,6 +11,7 @@ access" permission on Android and other systems. It is built in steps:| 4 | Settings: "Trusted apps" and "Restricted apps" | **done**: lists and mode (silent / off) || 4b | Settings: network rules by app (domains, addresses, networks) | **done** (VM 122), see [Rules by app](#rules-by-app-settings-and-monitor) || 5 | "Ask" mode | planned (see "The ask mode") |+| 0.8.4 | Blocklists, the deny mode, LordOS's components and the system services as their own apps | **done** (VM 118), see [Blocklists](#blocklists-084), [components](#lordos-components-in-their-own-scopes-084) |Step 1 is C code only, with no daemon and without touching the kernel or the network (step 2,below, is the service that enforces it):@@ -388,6 +389,11 @@ instant); `GetConnectionCredentials` with a process fd would remove that race an| `lan` / `internet` | lower than any network || `any` | the lowest |+ (0.8.4) **2b. A subscribed blocklist** (`FwQuery.listed`): when the destination is on one of the+ user's blocklists, it is denied unless the winning rule names the destination (an exact or+ wildcard domain, an address or a network): a list beats `lan`, `internet` and `any` rules, never+ a rule the owner wrote for that destination. Trusted apps are not exempt. See "Blocklists".+Ties are broken in this order:1. the smallest port range (a concrete port beats "any");2. a concrete protocol beats "any";@@ -965,8 +971,16 @@ in the kernel. Before, it was the standalone `curl`, which can't be filtered.|---|---|| silent (default) | whatever has no rule is allowed, and each new connection is counted and reported to the Monitor (`record`) || off | only explicit denials and restrictions apply; the rest is allowed without recording |+| deny (0.8.4, "Deny silently") | whatever no rule allows is denied and recorded; loopback (127/8, `::1`) stays allowed, so the resolver's stub and local services keep working; trusted apps keep the network; the essential system services are not apps and are never affected || ask | for now, the same as silent |+The deny mode is `FW_MODE_DENY` in `fw/rules.c` and `NP_M_DENY` in `np_decide` (the last step: a+rule, a restriction or a list decides first); with it every app's packet filter decides, so a+connection that was open when the mode changed is cut ("Existing connections are cut"). It is offered+in Settings → Privacy → App network and in the menu bar item. Tested: `fw-rules-test` (loopback,+`::1`, a mapped `127.0.0.1`, a rule that allows, a trusted app, the file round trip) and the random+comparison of `npcompile-test`, which now draws the deny mode too.+### The ask mode (next step)A `connect` hook can't wait for the owner, and holding the connection in user space (like@@ -1080,6 +1094,78 @@ programs:- Script: `bench-monred-118.sh` in the scratchpad (veth `npb0`/`npb1`, namespace `npb`, bothremoved afterwards); `iperf3` was installed on VM 118 for this (`VM-SETUP.md`).+### LordOS components in their own scopes (0.8.4)++Built-in parts that use the network used to run inside lord-server, so their traffic was+"LordOS" and a rule could only take all of them at once. Since 0.8.4 each one has its own process in+its own scope, `lordos-net-<name>.scope`, which lord-netperm reads as the firewall app+`lordos:<name>` (`fw_component_scope`, a fixed list: `mail`, `store`, `print`, `terminal`,+`lists`). The kernel attributes a socket to the cgroup of the process that *created* it, so:++- **Connectors** (`server/src/sec/netconn.c`): for Mail (lord-maild's servers: Mail, Calendar,+ Contacts, Reminders), printers and scanners (IPP and eSCL over TCP, the mDNS socket) and the+ blocklist downloads, lord-server starts `lord-server --net-connector <name>`: the **same binary**+ re-executed (like the terminal holders), fixed argv, `LANG` and `LORDOS_SESSIOND` only, the channel+ on fd 3 and every other descriptor closed. It asks lord-sessiond to place it in its scope, waits a+ quarter of a second so lord-netperm sees the new scope, and then only answers fixed-size requests:+ family (IPv4/IPv6), type (stream/datagram), and an address and port to `connect()` to+ (non-blocking; lord-server waits for the result). It returns the socket over SCM_RIGHTS and+ lord-server checks it is the kind it asked for. It takes no names or paths, runs nothing, has+ `no_new_privs`, is not dumpable and has 64 file descriptors; it only does what lord-server could+ do itself, as the same user. **Fail closed:** in a LordOS session a connector that can't enter its+ scope exits and the request fails (the traffic would otherwise be lord-server's and decided by+ its rules). Outside a session (development, the tests) the socket is made in place, as before.+- **Store and updates:** the package engine's download child (the root admin helper's fork that+ drops to `nobody`) moves itself into `lordos-net-store.scope` before dropping root+ (`cgroup_enter_root`: only from its session's `server` leaf, only itself, a root-owned scope;+ lord-sessiond's placement service only places session users).+- **Terminal:** the shell of each terminal (`term/pty.c`) enters `lordos-net-terminal.scope` before+ exec, so every program started there is "Terminal" (the Monitor lists them by name). Best effort:+ a terminal that can't be placed still opens.+- **The network service:** lord-sessiond starts lord-netd in `lordos.service/netd`, its own leaf+ (`cgroup_service_leaf`), so its traffic (DHCP, the VPN daemons) can be counted apart from+ lord-sessiond's.++Because these are ordinary firewall apps, every rule, restriction and switch works on them (Settings+→ Privacy lists them, restrictions are the network ones). The Monitor shows the VPN tunnels from+their interfaces' counters and never offers a switch for them.++**What was tested on VM 118:** a program in the Terminal and the Store's download each had their own+row with their own bytes; blocking the Store (after its warning) made a download in its scope fail+with `denied out tcp 151.101.66.132:80 (rule)`; `netconn-test` checks the requests on both sides,+the sockets, the real connector process (the test binary re-executed) and that a connector that+can't enter its scope refuses. Mail and the printers use the same connector as the blocklists,+which were tested live; Mail against a real server and a network printer were not (VM 118 has+neither).++### The essential system services (0.8.4)++Name resolution, time and the network service are shown but can never be blocked: they are not in+any app's scope, so no rule reaches them. The accounting programs alone (`cgroup/skb_ingress`,+`skb_egress`) are also attached to `system.slice/systemd-resolved.service` and+`systemd-timesyncd.service` (lord-netd's leaf is already under `lordos.service`), and `np_sysc`+gets an entry for each, keyed by its cgroup id; a packet that isn't an app's is looked up there by+its socket's cgroup (`bpf_skb_cgroup_id`) and only counted, never filtered. COUNTS carries them as+`system:dns`, `system:time` and `system:network` for every user. lord-netd's DHCP client uses a+raw socket for discovery, which the cgroup programs don't see: only its unicast renewals count.++### Measurements, 0.8.4 (VM 118)++`iperf3` through a veth pair into a private namespace (eth0 untouched), the client in an app scope,+system CPU in % of one core over 15 s, 0.8.3's lord-netperm and this one interleaved twice:++| | 0.8.3 | 0.8.4 |+|---|---|---|+| UDP 1 Gbit/s, 1200 B datagrams (104,000 packets/s), sending | 104, 109, 107, 102 % | 112, 117, 112, 110 % |+| the same, receiving | 105, 101, 104, 98 % | 116, 116, 110, 114 % |+| TCP (~22 Gbit/s) | 166, 163 % | 172, 168 % |++About 0.6 µs more per packet at this extreme rate (the per-port flow key and the bound-port lookup+on every packet): a video over QUIC at a few thousand packets per second costs well under 0.5 % of a+core. Blocklists add nothing per packet: with four lists (399,396 entries) on and off, the same+bench gave 105–115 % and 109–111 %, within run-to-run noise. A build without the per-port parsing+gave the same numbers as this one, so the difference is not the port parsing itself.+### Known limits- **App scopes are root's now** (was: "Scopes belong to the user"). `lord-sessiond` creates the@@ -1130,6 +1216,105 @@ programs:- "LAN only" from Settings: no internet, the gateway yes. +## Blocklists (0.8.4)++A curated catalog of public lists by topic (advertising, trackers, malware and attacks), domain-+and address-based, that the owner turns on in Settings → Privacy → Blocklists, plus custom lists by+https address. Lists are downloaded daily over HTTPS by an unprivileged, sandboxed helper, parsed+strictly, checked again by lord-server, compiled into one file and enforced by lord-netperm in the+existing per-app maps. They never override a rule the owner wrote for a destination.++```+assets/fw/blocklists.json the catalog: id, topic, url, format, licence, source, date checked+server/src/fw/fwlists.{c,h} raw parsers, the set (hashes), the compiled file's reader+server/src/fw/fwsub.{c,h} lord-server: subscriptions, the download job, compiling+server/src/fetch/fetch.c lord-fetch, the downloader (OpenSSL), fetchproto.h its protocol+server/src/ui/js_fw.c lord.fw.lists / setList / addList / removeList / updateLists / listMatch+apps/monitor/Blocklists.jsx Settings → Privacy → Blocklists+tests/fwlists_test.c, fwsub_test.c+```++### The catalog and its licences++Each list was added only after its licence was checked (the list file's own header and its+project's licence file, 2026-10-19), and the catalog records what was found; LordOS ships no list+data, each machine downloads what its owner turns on.++| List | Topic | Format | Source | Licence |+|---|---|---|---|---|+| Advertising (domains) | ads | domains | The Block List Project | MIT (list file), Unlicense (repository) |+| Advertising and malware (unified hosts) | ads | hosts | Unified hosts (Steven Black) | MIT |+| Trackers and analytics | trackers | domains | The Block List Project | MIT, Unlicense |+| Phishing sites, Scam sites, Ransomware, Hidden crypto mining | malware | domains | The Block List Project | MIT, Unlicense |+| Attacking addresses | malware | addresses | IPsum, level 3 | Unlicense |++Left out: a malware URL feed whose terms are fair use without a stated licence; a botnet controller+address list (CC0) that was empty when checked; The Block List Project's malware list (2.6 million+entries, over the size limit); lists under non-commercial licences.++### Downloading: lord-fetch++- **Who connects:** lord-server resolves the list's host and connects through the blocklists'+ connector, so the socket is `lordos:lists`'s (its own row and rules). Only `https://` addresses+ (`fws_split_url`: a host name with a dot, an optional port, a printable path; no user info, no+ addresses in brackets).+- **lord-fetch** (`server/src/fetch/fetch.c`): posix_spawned by the job thread from lord-server's+ folder (root's or the user's, not writable by others), no arguments, `LANG` only, the channel+ (lord-doc's framing) on fd 3. It loads the CA bundle and then calls `sandbox_apply_helper` (scope+ `lordos-fetch.scope`, 256 MB; no socket, connect, bind or exec; no files). For each list it gets the+ connected socket and `{host, path, format, sub}`; it speaks TLS 1.2 or later with the certificate+ checked against the system CA store and the host name (mail/net.c, never relaxed), sends one+ HTTP/1.1 GET with `Accept-Encoding: identity`, and reads at most 16 MB with deadlines+ (mail/http.c). A redirect comes back to lord-server, which follows at most three, https only.+- **Strict parsing, in the helper** (`fwl_parse_raw`): a NUL byte, a line over 1024 bytes or a body+ over 16 MB reject the list; comments (`#`, `!`, `;`, `//`, inline ` #`) are dropped; a hosts file+ only maps names to `0.0.0.0`, `127.0.0.1`, `::` or `::1`; a domain list has one name per line+ (`*.name` and `||name^` mean the name and its subdomains); an address list has an address or a+ CIDR network first on the line (other columns ignored; host bits must be 0). Skipped and counted:+ localhost names, names without a dot, LAN networks (it would cut the machine off its own network)+ and networks broader than /8 or /16. More than 10 % unparsable lines (over 20) reject the list as+ the wrong format. At most 300,000 names or 100,000 networks per list (the rest is cut and said).+ What comes back is normalized lines (`d name`, `s name`, `n cidr`), each once, in a sealed memfd.+- **lord-server checks it again** (every line with the same validator) before keeping a copy in+ `~/.cache/lordos/fwlists/<id>.txt` with its state (`<id>.json`: when, how many, the last error).+- **Daily:** `sdk/netstatus.jsx` asks once an hour (`lord.fw.updateLists`); lord-server downloads+ only the enabled lists whose copy is more than 20 hours old, and a list that failed is tried again+ after an hour. Turning a list on downloads it at once if there's no copy.++### Compiling and enforcing++- **One file:** the job thread writes every enabled list's lines into `~/.config/lordos/fwlists.txt`+ (header `lordos-fwlists 1`, at most 32 MB) and keeps a set of hashes for the Monitor's "on the list+ …" (`lord.fw.listMatch`); when the job ends lord-server sends the usual RELOAD. The three files+ are on `lord.fs`'s deny list.+- **lord-netperm** reads `fwlists.txt` with the same fixed-path, no-links, user-owned, size-limited+ reader as `firewall.json`, and any invalid line keeps the previous set. Names are kept as 64-bit+ hashes (keyed per process) in sorted arrays, about 10 bytes a name: 380,000 names and 19,000+ networks take 13.8 MB of lord-netperm's memory.+- **In the kernel:** each user with lists gets a set in `np_blk4`/`np_blk6` (LPM tries keyed by+ set and address), and each of their apps carries it (`NpApp.blk`). The set holds the lists'+ networks and, from the system resolver's answers, the addresses of listed names; an address is+ only added when **every** name the resolver gave for it is listed, so an address a tracker shares+ with a site that isn't listed (a shared CDN) stays allowed. A DNS answer updates its addresses at+ once, before the app connects; every 30 s the whole set is recomputed (what the resolver forgot+ goes); learned addresses are capped at 16,384 per user. `np_decide` checks the set after the+ rules naming the destination and before `lan`/`internet`/`any`.+- **No per-packet cost:** lists don't make the packet filter decide for every app: `connect()` and+ `sendmsg()` deny, and after each change that adds entries a sweep cuts the sockets already open+ to them (as for rules).++**What lists can't see:** the same as domain rules ("What domain rules can't see"): an app with its+own encrypted DNS is only checked by address.++**Tested:** `fwlists-test` (hosts, domains and address formats, every rejection rule, the set and its+lookups, CNAME-style shared addresses, the file reader, 20,000 mutated lists; also under ASan and+UBSan) and `fwsub-test` (URL parsing, the catalog and config, compiling seeded copies, custom lists,+and lord-fetch refusing bad requests and a peer without TLS, without network). On VM 118: two lists+downloaded over HTTPS (8,527 names and 19,405 networks), then all four; `curl` from the Terminal to+a listed domain and to a listed address failed with `denied out tcp … (list)`; switching that+domain's row on in the Monitor wrote `{"app":"lordos:terminal","dst":"nationalityship.com","action":"allow"}`+and the next connection went through; switching it off removed the rule.+## Rules by app (Settings and Monitor)The rules the store always supported (`lord.fw.addRule`: domains, wildcards, addresses, networks,diff --git a/docs/MONITOR.md b/docs/MONITOR.mdindex 86684ea..363d5e6 100644--- a/docs/MONITOR.md+++ b/docs/MONITOR.md@@ -30,6 +30,10 @@ itself.### Network+Since 0.8.4 the left column is a tree with a view menu, search chips and rows for LordOS's own+parts and the system's services: see "Network, second generation (0.8.4)" below. What follows is+the rest of the tab, and the first generation of the list.+- **Left:** search (by app, address or country) and one row per app with its icon, number ofconnections, a traffic bar (received in green, sent in orange, relative to the app that movedthe most), a tiny live activity indicator (its traffic over the last 12 s, one bar per second),@@ -107,6 +111,132 @@ server, and this app's rule is that no address leaves the machine.**"This computer"** is placed by the time zone (`/etc/localtime` → coordinates from`/usr/share/zoneinfo/zone1970.tab`), without the network.+### Network, second generation (0.8.4)++++**Rows for LordOS's own parts.** Everything built in that uses the network is a row of its own,+backed by its own process and cgroup scope, so its rules are enforced by the kernel like any app's+(`FIREWALL.md`, "LordOS components in their own scopes"):++| Row | Firewall id | Its traffic |+|---|---|---|+| Mail and calendars | `lordos:mail` | lord-maild's servers (Mail, Calendar, Contacts, Reminders sync), made by Mail's connector |+| Store and updates | `lordos:store` | the package engine's downloads (the Store, Settings → General, the daily update check) |+| Printers and scanners | `lordos:print` | IPP and eSCL to network printers and scanners, and their mDNS discovery |+| Terminal | `lordos:terminal` | the shell of every terminal and every program it starts; the detail lists the programs by name |+| Blocklist updates | `lordos:lists` | the daily blocklist downloads (`lord-fetch`) |+| VPN | `lordos:vpn` | the counters of LordOS's own VPN interfaces (Settings → Network); not blockable |+| Name resolution (DNS) | `system:dns` | systemd-resolved; shown, never blockable |+| Time synchronization | `system:time` | systemd-timesyncd; shown, never blockable |+| Network service | `system:network` | lord-netd's own leaf (DHCP, Wi-Fi, the VPN daemons); shown, never blockable |++Apps that never touch the network (Calculator, Notes…) never appear: a row exists only for traffic.+The essential system rows show "System" instead of a connection count and a dash instead of a switch.+Blocking the Store asks first, because no security update arrives while it is blocked:++++The **"LordOS" row** is now what is left in lord-server itself, close to zero; every socket a+component's connector made counts as that component's, also in the open-connections list (the+socket's cgroup, `INET_DIAG_CGROUP_ID`, mapped to the session's scopes: conn.c `cgApp`).++++**The tree.** Each app opens into its destinations (the name the system resolver gave, or the+address), a name with several addresses opens into them, and each address into its ports (TCP 443,+UDP 443…). Every row has its received and sent bytes, a tiny up/down meter of its current rate+(log scale), and, for a destination, its own allow/deny switch with a hint when something else+decides it (another rule, the app's default, a restriction, the deny mode or a blocklist: "Blocked+by the list Scam sites"). Long lists fold after eight rows ("N more…"). For an address reached+through a CNAME chain the row shows the shortest name (usually the one the app asked for) and+searches every name of the chain. The per-port bytes come from lord-netperm (np_flows is per+address and port since 0.8.4; COUNTS sends each address's eight busiest ports).++**The view menu** (one pop-up button at the top of the column) holds the whole view, kept per user in+`settings.monitor.netView`:++- group by: apps, domains, addresses, ports or countries (the tree's levels follow: a domain opens+ into its apps and their ports, a port into its apps and their destinations…);+- direction: all, outgoing, incoming; protocol: all, TCP, UDP and QUIC; status: everything,+ allowed, denied, with rules;+- sort by: name, most traffic, least traffic, most recent, most connections;+- "Show network activity in the menu bar" and "Blocklists…" (Settings → Privacy).++ ++**Search with chips.** Typing `app:firefox`, `domain:example.com`, `ip:10.0.0.0/8`, `port:443`,+`proto:udp` (or `quic`) or `country:AR` and a space turns the token into a chip; Enter turns every+word (an address or network becomes an IP chip, a number a port, `tcp`/`udp` a protocol, two+capital letters a country, a name with a dot a domain, anything else an app). Chips of different+kinds combine (app *and* domain), two of the same kind are alternatives; the rest of the text+matches anywhere. Backspace in an empty field removes the last chip. There is no city chip: there+is no city-level IP database with a compatible licence (see "Map").++++**The time range.** The traffic chart's zoom (1 h, 24 h, 7 d, 30 d, with ‹ ›) now also drives the+list: in a history window it shows each app's bytes in that window, from the history file. The+history never keeps destinations (see "Traffic history", Privacy), so in a window the rows have no+children; the live view keeps the tree.++The pure part (tokens, filters, grouping, sorting, the saved view) is `sdk/netmodel.js`, tested by+`server/tests/netmodel_test.mjs`; the tab is `apps/monitor/Network.jsx` and `apps/monitor/NetTree.jsx`.++### The menu bar network item (0.8.4)++Optional and off by default (Settings → Privacy → Monitor → "Network activity in the menu bar", or+the view menu). It shows the upload and download rates in the status area, rounded ("↑5K ↓231K",+"0" under 1 KB/s), updated every other second and only redrawn when the rounded value changes.+Its panel:++- the sent (up) and received (down) graph of the last five minutes, 60 bars of 5 s, and their totals;+- the apps moving data now, with their rates;+- **Recently denied** in the last ten minutes, with a count, the same destination grouped (×N);+- the firewall mode: Allow silently, Deny silently, Off (`FIREWALL.md`, "The modes"). The ask mode+ is not offered until it exists; rule profiles come with the rules manager (0.8.5);+- the blocklists (lists on, entries) and "Open Monitor…".++While the item is shown it reads `lord.monitor.netTotals()` (one read of `/proc/net/dev`) once+per second, without the Monitor's sampling thread; lord-netperm's notices are read only while the+panel is open. Hidden, it costs nothing. `sdk/netstatus.jsx`.++ ++### Blocklists (0.8.4)++Settings → Privacy → Blocklists (`apps/monitor/Blocklists.jsx`): the curated catalog by topic, each+list with its source, its licence, how many entries it had and when it was downloaded; a checkbox+turns it on, "Update Now" downloads again, and your own lists take an https address and a format.+How they are downloaded, checked and enforced is in `FIREWALL.md`, "Blocklists". The Monitor shows+the lists in its summary, "On the list …" under a destination, and "by a blocklist" in Recently+denied.++++ ++### Measurements (0.8.4, VM 118, 4 vCPU Xeon Silver 4108, kernel 6.12)++Same session, same test traffic (curl in an app scope: a 120 KB/s download and HTTPS requests every+4 s), main's build (0.8.3 + 0.8.4 so far) against this one, 30 s each, lord-server's CPU in % of+one core:++| | main | this build |+|---|---|---|+| Monitor open on Network, traffic | 17.1 / 16.1 % | 14.8 / 14.0 % (the tree, chips, system rows; 4 blocklists on) |+| desktop idle, menu bar item off | 2.65 % (the VM's previous install) | 2.93 % (4 blocklists on) |+| desktop idle, menu bar item on | — | 2.95 % |+| desktop with traffic, item on / its panel open | — | 0.97 % / 3.87 % |++Memory with 4 lists (379,991 names, 19,405 networks): lord-netperm 13.8 MB (2.9 MB without lists),+lord-server 142 MB with the Monitor open (131 MB on main). The per-packet cost is in `FIREWALL.md`+("Measurements, 0.8.4").++**Before** (main, no lists: the scam site connects) **and after:**++ +### Remote desktop (0.8.3)While the remote desktop is on (Settings → Sharing), it is one more row in the app list, **Remote@@ -389,7 +519,8 @@ bottom of the tab (`settings.monitor.diskAlerts`):## Architecture```-apps/monitor/ index.jsx (tabs), Network.jsx (Network), MapView.jsx (map), Chart.jsx,+apps/monitor/ index.jsx (tabs), Network.jsx (Network), NetTree.jsx (0.8.4: the tree, chips and+ view menu), Blocklists.jsx (0.8.4: Settings → Privacy → Blocklists), MapView.jsx (map), Chart.jsx,TrafficChart.jsx (mirrored sent/received chart), History.jsx (zoom andhistory windows), draw.js (pixels),icons.jsx, Privacy.jsx, countries.js (generated)@@ -397,6 +528,8 @@ apps/monitor/Processes.jsx the Processes tab, its context menu, the stop sheetapps/monitor/DisksTab.jsx the Disks tab: rates, temperature and health per disk, the chosen disk's cardssdk/smart.js, sdk/smartparse.js SMART summaries and smartctl's JSON → one model (Disks app too)sdk/diskwatch.js notices when a disk gets too hot or less healthy+sdk/netmodel.js (0.8.4) search tokens, filters, the tree, sorting and the component rows (pure)+sdk/netstatus.jsx (0.8.4) the menu bar network item and the blocklists' hourly update checksdk/monitor.js useMonitor(), stores monitorSamples / monitorProcesses / monitorConnections /monitorDetail; monitor.watchProcess(), monitor.stopProcess()server/src/ui/js_monitor.c lord.monitor (read-only, validated API)@@ -436,6 +569,7 @@ Each disk in `sample().disk.disks` carries the same fields (`sensor`: `"nvme"`,`null`; `temp` in °C or `null`; `tempT`: when it was read; `tempIdle`: a spinning disk at rest, notread; `awake`: I/O in the last minute).| `history({ from, step, n, app })` | the traffic history in `n` buckets (see "Traffic history"), or `null` |+| `netTotals()` | (0.8.4) `{ t, rx, tx }`: the machine's byte counters now (every interface but `lo`), without the sampling thread (the menu bar item) || `historyEnable(on)` / `historyClear()` | the "Keep a traffic history" setting; deletes the history |No function takes paths or commands: the only arguments are booleans, a language code (letters,@@ -486,6 +620,9 @@ listening one) or `out`. Scope: `internet`, `lan` (private, CGNAT, link-local, U**From process to app** (`js_monitor.c`, on the screen thread with the list from `apps.c`):+0. (0.8.4) a socket made in one of the session's scopes is that scope's app (`cgApp`, from the+ socket's cgroup id; conn.c reads the session's scope ids every 5 s): Mail's connector, the+ Terminal's programs, an app's own sockets;1. `lord-server` itself is **LordOS** (native apps and the Store run inside it);2. otherwise, the `.desktop` whose `Exec` program (`DesktopApp.bin`) matches the executable,`argv[0]` or the process name;diff --git a/docs/NETWORK.md b/docs/NETWORK.mdindex 5c179fa..c15ba6f 100644--- a/docs/NETWORK.md+++ b/docs/NETWORK.md@@ -35,6 +35,11 @@ lord-server --user ana ── lord-admin ──┘ net-* actions are forwarded- **What it is.** `lord-netd` is `admin.c` built with `LORD_NETD` (`server/src/net/netd.c` only has`main`). Its table has **only** the `net-*` actions, with the same validation, and it runsnothing those actions didn't already run. libc only.+- **Its own cgroup leaf** (0.8.4): before its execve, the child moves itself into the root-owned+ `lordos.service/netd` leaf (`cgroup_service_leaf`), next to lord-sessiond's `supervisor` leaf, so+ Monitor → Network can count the network service's own traffic ("Network service", never+ blockable; `FIREWALL.md`, "The essential system services"). A lord-netd adopted from before the+ update stays where it was until it restarts.- **When it starts.** `lord-sessiond` starts it at boot, before the greeter(`server/src/remote/netsup.c`):- fixed path `<lord-sessiond's directory>/lord-netd`, root-owned and not writable by othersdiff --git a/docs/ROADMAP.md b/docs/ROADMAP.mdindex f804dbb..9ff72cb 100644--- a/docs/ROADMAP.md+++ b/docs/ROADMAP.md@@ -508,7 +508,10 @@ Details in `MAIL.md`. Tested on VM 123 against local Dovecot, Postfix and Radica## Before 1.0-- [ ] **Monitor → Network, second generation (0.8.4)** — our own design; same function as the+- [x] **Monitor → Network, second generation (0.8.4)** — done 2026-10-19 on VM 118, see+ `MONITOR.md` ("Network, second generation", "The menu bar network item", "Blocklists") and+ `FIREWALL.md` ("LordOS components in their own scopes", "The essential system services",+ "Blocklists", "The modes"). Our own design; same function as thebest per-app firewalls, no copied look or names.- **Native apps as their own rows:** every built-in component that uses the network gets a rowwith its name and icon, backed by its own process and cgroup so rules are enforced by the@@ -540,6 +543,14 @@ Details in `MAIL.md`. Tested on VM 123 against local Dovecot, Postfix and Radicaformat limits, parsed strictly, compiled into the existing domain/IP rule maps; custom listURLs allowed. Lists never override a user's explicit allow rule.- Performance budget measured as in 0.8.3 (no visible cost with thousands of list entries).+ - **Done as described, except:** no city chip and no grouping by city (no city-level IP database+ with a compatible licence); a history window lists apps only (the history never keeps+ destinations); the switches are on destinations, not on single ports; the menu bar item offers+ allow silently / deny silently / off (the ask mode doesn't exist yet) and no rule profiles+ (0.8.5); "Recently denied" counts the last ten minutes.+ - [ ] Test Mail's and the printers' connectors against a real mail server and a network printer+ (the same connector was tested live with the blocklists); a laptop's real DHCP and VPN rows.+ - [ ] The per-packet cost of the per-port accounting (+0.6 µs at 104,000 packets/s): find it.- [ ] **Firewall rules manager (0.8.5)** — a "Rules" section in the Monitor (our own design):- **Sidebar:** All rules, Active, Denied, Recently modified, Recently used, Temporary, Unapproveddiff --git a/docs/VM-SETUP.md b/docs/VM-SETUP.mdindex aea3b4d..d1f657c 100644--- a/docs/VM-SETUP.md+++ b/docs/VM-SETUP.md@@ -1371,3 +1371,42 @@ in `~/LordOS-csd`, built there (`make -C server`, `make -C server build/deco-cli`master_preferences` and `settings.json` restored, the themes, the schemas package, `session.conf`,the profiles, the tree, the script and the backup removed, `lordos.service` restarted to the loginscreen. No network or Proxmox setting was touched.++## Step 41 — 0.8.4: Monitor → Network, second generation (VM 118 `lordos-notes`, October 19)++See `MONITOR.md` ("Network, second generation", "The menu bar network item", "Blocklists") and+`FIREWALL.md` ("LordOS components in their own scopes", "The essential system services",+"Blocklists"). On VM 118 (172.17.0.53), tree in `~/LordOS-netmon` (copied over SSH with `tar`: the+VM has no rsync), built there (`make -C server`, `make -C server test`, `sudo build/npverify-test`)+and installed over `/usr/local/lib/lordos` (`lord-server`, `lord-netperm`, the new `lord-fetch`,+themes and assets) by `~/deploy-netmon-118.sh`, which first saved `/usr/local/lib/lordos` in+`/var/backups/lordos-netmon-bak` and `~/.config/lordos` in `~/.config-lordos-backup-netmon`.+`lord-sessiond` was not replaced (lord-netd isn't installed on this VM, so the network service row+was not tested here). Nothing was installed with apt.++- **Unit drop-in:** `/etc/systemd/system/lord-netperm.service.d/netmon084.conf` with+ `RestrictAddressFamilies=AF_UNIX AF_PACKET AF_NETLINK` (this VM's unit predates 0.8.3's sock_diag);+ removed at the end.+- **Session:** the autologin session of `lord` (`/run/lordos/autologin-done` removed, the session's+ lord-server ended, `lordos` restarted), English, dark and then light for the screenshots, the menu+ bar item on (all in `settings.json`, restored at the end).+- **Test traffic:** `curl` started from SSH inside `lordos-net-terminal.scope` (as a Terminal program)+ and, for the A/B measurements, inside `app-lordos-npbench.scope`: HTTPS requests to public sites+ every 4 s, two rate-limited downloads from Debian mirrors, and attempts to a listed scam domain+ (denied by the list; while the lists were off for the A/B runs, a few requests to it went through).+ `nc -z` to a listed domain checked that the owner's allow rule wins. The Store's "Check for+ updates" for the Store's own row.+- **Blocklists:** four catalog lists and one custom list downloaded over HTTPS from their sources;+ copies in `~/.cache/lordos/fwlists`, removed at the end with `fwlists.json` and `fwlists.txt`.+- **Measurements:** `iperf3` (already on this VM since step 28) through a veth pair `npb0`/`npb1`+ into a private namespace `npb` (10.213.7.0/30), deleted after each run; eth0 and the network+ configuration were not touched. For the A/B runs the 0.8.3 `lord-netperm` and main's build+ (built in `~/LordOS-netmon-base`) were swapped in for a few minutes and the new build put back.+- **Input and screenshots:** `lord-qmp-input.py 118 2987 1067` and `lord-type.py 118` from the+ Proxmox host, `screendump` converted to PNG on the development machine.+- **Undone at the end:** `/usr/local/lib/lordos` restored from the backup (`diff -r` empty), the+ drop-in removed and `lord-netperm` restarted with the old binary, `~/.config/lordos` restored+ (`diff -r` against the backup empty), the blocklist files and the test scopes removed, the trees,+ scripts and backups deleted, `lordos` restarted to the login screen. The traffic history+ (`~/.local/state/lordos/net-history.bin`) keeps the test minutes (app ids and byte counts only).+ No Proxmox setting was touched.diff --git a/docs/menubar-network-deny.png b/docs/menubar-network-deny.pngnew file mode 100644index 0000000..4ad7930Binary files /dev/null and b/docs/menubar-network-deny.png differdiff --git a/docs/menubar-network-panel.png b/docs/menubar-network-panel.pngnew file mode 100644index 0000000..aae8281Binary files /dev/null and b/docs/menubar-network-panel.png differdiff --git a/docs/monitor-net2-before.png b/docs/monitor-net2-before.pngnew file mode 100644index 0000000..082f5e6Binary files /dev/null and b/docs/monitor-net2-before.png differdiff --git a/docs/monitor-net2-chips.png b/docs/monitor-net2-chips.pngnew file mode 100644index 0000000..eb5bf48Binary files /dev/null and b/docs/monitor-net2-chips.png differdiff --git a/docs/monitor-net2-components.png b/docs/monitor-net2-components.pngnew file mode 100644index 0000000..ba2e255Binary files /dev/null and b/docs/monitor-net2-components.png differdiff --git a/docs/monitor-net2-ports.png b/docs/monitor-net2-ports.pngnew file mode 100644index 0000000..cb33c44Binary files /dev/null and b/docs/monitor-net2-ports.png differdiff --git a/docs/monitor-net2-store-warning.png b/docs/monitor-net2-store-warning.pngnew file mode 100644index 0000000..533d5d6Binary files /dev/null and b/docs/monitor-net2-store-warning.png differdiff --git a/docs/monitor-net2-tree-light.png b/docs/monitor-net2-tree-light.pngnew file mode 100644index 0000000..2d37955Binary files /dev/null and b/docs/monitor-net2-tree-light.png differdiff --git a/docs/monitor-net2-tree.png b/docs/monitor-net2-tree.pngnew file mode 100644index 0000000..ace0bb4Binary files /dev/null and b/docs/monitor-net2-tree.png differdiff --git a/docs/monitor-net2-view-menu.png b/docs/monitor-net2-view-menu.pngnew file mode 100644index 0000000..48e2745Binary files /dev/null and b/docs/monitor-net2-view-menu.png differdiff --git a/docs/settings-blocklists-custom.png b/docs/settings-blocklists-custom.pngnew file mode 100644index 0000000..f5c1884Binary files /dev/null and b/docs/settings-blocklists-custom.png differdiff --git a/docs/settings-blocklists-malware.png b/docs/settings-blocklists-malware.pngnew file mode 100644index 0000000..121bde0Binary files /dev/null and b/docs/settings-blocklists-malware.png differdiff --git a/docs/settings-blocklists.png b/docs/settings-blocklists.pngnew file mode 100644index 0000000..b005b15Binary files /dev/null and b/docs/settings-blocklists.png differ