# Security for providers

> What the Legion agent runs on your machine, what rentals can reach, what Legion collects about the host, and the limits you should know before you list it.

Source: https://legion.ambient.xyz/docs/providing/security

Renters run their own containers on your machine, as root inside the container, with your GPUs. This page says what Legion does to limit what they can reach, what it does not do, and what is left to you.

## In short

- Rentals are Docker containers with a reduced set of privileges, their own network, and resource limits. They are not virtual machines: they share your machine's Linux kernel.
- Rentals can't open connections to your machine or to private address ranges, so your home or office network behind a private range is out of reach.
- Rentals reach the public internet through your connection, from your public IP address, unless you require the allow-list.
- You open no inbound ports. Renters reach rentals through Legion's private network.
- The agent runs as root, narrowed by systemd. It installs and updates only releases signed by Legion.

## Can a renter reach my home or office network?

Not through a private address. The agent programs its own firewall rules on the machine for every rental:

- **Your machine itself:** a rental can't open a connection to the machine, only answer one the machine opened.
- **Private and special ranges:** `10.0.0.0/8`, `172.16.0.0/12`, `192.168.0.0/16`, `100.64.0.0/10`, loopback, link-local and cloud metadata (`169.254.0.0/16`), multicast and the documentation and benchmark ranges are always dropped.
- **IPv6:** rentals have none. Every IPv6 packet from a rental is dropped.
- **Other rentals:** each rental has its own network, and rentals can't reach each other.

What isn't blocked by default:

