Deploy to a VPS
Put a relay on a Linux server with systemd: loot serve on 127.0.0.1, a TLS proxy in front, and a setup script you can re-run. The proxy and paths below are an example, not the only way.
You need a server with systemd, a DNS name pointing at it, ports 80 and 443 open, and the public key of everyone who will push or pull, from loot whoami --pubkey on their machine.
1. Install and start the relay
This script downloads a release, checks it against the published checksums, and writes the service. Run it as root. It is safe to run again: re-run it to upgrade or to change the allowlist. Each run restarts the relay.
#!/usr/bin/env bash
set -euo pipefail
TARGET=x86_64-unknown-linux-gnu # or aarch64-unknown-linux-gnu
ALLOW=(--allow "<64-hex>" --allow "<64-hex>")
case $TARGET in # the release each target runs
x86_64-unknown-linux-gnu) VERSION=v0.4.48 ;;
aarch64-unknown-linux-gnu) VERSION=v0.4.48 ;;
esac
tmp=$(mktemp -d); trap 'rm -rf "$tmp"' EXIT; cd "$tmp"
curl -sSfLO "https://dl.loot.build/$VERSION/loot-cli-$TARGET.tar.xz"
curl -sSfLO "https://dl.loot.build/$VERSION/sha256.sum"
grep " \*loot-cli-$TARGET.tar.xz$" sha256.sum | sha256sum -c -
tar -xJf "loot-cli-$TARGET.tar.xz"
install -m 0755 "loot-cli-$TARGET/loot" /usr/local/bin/loot
id -u loot >/dev/null 2>&1 || useradd --system --home /var/lib/loot-relay --shell /usr/sbin/nologin loot
install -d -o loot -g loot -m 0750 /var/lib/loot-relay
cat > /etc/systemd/system/loot-relay.service <<EOF
[Unit]
Description=loot relay
After=network-online.target
Wants=network-online.target
[Service]
User=loot
Group=loot
ExecStart=/usr/local/bin/loot serve --dir /var/lib/loot-relay --addr 127.0.0.1:4000 ${ALLOW[*]}
Restart=on-failure
RestartSec=2
NoNewPrivileges=true
ProtectSystem=strict
ReadWritePaths=/var/lib/loot-relay
ProtectHome=true
PrivateTmp=true
[Install]
WantedBy=multi-user.target
EOF
systemctl daemon-reload
systemctl enable loot-relay
systemctl restart loot-relayUse the 64-hex form of each key here, since the OpenSSH line contains spaces. Access control shows how to get it. Check the service with journalctl -u loot-relay: its first lines say how many keys it admits.
2. Put TLS in front
loot serve has no TLS, so a proxy terminates it. With Caddy, which fetches a certificate by itself, the whole config is:
relay.example.com {
reverse_proxy 127.0.0.1:4000
}nginx works too. Its default body limit is 1 MiB and a relay request may be 64 MiB, so set client_max_body_size 64m;.
3. Check it
curl -s https://relay.example.com/info # lists the keys you allowed loot remote add origin https://relay.example.com loot push
Rollback is one DNS record
To move a relay to a new server, keep the old one. Lower the record's TTL ahead of time. Stop the old relay, copy its data directory across (see Backups and restore), start the new one, then point the record at the new server.
To roll back, start the old relay and point the record back. Anything pushed to the new server in between is still on the pushers' machines: their next loot push sends what the old relay lacks. A grant delivered only to the new server must be sent again.
Traps
- Keep the clock right. An embargo's reveal is decided by the relay's own clock (see the trust page), so run NTP.
- Don't expose port 4000. Bind
127.0.0.1and let only the proxy listen publicly. - The store has no size cap and grows with every push; only a burn removes bytes. Watch
/var/lib/loot-relay.