DocsAgent SetupAgent Installation (Linux)

Agent Installation (Linux)

Install or upgrade the AsPeekIt agent on Linux (systemd) and macOS (launchd) with the install.sh script served by the platform, optionally with the container image scan.


Requirements

The platform serves the agent binaries, their SHA256SUMS and the installers at https://<platform host>/agent/. The same command installs and upgrades.

  • Linux with systemd (the installer refuses other init systems), amd64, arm64 or arm (armv6/armv7); macOS amd64 or arm64 (launchd).
  • Root (the script is run through sudo) and curl.
  • Outbound HTTPS from the host to the platform (and to the agents mTLS host when the platform has one, see Automatic Agent mTLS).
  • A zone key (idpk_...) of the discovery zone the host belongs to: Agents page (Discovery section) > Zone keys on the zone.

Install or Upgrade

Open the Agents page, click "Install agent" on the zone and copy the command of the Linux or macOS tab. On a first install the script asks for the zone key on the terminal (hidden input), so the key never appears in the process list or in the shell history.

# Interactive install or upgrade
curl -fsSL https://idp.example.com/agent/install.sh | sudo bash

# Unattended (scripts, Ansible): key from the environment
export IDP_API_KEY=idpk_YOUR_ZONE_KEY; curl -fsSL https://idp.example.com/agent/install.sh | sudo -E bash

# With options
curl -fsSL https://idp.example.com/agent/install.sh | sudo bash -s -- --agent-id web-01 --name "Web 01"
Agents with status, version and mTLS certificate

Installer Options

Options go after bash -s --. Without --key on a host that is already installed, the script upgrades and keeps the current configuration.

  • --key KEY: the zone API key (must start with idpk_). Visible in ps while installing: prefer the prompt or IDP_API_KEY. On an upgrade it replaces the configured key.
  • --agent-id ID: unique agent id (default: the short host name). First install only.
  • --name NAME: display name (default: the agent id). First install only.
  • --url URL: platform URL (default: the server the script was downloaded from; also IDP_URL).
  • --force: reinstall even if the same version is already installed and running.
  • --image-scan: opt-in container image scan; installs the Trivy client shipped with the agent (see below).
  • --no-image-scan: removes the Trivy client and switches the image scan off.
  • -h / --help: prints the options.

What the Installer Does

The script downloads the binary for the host platform from <url>/agent/, verifies it against SHA256SUMS and then:

  • First install: writes /etc/idp-agent/agent.yaml with agent_id, agent_name, backend_url, the key, collection_interval_seconds: 300 and certificate_collection enabled (every other setting keeps its default; see Agent Configuration). Upgrade: keeps the existing agent.yaml and replaces only the key or URL when given.
  • Skips everything when the same version is already running (unless --force, a new key, a new URL or an image scan change).
  • Linux: creates the system user idp-agent, installs /usr/local/bin/idp-agent (it refuses directories not owned by root or writable by others), the config as 0640 root:idp-agent and the systemd unit idp-agent; when Docker is installed it adds the drop-in docker.conf with SupplementaryGroups=docker for container collection.
  • macOS: installs /opt/idp-agent/bin/idp-agent (a root-only directory), the config as 0600 root and the launchd daemon com.idp.agent; logs go to /var/log/idp-agent/agent.log.
  • Runs a dry-run collection (-once -dry-run, nothing sent), (re)starts the service and waits up to 180 seconds for "Data sent successfully" in the log. If an upgrade fails, the previous binary, configuration and image scan files are restored and the service restarted.

Warning: Membership of the docker group is equivalent to root on that host. Without Docker the drop-in is not created and containers are not collected.

The systemd Service

On Linux the agent runs as the unprivileged idp-agent user with only two capabilities: CAP_DAC_READ_SEARCH (read root-only files, e.g. for file integrity monitoring and certificates) and CAP_SYS_PTRACE (read /proc/<pid>/exe and fd of every process, to map processes to their network connections). StateDirectory=idp-agent gives it /var/lib/idp-agent (0700) for the API key file, the mTLS files and the FIM baseline.

Note: With this hardened unit (non-root user, ProtectSystem, ProtectHome and PrivateTmp, which give the service its own mount namespace) the agent reports applications without a version. Application version detection requires running the agent as root in the host mount namespace, i.e. without ProtectSystem, ProtectHome, ReadOnlyPaths, PrivateTmp or any other directive that creates a private mount namespace. See Agent Configuration > Application Version Detection.

[Service]
User=idp-agent
Group=idp-agent
ExecStart=/usr/local/bin/idp-agent -config /etc/idp-agent/agent.yaml
Restart=on-failure
RestartSec=30
AmbientCapabilities=CAP_DAC_READ_SEARCH CAP_SYS_PTRACE
CapabilityBoundingSet=CAP_DAC_READ_SEARCH CAP_SYS_PTRACE
NoNewPrivileges=true
StateDirectory=idp-agent
StateDirectoryMode=0700
ProtectSystem=strict
ProtectHome=read-only
PrivateTmp=true