- **Public addresses.** If your office or another of your networks uses public IPv4 addresses, add them under [Blocked ranges](https://legion.ambient.xyz/docs/providing/host-network#blocked-ranges).
- **The public internet.** Rentals reach it through your connection. To limit new rentals to Legion's allow-list instead, turn on [Require the allow-list](https://legion.ambient.xyz/docs/providing/host-network#require-the-allow-list) in the host's **Network** section. Rentals already running keep their setting, and renters see it before they rent.
- **DNS names.** The agent answers each rental's DNS and passes the names it allows on to the resolvers your machine uses, so your router or DNS server sees the names rentals look up.

## Can a renter break out of the container?

A container escape needs a flaw in the kernel, Docker, runc or the NVIDIA stack. Legion reduces what a rental can do, and you keep those up to date. What is in place:

- **Not privileged.** Every capability is dropped except the eight Legion's SSH server and init need (`AUDIT_WRITE`, `CHOWN`, `DAC_OVERRIDE`, `FOWNER`, `KILL`, `SETGID`, `SETUID`, `SYS_CHROOT`). `NET_RAW` and `MKNOD` stay dropped, and `no-new-privileges` is set.
- **System calls.** The agent does not turn off Docker's default system-call filter (seccomp).
- **Files.** A rental sees its own `/workspace` and Legion's read-only runtime. None of your directories are mounted into it.
- **Limits.** Each rental has a CPU and memory limit (swap no larger than memory), at most 4096 processes, and only the GPUs it rented.
- **Disk.** Each rental's disk is capped only when `/var/lib/legion-agent` is on XFS with project quotas. Otherwise the agent measures what each rental uses instead. See [Host requirements](https://legion.ambient.xyz/docs/providing/host-requirements#disk).
- **Engine checks.** The agent starts no rental on a runc older than the releases that fixed three container escapes found in 2025 (1.2.8, 1.3.3, 1.4.0-rc.3). The install refuses rootless Docker and Docker with SELinux.
- **Kernel settings.** At every start the agent raises a few network settings, such as strict reverse-path filtering on rental interfaces. It records the old values so they can be put back.
- **User namespaces.** Legion requires Docker's `userns-remap`, so root in a rental is an unprivileged user ID on your machine, not user ID 0. The installer turns it on, and the agent turns it on by itself when the host has no rentals and no other containers. Both first check in a test container that root is remapped and that the GPUs work that way; if a check fails, they put Docker back as it was and say so. See [User namespaces](https://legion.ambient.xyz/docs/providing/user-namespaces).

What is not in place:

- **User namespaces while a host waits.** Until a host's isolation is on (it has rentals or other containers, or the agent could not switch), root in a rental is user ID 0 on your machine, limited by the measures above. The host's page says why and what happens next; the manual command is `sudo legion-agent enable-userns` while the host has no rentals. See [User namespaces](https://legion.ambient.xyz/docs/providing/user-namespaces).
- **No virtual machine.** A kernel flaw that lets a process leave its container affects a rental too.

Keep the kernel, Docker, runc and the NVIDIA driver patched.

## What runs on my machine?

The `legion-agent` systemd service. It runs as root because it drives Docker and the GPUs, and anything that controls Docker can act as root on the machine. systemd narrows it:

- the file system is read-only to it except `/var/lib/legion-agent`, `/etc/legion-agent` and two directories under `/var/lib/docker`;
- it can't read home directories;
- it can't load kernel modules, and keeps only the capabilities it lists;
- it can use at most 8 CPU cores.

The agent acts only on containers it labelled as its own. Your other containers are left alone.

What it does:

- starts, stops and deletes the rentals Legion assigns to the host, and applies their network rules;
- runs [benchmarks](https://legion.ambient.xyz/docs/providing/benchmarks-and-score) while the host is idle, in a container with no network and no capabilities;
- uploads a copy of a rental's `/workspace` when its renter asks for a backup or download, or when Legion preserves it for an investigation;
- installs agent updates.

## How is the agent installed and updated?

- **Install.** The [install command](https://legion.ambient.xyz/docs/providing/install-the-agent) downloads one release's install script and checks its SHA-256 before it runs it. The script checks the release's signed checksums and the archive before it installs anything.
- **Updates.** Legion offers a release and its SHA-256. The agent checks the release's signature with keys built into it, and the archive against the SHA-256, then installs it at the next restart. If the new version doesn't reach Legion within 10 minutes, it rolls back by itself. Rentals keep running. See [Agent updates](https://legion.ambient.xyz/docs/providing/agent-updates).
- **The runtime in each rental.** The SSH server and init that Legion adds to every rental come from a signed bundle, checked against keys built into the agent before use.

## How does the agent talk to Legion?

- **To Legion's API:** outbound HTTPS only, TLS 1.3, with a certificate that names this host, lasts 24 hours and renews. Legion can revoke it, and then the agent can't connect.
- **Legion's private network:** the agent joins a WireGuard network that is closed by default. Only Legion's SSH gateway and web edge can reach the host, each on its own port range. Hosts can't reach each other.

## What does Legion collect about my machine?

- **Hardware:** GPUs, driver, CPU, memory, disk and platform.
- **A fingerprint:** SHA-256 hashes of hardware identifiers (GPU IDs and serials, machine ID, board IDs, disk and network card IDs), never the identifiers themselves. Legion uses it to notice the same machine joined twice.
- **Benchmarks:** GPU, disk and network results. See [Benchmarks and your score](https://legion.ambient.xyz/docs/providing/benchmarks-and-score).
- **Country:** Legion looks up the country of the address your agent connects from. It stores the country, not the address, and shows renters when it differs from the country you declared.
- **Agent logs:** the agent's own log lines go to Legion, where staff read them to diagnose a host. They never contain the agent's private key, the join token, a renter's SSH key or what a container prints.
- **Metrics:** served on the machine at `127.0.0.1:9123` and read by Legion over its private network. See [Monitoring with Prometheus](https://legion.ambient.xyz/docs/providing/monitoring).
- **Rental network counts:** what each rental's rules dropped, the destinations, and abuse flags. You see the flags under [What rentals did](https://legion.ambient.xyz/docs/providing/host-network#what-rentals-did).

## Is my IP address exposed to renters?

No port is opened on your machine. Renters reach rentals over SSH through Legion's gateway and reach exposed web services through Legion's edge. Both come over Legion's private network, and the agent's listeners exist only inside it, not on your interfaces.

Your public IP address is still visible to anything a rental contacts, because its traffic leaves through your connection. A renter can learn the address that way. The market shows renters the country you declared.

## What do I see of renters?

- **Earnings** show renters as Renter 1, Renter 2 and so on. You never see a renter's name, email address or billing details.
- **Network flags** name rentals by ID only.
- **On the machine** you can see the rental's containers and its renter's SSH public key, without the key's comment.

The [Acceptable Use Policy](https://legion.ambient.xyz/acceptable-use) forbids you to access a renter's workload, files, memory or traffic.

## What if a renter abuses my host?

What Legion does on every host:

- drops email on port 25 (465 and 587 stay open);
- limits each rental's new connections (200 a second, with bursts) and open connections;
- flags traffic to known mining pools and patterns that look like DNS tunnels.

Ambient can stop or isolate a rental, block images and destinations, and suspend accounts under the [Acceptable Use Policy](https://legion.ambient.xyz/acceptable-use). If you get an abuse complaint about your address, or see a rental misbehave, email support@ambient.xyz with "Legion abuse" in the subject, the time and the rental ID.

## How are payouts and bank details handled?

Payouts go through Stripe. You enter your bank details on Stripe's own pages, not in Legion. Legion keeps your Stripe account's ID, country and status, not your bank account number.

Only an owner can set up or change payouts, and only from the app while signed in: an API key can't. See [Payouts](https://legion.ambient.xyz/docs/providing/earnings-and-payouts#payouts).

## Can I use the machine for other things?

Yes, with these limits:

- **GPUs a rental holds are the renter's.** Don't run your own work on them. To rent your own GPUs, see [Use your own host](https://legion.ambient.xyz/docs/providing/use-your-own-host).
- **Ports.** The agent reserves ports 15353, 15443 and 15080 on rental interfaces. Once a renter exposes a web service, the agent drops new connections to that service's port in 30000 to 39999 for every process on the machine, so don't run your own services in that range.
- **What not to keep on it.** A renter who escapes a container is root on the machine. Keep passwords, SSH keys for other machines, personal files and anything you can't afford to lose off it, and put it on a network apart from devices you care about.

## If you think a host is compromised

Stop new rentals on it, then email support@ambient.xyz at once. See [Removing or moving a host](https://legion.ambient.xyz/docs/providing/removing-a-host).
