M9 networkmanager, systemd-networkd: their READMEs
networkmanager's README says its two parts and their folder, how the watcher opens the page and finds the session without the bus, the events it keeps and the bundle publishes, and the uplink-names call; systemd-networkd's says it announces neither event and opens nothing. Builds: design 08 sign-in-page §24, §28
This commit is contained in:
@@ -0,0 +1,86 @@
|
||||
# networkmanager
|
||||
|
||||
The machine's network, managed by NetworkManager: this module holds the node seat `node-uplink` (novox/hq ADR 0241),
|
||||
answering its verbs `resolvers` and `links`, writes the machine's resolver file from the mesh's resolvers (ADR 0117,
|
||||
ADR 0223), and reacts when the network asks the person to sign in on its **sign-in page** (ADR 0687, ADR 0689; design
|
||||
08 sign-in-page §11 to §27).
|
||||
|
||||
## Two parts and the folder they share
|
||||
|
||||
Behind a sign-in page the private network's tunnel, and with it the bus, is out of reach, and the tool runner starts
|
||||
no bundle before it has reached the bus. So the reaction runs in two parts:
|
||||
|
||||
- **the watcher**, the process `networkmanager-sign-in` (`uplink-tools watch`), started by the machine's service
|
||||
manager at boot as the machine's account and kept running, needing no bus. It hears NetworkManager's rating of the
|
||||
network, opens the sign-in page, tells the person, and keeps the events.
|
||||
- **the bundle** `uplink-tools`, in the tool runner once it has reached the bus: it answers `resolvers` and `links`,
|
||||
serves the tools below, publishes the kept events and calls `uplink-names`.
|
||||
|
||||
They share only the module's own folder, `~/.local/state/mesh/networkmanager` (the account's, mode 0700), every file
|
||||
written whole (beside, then renamed over):
|
||||
|
||||
| file | what |
|
||||
|---|---|
|
||||
| `watch.sock` | the watcher's socket: one JSON line asked, one answered; `state` answers its state, `rating-again` makes it subscribe again and act on the rating read now |
|
||||
| `check-address` | NetworkManager's check address, written by the watcher at its start and at each change |
|
||||
| `pending/` | the kept events, one `<sequence>.json` each, written by the watcher and deleted by the bundle once the bus acknowledged it |
|
||||
| `names.json` | the bundle's last `uplink-names` call: the names, its result (`ok`, `no holder` or the failure) and when |
|
||||
| `sequence` | the next sequence of the watcher's message ids, never reset while the folder lives |
|
||||
|
||||
When the module leaves, the node-engine keeps the folder while it holds files, and nothing reads it then.
|
||||
|
||||
## The watcher opens the page on its own machine, without the bus
|
||||
|
||||
It hears NetworkManager's `PropertiesChanged` on the system bus for the rating (`Connectivity`), the active connection
|
||||
and the check (`ConnectivityCheckEnabled`, `ConnectivityCheckAvailable`, `ConnectivityCheckUri`); nothing runs on a
|
||||
timer, and the check itself stays NetworkManager's. When its system bus connection drops it subscribes again as the
|
||||
bus's socket comes back.
|
||||
|
||||
With the check on, it opens the check address in the person's default browser and shows a notification saying why at
|
||||
three moments: when the rating becomes PORTAL on the active connection, at its own start while the rating is PORTAL,
|
||||
and when the person's graphical session starts while it is. It acts once per ask: again only after the rating left
|
||||
PORTAL, a session's start and its own restart excepted. When the rating leaves PORTAL for FULL it says the network is
|
||||
open. An open that failed gives a critical notification naming the reason and the address.
|
||||
|
||||
It opens with `systemd-run --user --collect --quiet --wait -- xdg-open <address>`, the address one argument and never
|
||||
through a shell, after asking `xdg-mime query default x-scheme-handler/<scheme>` for the program: the browser runs
|
||||
under the person's user manager and outlives the watcher. An open still running after 10 s is said as opening.
|
||||
|
||||
**How it finds the person's session.** Over the system bus it asks logind for its account's sessions: the one of type
|
||||
`x11` or `wayland`, not remote, active or online. Its session bus is `<RuntimePath>/bus`, and its display is in the user
|
||||
manager's environment (`DISPLAY` and `XAUTHORITY`, which the X11 start block imports; `WAYLAND_DISPLAY` for a Wayland
|
||||
start block). No such session, or no display named there, is no session: then it opens and shows nothing, and still
|
||||
keeps the events. **How it hears a session start:** logind's `SessionNew`; for a graphical session of its account it
|
||||
reads the user manager's environment again at each file event in `/tmp/.X11-unix` (an X server's socket) and in the
|
||||
session's runtime directory (a Wayland socket), for at most 60 s, since the user manager says no change of its
|
||||
`Environment`; past that it writes that the start was not acted on.
|
||||
|
||||
## The events: kept by the watcher, published by the bundle
|
||||
|
||||
From NetworkManager's own rating the watcher keeps `node-uplink`'s two events, `sign-in-asked` (node, link, network,
|
||||
the address opened, when) and `sign-in-ended` (node, link, network, when, and why: `signed-in`, `left` or
|
||||
`no-longer-asked`), at most 256 of them, the oldest dropped past that with a journal line. With the check switched
|
||||
off (not enabled, or not available) it neither opens nor keeps anything. The bundle publishes them in order on the
|
||||
seat's subject `mesh.seat.node-uplink.event.<event>.<node>`, each under its own message id, awaiting the stream's
|
||||
acknowledgement, at its start, at each new kept event and when its bus connection comes back; a refused one waits for
|
||||
the next moment. Nothing in the mesh consumes them: they are its record, read with `nats.nats_stream_messages`
|
||||
filtered to `mesh.seat.node-uplink.event.*.<node>`, their time in `at`.
|
||||
|
||||
## The bundle gives the resolver the check's host name
|
||||
|
||||
Where a module holds `node-resolver` on this node (the assignments say which), the bundle calls its `uplink-names`
|
||||
with the check address's host name, so NetworkManager's own check resolves through the network it tests: at its start,
|
||||
when `check-address` changes, when its bus connection comes back, when the node-engine says that holder runs, and at
|
||||
the health look when the resolver no longer holds the names. With no holder it calls nothing, and that is no failure.
|
||||
|
||||
## Tools
|
||||
|
||||
| tool | what |
|
||||
|---|---|
|
||||
| `uplink_sign_in` | the reaction as it stands: the watcher's state, the events waiting and the publishes refused, the last `uplink-names` call, the resolver's refusal of the names |
|
||||
| `uplink_names_again` | call `uplink-names` now |
|
||||
| `uplink_rating_again` | make the watcher subscribe again and act on the rating now |
|
||||
| `uplink_publish_again` | publish the kept events now |
|
||||
| `uplink_health` | the watcher's health: unhealthy while its socket does not answer, while it is not subscribed, or while the last `uplink-names` call stands failed |
|
||||
|
||||
The watcher's health is judged only once the tool runner has reached the bus, since its health tool is the bundle's.
|
||||
@@ -0,0 +1,9 @@
|
||||
# systemd-networkd
|
||||
|
||||
The machine's network, managed by systemd-networkd: this module holds the node seat `node-uplink` (novox/hq ADR
|
||||
0241), answering its verbs `resolvers` and `links` from the same code as every holder of the seat, and writes the
|
||||
machine's resolver file from the mesh's resolvers (ADR 0117, ADR 0223).
|
||||
|
||||
**It announces neither of the seat's events and opens nothing** (ADR 0687 §1; design 08 sign-in-page §28).
|
||||
systemd-networkd cannot tell a network that asks the person to sign in on its sign-in page, so this holder says no
|
||||
`sign-in-asked` or `sign-in-ended`, which the seat's definition asks of no holder, and opens no page.
|
||||
Reference in New Issue
Block a user