installer
installer
¶
Install the clearance hub + verdict helper systemd user units.
The clearance flow splits across two units:
terok-clearance-hub.service— varlink server, subscriber fan-out, authz binding. Hardened (NNP + seccomp + mount-ns isolation).terok-clearance-verdict.service— stateless helper, execsterok-shield allow|deny. Unhardened (podman setns requires it).
Both run the same terok-clearance-hub launcher with different
subcommands (serve vs serve-verdict), so install_service
takes one bin_path and writes both units.
Legacy migration: earlier releases shipped one monolithic
terok-dbus.service. On first post-split install the legacy unit
is disabled + unlinked before the new pair goes down, so operators
don't end up running two hubs against the same socket.
HUB_UNIT_NAME = 'terok-clearance-hub.service'
module-attribute
¶
VERDICT_UNIT_NAME = 'terok-clearance-verdict.service'
module-attribute
¶
NOTIFIER_UNIT_NAME = 'terok-clearance-notifier.service'
module-attribute
¶
UNIT_NAME = HUB_UNIT_NAME
module-attribute
¶
install_service(bin_path=None)
¶
Render + write both unit files into the user systemd directory.
Also disables + unlinks any leftover pre-split terok-dbus.service
so the operator ends up with exactly the new pair running. Calls
systemctl --user daemon-reload once at the end.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
bin_path
|
Path | list[str] | None
|
|
None
|
Returns:
| Type | Description |
|---|---|
Path
|
|
Path
|
unit files. |
Source code in src/terok_clearance/runtime/installer.py
uninstall_service()
¶
Disable + unlink both new units + any pre-split legacy leftover.
Symmetric teardown for install_service — terok uninstall
calls this instead of rolling its own systemctl + unlink sequence.
Daemon-reloads once at the end so systemd's in-memory registry
drops the now-missing units. All individual steps soft-fail so a
half-installed tree still ends up clean.
Source code in src/terok_clearance/runtime/installer.py
install_notifier_service(bin_path=None)
¶
Render + write the notifier unit into the user systemd directory.
Paired with install_service: headless hosts that installed
the hub + verdict pair can opt into the desktop notifier later by
calling only this function. Daemon-reloads once at the end.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
bin_path
|
Path | list[str] | None
|
|
None
|
Returns:
| Type | Description |
|---|---|
Path
|
The on-disk path of the written unit file. |
Source code in src/terok_clearance/runtime/installer.py
uninstall_notifier_service()
¶
Disable + unlink the notifier unit; daemon-reload once.
Symmetric teardown for install_notifier_service. Soft-fail
on every step so a half-installed tree still ends up clean.
Source code in src/terok_clearance/runtime/installer.py
read_installed_unit()
¶
Return the hub unit's file contents, or None if absent.
Kept for backwards compatibility with out-of-tree callers that
grew used to the pre-split single-unit API — reads the hub unit
(the one that was formerly terok-dbus.service).
Source code in src/terok_clearance/runtime/installer.py
read_installed_unit_version()
¶
Return the hub unit's # terok-clearance-hub-version: stamp, or None.
None is either "unit not installed" or "unit installed without
a marker" (the pre-split legacy unit) — check_units_outdated
differentiates between those in its operator-facing message.
Source code in src/terok_clearance/runtime/installer.py
check_units_outdated()
¶
Return a one-line drift warning if any installed unit is stale, else None.
Checks hub + verdict together (they're installed as a pair by
install_service) plus the notifier independently (headless
hosts may install it later, or not at all). None is returned
when neither pair nor notifier is installed (headless host, or
no setup command has run yet); a one-sided hub/verdict pair is
reported as stale so the operator is prompted to restore it. A
legacy terok-dbus.service on disk counts as "stale" so the
operator is prompted to rerun setup and get the split pair.