Docs · Torii
The host agent
The agent is the part of Torii that runs on your machines. This page describes what the package contains, what installing it changes, what it watches, and how to take it off again.
What the package is
You normally get the package through the command in Add host; see Enrolling a host. Each package is built for one operating system and one processor:
| Operating system | Processors | How it installs |
|---|---|---|
| Debian and Ubuntu Linux | 64-bit Intel or AMD, and 64-bit ARM | A Debian package, handed to dpkg |
| macOS | Intel and Apple silicon | A signed installer package, handed to the macOS installer |
| Windows | — | No package exists |
A package contains:
- The upstream agent, unmodified. Torii does not patch, rebuild or re-sign it.
- Torii's installer and uninstaller,
install.shanduninstall.sh. - The list of sensitive files to watch, and the script that applies it to the agent's configuration.
- A version command,
torii-agent-version. - A written offer of source code,
SOURCE-OFFER.txt, and the full text of the GPL version 2. - A manifest,
MANIFEST.sha256, that lists the SHA-256 of every file in the package.
What installing does
The installer must run as root. On Linux it needs dpkg and stops with this package installs on Debian and Ubuntu only if it is missing. It does these things, in this order, and stops at the first one that fails:
- Checks every file in the package against
MANIFEST.sha256. A mismatch stops it withpackage integrity check FAILED — not installing. - Refuses a package marked not fit to hand to a customer, for example one built without its source archive or licence.
- Refuses to install over an agent that is already on the machine, whether or not Torii put it there. On Linux it names the command that removes the existing one.
- Installs the upstream agent package, unmodified.
- Applies Torii's list of sensitive files to the agent's configuration.
- Copies the version command, the written offer and the licence to
/opt/torii/agenton Linux or/Library/Torii/agenton macOS.
It ends by printing where those files are and The agent is installed but NOT enrolled. The installer never enrols the machine; in the console's command, the enrolment is the next line. It exits 0 when it installed, 1 when it refused or failed, and 2 when it could not run at all.
On macOS the installer also writes down every service, account and folder the install added, in /Library/Torii/agent/install-record, so that the uninstaller can remove exactly those. To see what it would do without changing anything, run it with --plan, which needs no root:
./<release>/install.sh --plan
What the agent watches
Torii adds a list of sensitive paths to the agent's file watching. A change to any of them is tagged as critical. For these paths the agent records what changed about the file, not the file's contents.
| Kind | Linux | macOS |
|---|---|---|
| Sign-in and permission settings | SSH server settings and host keys, PAM, sudoers, the user, password and group files, and the name-service switch. | SSH server settings and host keys, PAM, sudoers, local group membership, the authorisation database and authorisation plugins. |
| Signing and private keys | The system's private TLS keys, root's and every user's SSH folder, and GPG private keys. | The system trust bundle, root's and every user's SSH folder, and every user's GPG private keys. |
| Deployment credentials | AWS credentials, Kubernetes config, Docker config and netrc files, for root and every user. | AWS credentials, Kubernetes config, Docker config and netrc files, for every user. |
| Paths you mark critical | None are shipped. | None are shipped. |
The two systems watch differently
- Linux: 22 paths, watched as they change. The agent's own default folders stay in its list and are checked in a full scan every 12 hours. Who made a change is recorded only on hosts that run the Linux audit service.
- macOS: 15 paths, checked every 30 seconds, because the agent cannot watch files as they change on macOS. On a Mac this list replaces the agent's default folders. Who made a change is never recorded.
SSH known_hosts files are ignored on both, because they change whenever someone connects to a new server.
What reaches Torii today
Enrolling a host writes it into your organisation's host list with its name, operating system and an agent id that Torii generated. Nothing after that reaches Torii yet:
- The installer does not connect the agent to a Torii service, so file changes stay on the host.
- Torii does not read the agent's status, so the host shows Not reporting and its last seen time stays empty.
- Torii does not read which packages are installed on the host, so no host vulnerability appears and nothing on the host is correlated with your code.
Checking the version
The version command prints the exact version string of the package installed, and the path of its written offer. That string is what you quote if you ask for the agent's source code.
# Linux /opt/torii/agent/bin/torii-agent-version # macOS /Library/Torii/agent/bin/torii-agent-version
Data handling and licences explains how to get the source for that version.
Reinstalling
Because the installer refuses to install over an existing agent, a reinstall is an uninstall followed by a fresh install:
- Run
uninstall.shfrom the package folder, as below. - Generate a new enrolment token in Add host and run the new command, with the same
TORII_HOSTNAMEas before.
Enrolling under the same name updates the existing host in Torii rather than adding a second one, and the new agent id replaces the old one.
Uninstalling
Run the uninstaller as root from the folder the package was unpacked into; on Linux it reads the upstream package's name from the package files.
# from the folder the package was unpacked into sudo ./<release>/uninstall.sh
- Linux: purges the upstream package, configuration included, removes
/opt/torii/agent, and checks that the package is gone. If the agent's folder still holds files the package did not own, it says so and leaves them. - macOS: stops the services the install added, then removes exactly what the installer recorded, checking each folder before removing it.
Both end by saying that the written offer that came with the package stays valid for three years from when you received it; uninstalling does not withdraw it.