# Security and trust

> What a provider can and can't reach in your rental, who can connect to it, how your traffic, data and payments are handled, and how your account and API keys work.

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

Your rental runs on a machine an independent provider owns. This page says what Legion does to limit risk, what it can't do, and what you should do yourself. Providers: see [Security for providers](https://legion.ambient.xyz/docs/providing/security).

## In short

- A provider with root on their machine can technically reach what runs on it. Legion's terms forbid it, but Legion can't technically stop it. Don't put data on a rental that you can't trust to a third party's machine.
- Over SSH, only the key you gave when you rented gets in, and Legion's gateway passes your session through encrypted.
- Rentals on the same host have separate networks and their own GPUs, but share the host's kernel.
- Legion backs up a rental only when you ask. Keep copies of anything you need.

## Renting

### Can the provider see my files and processes?

Technically, yes. A provider has physical and administrative control of the machine, so they can reach:

- your files on its disk, including `/workspace`;
- your processes, memory and GPU memory;
- traffic that is not encrypted, including requests to a service you expose on `ambi.run` (see [Is my traffic encrypted?](#is-my-traffic-encrypted)).

Legion does not offer confidential computing or hardware-attested isolation from the host's owner.

What Legion does about it:

- The [Terms of Use](https://legion.ambient.xyz/terms) and the [Acceptable Use Policy](https://legion.ambient.xyz/acceptable-use) forbid providers to access, copy or record your workload, files, memory or traffic. Breaking that means suspension, preserved evidence and possible referral to the authorities.
- Providers don't get your name, email address or billing details. Their earnings show you as Renter 1, Renter 2 and so on. Your SSH public key reaches the host without its comment.
- Legion's agent opens your files only to copy `/workspace` when you ask for a backup or download (or when Legion preserves a rental for an investigation), to read file names and sizes for that copy's estimate, and to read the status file of a pre-made model.

What you can do:

- Encrypt sensitive data, and keep the keys outside the rental.
- Leave SSH agent forwarding off unless you need it: while your agent is forwarded, anyone with root in the rental, the provider included, can sign in with your keys wherever they work.
- Delete the rental when you're done.

### Who can connect to my rental?

- **Over SSH:** whoever holds the private key for the public key you gave when you rented. Legion's gateway accepts keys only, never passwords, and forwards a key only to the rental it was given for. A rental has one key, and someone who leaves your organization but kept that private key can still connect until you [change the rental's key](https://legion.ambient.xyz/docs/renting/ssh-keys#change-or-revoke-the-key-of-a-rental). The gateway then accepts only the new key within about 30 seconds and closes that person's open sessions within about a minute.
- **The web terminal:** whoever the rental allows, once they have signed in within the last 15 minutes. When you rent you choose **Everyone in your organization** (any owner or member, the default) or **Only you and the owners** (the person who created the rental and your organization's owners). The creator or an owner can change it later on the rental's page. Each session gets its own certificate, valid for 120 seconds. If someone is removed from your organization, or the rental no longer allows them, their open web terminal ends within a minute. To have no web terminal, turn off **Allow the web terminal** when you rent. See [The web terminal](https://legion.ambient.xyz/docs/renting/connecting#the-web-terminal).
- **The provider:** has root on the machine, as above.

Legion records each SSH session through the gateway (key fingerprint, address, rental, bytes and duration) and each web terminal grant.

### Are other renters on the same host kept apart from me?

Yes, as containers. Each rental has its own network, and rentals can't reach each other. Each rental gets only the GPUs it rented, and its own CPU, memory and process limits.

Rentals are not virtual machines: they share the host's Linux kernel. A flaw that lets a process leave its container would let it reach other rentals on that host.

### Is my traffic encrypted?

- **SSH** is encrypted from your SSH client to the SSH server in your rental. Legion's gateway and private network pass it through and never decrypt it.
- **The web terminal** runs SSH in your browser. Legion's relay passes the encrypted bytes through.
- **A service on `ambi.run`** is HTTPS to Cloudflare, encrypted from Cloudflare to Legion's edge and over Legion's private network to the host, then plain from the agent to your app inside the host. The provider can see it there. For anything private, add your own encryption and sign-in (see [Keep it private](https://legion.ambient.xyz/docs/renting/services/expose-a-port#keep-it-private)).
- **Traffic your rental sends out** leaves through the provider's connection, encrypted only if your program encrypts it. Legion records the names and addresses your rental connects to. See [Outbound network](https://legion.ambient.xyz/docs/renting/outbound-network).

### What happens to my data?

| When | What happens to the files on the host |
| --- | --- |
| You stop a rental | They stay on the host for at most 72 hours, sometimes less (see [Reclaim](https://legion.ambient.xyz/docs/renting/stopping-and-backups#reclaim)). |
| An interruptible rental is stopped for another renter | What you chose when you rented: keep the files, or delete them. See [Keep or delete](https://legion.ambient.xyz/docs/renting/interruptible-rentals#keep-or-delete). |
| You delete a rental | The agent removes the container, its network rules and `/workspace` with ordinary file deletion, then, usually within 15 minutes, asks the host's filesystem to discard the freed blocks (TRIM). That tells an SSD the old data is no longer needed. Most SSDs then stop returning it, but Legion can't check what a provider's drive does. The disk is not overwritten. Where the disk or the host's disk setup doesn't support discard, the data stays on the disk until other data overwrites it, and may be recoverable until then. |
| A provider removes a host | Either the removal waits up to 72 hours for renters' files and you get an email, or the provider deletes them at once and Legion records it against the provider. |
| A host leaves Legion without a removal | Its rentals' files go with it. |

A backup is a copy of `/workspace` that Ambient stores, apart from the host, for the 7 or 30 days you choose. Its download link works once, for whoever opens it first, so keep it to yourself. The same goes for a workspace download link. See [Stopping, backups and how long your data is kept](https://legion.ambient.xyz/docs/renting/stopping-and-backups).

Legion may preserve a rental's data while it investigates abuse. See the [Acceptable Use Policy](https://legion.ambient.xyz/acceptable-use).

### How are my payment details handled?

You pay on Stripe's Checkout page, not in Legion. Legion keeps Stripe's references to the payment, the amount, and the card's country and check results that Stripe returns. It never receives your card number. A refund of unused credit goes back only to the payment method the money came from. See [Credit and billing](https://legion.ambient.xyz/docs/renting/credit-and-billing).

## Your account

### Signing in

- Sign in with one of the options on the sign-in page. Legion accepts only sign-ins with a verified email address.
- You stay signed in for up to 30 days, or until you haven't used Legion for 14 days. Then you sign in again.
- Opening a web terminal asks you to sign in again if you last did more than 15 minutes ago.
- **No tokens in your browser.** Your sign-in stays at Legion's gateway. Your browser holds only a cookie that page scripts can't read, that is sent only over HTTPS and only to Legion.
- Sign out on a shared computer.

### API keys

- A key is shown once, when you create it. Store it like a password.
- A key has a scope: every operation your role allows, or only what AI agents need. A key never gets more than the role of the person who made it.
- Setting up payouts and opening a web terminal need the app: an API key can't.
- Revoke a key at any time. See [Authentication](https://legion.ambient.xyz/docs/api/authentication).

### Organization roles

Owners manage API keys, people, hosts, the organization's network settings, payouts and top-ups. Members rent, and can open any of the organization's rentals. See [Organizations and roles](https://legion.ambient.xyz/docs/account/organizations-and-roles).

### What Legion records

Sign-ins, API and web requests with their addresses, SSH sessions, web terminal grants (kept for at least 90 days, and never edited), rental lifecycle and usage, the network destinations each rental contacts, and every change Ambient staff make. These records describe what happened. They are not designed to capture what you type in a session or what your traffic contains. See [Data Handling](https://legion.ambient.xyz/data-handling).

## Report a security issue

Email support@ambient.xyz with "Legion abuse" in the subject. Say what happened and when, and include any rental or host ID, addresses and logs. Don't test Legion's own systems for weaknesses without written permission. See [Reporting abuse](https://legion.ambient.xyz/acceptable-use).
