Supervision, observations and optional notifications
This page describes the contract introduced in 0.5.0. Packages up to 0.4.11 do not implement it.
Required-VPN sessions additionally mandate the watchdog and enforce a fixed VPN-before-Tor path. Read VPN requirements, limits and recovery before selecting that mode; it has its own release qualification gate.
On AppArmor kernels, managed Tor also requires verified enforce-mode confinement. Read AppArmor requirements, observations and recovery for the separate local evidence shown by status and monitor and checked by the watchdog.
Select the capabilities you need
sudo ttp start --watchdog
sudo ttp start --watchdog --notifications
sudo ttp start --notifications --no-watchdog
The watchdog continuously checks local session integrity. Desktop notifications deliver events to the initiating user's graphical session. They are independent: without a watchdog, notifications cover explicit lifecycle and verification commands, but there is no continuous source of fault events. A terminal-only installation can use the watchdog without any desktop software.
A requested watchdog must become ready. Failure before network configuration
refuses startup; failure after configuration requests emergency containment.
The command reports an error even with --quiet. Notifications are optional:
their failure is reported, but never causes containment by itself.
For a direct root invocation, provide --notification-user USER, or set
user = USER under [notifications] in /etc/ttp/ttp.conf: that is the way
for ttp.service, which has no sudo user. The flag wins over the file. TTP
requires exactly one local graphical session belonging to that recipient, when
the session starts: a session started at boot, before the user logs in, runs
without notifications and says so; it does not
guess a desktop or broadcast to unrelated logged-in users. The recipient agent
runs without firewall capabilities and talks to the user's desktop notification
server. No network action is attached to a notification button.
Understand what has actually been observed
status collects observations without making an external IP request or changing
network policy. Its successful exit means the observation command completed,
not that the session is healthy. A recorded session, PID or cached active flag
does not prove that supervision is progressing.
Watch changes in a terminal
monitor refreshes the same passive evidence as status every five seconds by
default (allowed range: 2–60 seconds). It needs root and an interactive terminal.
The screen shows session phase, the age of the last Tor verification,
watchdog progress, emergency containment and its kernel verification,
notification delivery, active diagnostic reasons, and the existing
rejected-packet counter. A short timeline records changes observed while this
view is open; it has no earlier history and resets for a new session.
An observation failure replaces the current view with UNKNOWN. A Tor result is
historical, even if it says confirmed. A positive rejected-packet difference
since the preceding sample is not a leak count. Notification acceptance does
not prove the user saw a popup. monitor does not run an Internet check, test
DNS, or add firewall checks. Use check when you deliberately want a new Tor
verification; check-leak adds optional informational DNS observations.
Ctrl-C or SIGTERM closes only the monitor. For scripts or redirected output,
use sudo ttp status --json.
Local observations include session, boot and service-instance identity. Expired or invalidated observations are unknown. Tor verification is a measurement at a particular time, not a continuous guarantee. A failed DNS/TLS request, timeout or malformed response is inconclusive. A valid negative Tor result from a correctly non-exempt probe requests containment.
With a required watchdog, check also requests containment when supervision has
no current operational evidence. A live watchdog reports itself as evaluating
while it runs each periodic check and after each nftables or DNS-file event,
until it has re-evaluated. check waits for that evaluation to complete, for at
most twice watchdog.check_timeout plus watchdog.heartbeat_interval (25
seconds by default), rather than treating the in-progress state as absence.
Stopped, stale or foreign supervision evidence still requests containment at
once, and so does a watchdog still evaluating at the end of the wait. ttp
start applies the same rule to the watchdog's first healthy observation.
Emergency reporting distinguishes requested, application result and independent verification of the expected kernel rules. An application error never suffices to claim isolation. A restarted watchdog preserves the emergency latch.
Desktop delivery distinguishes pending, accepted, unconfirmed and failed. A notification identifier proves that the desktop server accepted the call; it does not prove display or human reading. Desktop policy can suppress a popup or ignore a non-expiring request. Closing the terminal does not create another alert channel: CLI output and the journal remain available for inspection, but do not guarantee that an unattended user will notice a fault.
Terminate an emergency deliberately
Close sensitive applications before running sudo ttp stop: removing protection
can allow them to reconnect outside Tor. Emergency mode remains latched until
explicit termination. ttp watchdog stop refuses to remove supervision that the
active session requires. A failure to deliver the final stop notification never
reinstates protection after explicit teardown.
Configuration and exit codes
Copy the documented configuration example
to /etc/ttp/ttp.conf if you need different timing budgets. The file must be
root-owned and not writable by group or others. Native packages also ship the
example under /usr/share/doc/; source installs retain it under /opt/ttp/assets/. Unknown options and inconsistent
deadlines are rejected before network changes. Effective settings are frozen for
the session; editing the file affects subsequent sessions. Explicit CLI flags
override the configuration, including --no-watchdog and --no-notifications.
| Code | Meaning |
|---|---|
| 0 | Requested command requirements satisfied |
| 1 | Configuration or operation error, including missing Tor or a missing transport |
| 2 | CLI usage error |
| 3 | Tor verification inconclusive |
| 4 | Explicit DNSSEC conflict before startup |
| 5 | Required watchdog unavailable |
| 6 | Valid negative Tor verification |
| 7 | Emergency rules verified |
| 8 | Required containment unconfirmed |
| 9 | Notification failure |
| 10 | Required VPN unavailable, or an operation that would weaken it refused |
Concurrent causes are retained. Session-result precedence is 8 > 7 > 6 > 10 > 5 > 1 > 9 > 3 > 0; for example, verified containment after watchdog failure returns 7 and
retains the watchdog cause. A returned command's exit status cannot change when
an asynchronous failure happens later. The
CLI reference says what each code means
for the network.
See ADR 0013 for timing defaults and the approved contract. The underlying mechanisms follow systemd readiness and watchdog semantics and the Desktop Notifications protocol.
Troubleshoot delivery separately from protection
Notifications need loginctl, busctl, a local graphical login and a notification
server implementing org.freedesktop.Notifications on that user's bus. A missing
recipient, ambiguous sessions, a missing server or a rejected/timed-out call is
reported with code 9 and a stable notifications.* reason. TTP does not install
a desktop on a terminal-only host. Use --no-notifications there, or inspect the
journal from your existing operational monitoring system.
check-leak now uses the same typed Tor check. Its optional DNS answers are
informational: a missing dig, a timeout or an answer containing a resolver IP
does not establish a leak. Successful HTTP verification covers that request,
not every application's traffic.
A requested watchdog that cannot start produces code 5 before network setup, or
code 7/8 after containment is attempted. All contributing reasons remain visible.
If session intent is lost or corrupt, explicit sudo ttp stop --restore-only
publishes restoration intent before stopping services, so the independent
termination handler cannot re-arm protection afterward.
Reproduce the service tests safely
The CI session-services job builds the Debian 13 fixture and runs
scripts/check-session-services.sh. On AppArmor hosts, this fixture uses an
unconfined AppArmor profile for systemd generator mount setup; seccomp and the
explicit capability set remain enabled. Its allocated console captures early
boot errors. It creates disposable Podman containers
with no external network, read-only source mounts and separate network
namespaces. The repository and host firewall/resolver are not modified.
The fixture needs NET_ADMIN and SYS_ADMIN inside the container for nftables,
DNS bind mounts and systemd sandbox setup. Do not run
tests/fixtures/session_services.py directly on a workstation.
The real-service cases cover readiness, SIGSTOP and SIGKILL, independent emergency application and kernel verification, restart latching, tamper repair, explicit stop, and an agent with the recipient UID and no capabilities. A private D-Bus server tests ordinary/critical expiry, replacement IDs, duplicate suppression, server disappearance and timeout after receipt. Its dummy Tor unit deliberately does not test Tor transport. The separate NSE and VM lifecycle suites retain that wider network-validation role.