Container Image Scan (opt-in)

The image scan finds the vulnerabilities inside the images of the running containers with Trivy. It is off by default and installed only where it is asked for, on Linux amd64/arm64 hosts with Docker (the installer refuses otherwise).

  • The trivy binary comes from the same release as the agent (trivy-linux-<arch> in SHA256SUMS) and is installed outside PATH, in /usr/local/lib/idp-agent/trivy: a Trivy the host already has is not touched.
  • The settings live in /etc/idp-agent/image-scan.env (0640 root:idp-agent, holds the token): IDP_IMAGE_SCAN=true, IDP_TRIVY_PATH, IDP_TRIVY_SERVER_URL (the platform URL) and IDP_TRIVY_TOKEN, loaded by the drop-in idp-agent.service.d/image-scan.conf. agent.yaml is not edited.
  • Trivy runs in client mode against the platform's trivy-server: the host downloads no vulnerability database. Scans run in the background at nice 19 with one CPU, at most once per image every 24 hours (features.image_scan_* in Agent Configuration).
  • Upgrades keep the image scan and update trivy together with the agent; --no-image-scan removes trivy, the settings file and the drop-in.

Note: See Container Image Scanning (/docs/security/image-scanning) for how the results become findings.

export IDP_TRIVY_TOKEN=...   # TRIVY_SERVER_TOKEN of the platform (or typed at the prompt)
curl -fsSL https://idp.example.com/agent/install.sh | sudo -E bash -s -- --image-scan

# Switch it off again
curl -fsSL https://idp.example.com/agent/install.sh | sudo bash -s -- --no-image-scan

Verify the Agent

The installer itself waits for the first successful report. Afterwards the agent appears on its zone in the Agents page with status online, its version, the Auth mode (zone key or dedicated key) and its certificate state.

# Linux
sudo systemctl status idp-agent
sudo journalctl -u idp-agent -f

# macOS
sudo tail -f /var/log/idp-agent/agent.log

# Typical lines
# [main] AsPeekIt Agent 1.6.0 started
# [main] Collection complete in 2.1s
# [main] Data sent successfully

Registering a New Agent ID

An agent installed with a zone key registers itself in that zone the first time it reports with an agent_id the platform does not know, only while AGENT_ALLOW_ENV_KEY_ENROLLMENT=true on the backend. With the default (false) the platform answers 401 "Auto-registration with environment keys is disabled; enroll the agent with an enrollment token": use an enrollment token instead (Agent Enrollment & mTLS), setting enrollment_token in agent.yaml. Agents already registered keep authenticating with the zone key until they get their own key with their first certificate (Automatic Agent mTLS).

Uninstall

Remove the service, the files and the user:

Note: Air-gapped hosts: build the binaries with make cross-build in agent/, serve build/, SHA256SUMS and the installers from any HTTP server and pass --url (or IDP_URL), or copy the binary and write agent.yaml by hand from agent/configs/agent.yaml.example.

# Linux
sudo systemctl disable --now idp-agent
sudo rm -rf /usr/local/bin/idp-agent /usr/local/lib/idp-agent /etc/idp-agent /etc/systemd/system/idp-agent.service*
sudo userdel idp-agent

# macOS
sudo launchctl bootout system/com.idp.agent
sudo rm -rf /Library/LaunchDaemons/com.idp.agent.plist /opt/idp-agent /etc/idp-agent /var/log/idp-agent

Kernel and Reboot Data

With system collection enabled (features.system_collection), the kernel collector runs after the package collector and adds to the system section of every report the running kernel, the installed kernel packages and whether the host waits for a reboot. The Security pages use them to tell the hosts whose kernel must be updated from the ones that only need a reboot (see Finding Filters & KEV Alerts, Kernel Panel). Every field is optional: older agents keep working.

  • system.kernel.running: content of /proc/sys/kernel/osrelease (the uname -r release), or the kernel version of the system collector when the file cannot be read
  • system.kernel.installed: kernel image packages of the inventory (deb linux-image-<version>, also linux-image-unsigned-; rpm kernel, kernel-core, kernel-uek, kernel-uek-core; apk linux-lts, linux-virt, linux-edge, linux-rpi, linux-rpi4, linux-stable), at most 64
  • system.reboot_required on dpkg hosts: true when /var/run/reboot-required exists; system.reboot_required_pkgs lists the lines of /var/run/reboot-required.pkgs (at most 200)
  • system.reboot_required on other hosts: needs-restarting -r (dnf-utils/yum-utils) when it is in the PATH, run with a 30 s timeout: exit 0 means false, exit 1 true; any other outcome (timeout included) leaves the field out
  • Coverage scopes: system:kernel and system:reboot (collector kernel), ok, partial, failed or skipped with the cause (e.g. skipped when no reboot detection method is available); both are skipped when system collection is disabled