Repository navigation
Rootless Podman
Rootless Podman is the strongest isolation HiddenForge supports, and the project recommends it for high-risk deployments. In rootless mode, container uid 0 maps to your regular host user through Linux user namespaces. A container escape then gives an attacker your user account and not real root.
Use podman-compose.yml from the repository, not docker-compose.yml. It carries the same hardening, with the differences explained below.
Run Docker Compose v2 against the rootless Podman socket. It is the only way measured to apply every limit in podman-compose.yml. It needs only the Compose binary and not the Docker engine.
# Prerequisites (Ubuntu 24.04 shown). --no-install-recommends matters: without
# it apt also installs and starts the Docker engine, a root daemon.
sudo apt install podman
sudo apt install --no-install-recommends docker-compose-v2
systemctl --user enable --now podman.socket
# Come back after a reboot: Podman restarts only `restart: always` containers
# (the Podman file sets it), and only with these two enabled for your user.
loginctl enable-linger $USER
systemctl --user enable podman-restart.service
export DOCKER_HOST=unix://$XDG_RUNTIME_DIR/podman/podman.sock
COMPOSE=/usr/libexec/docker/cli-plugins/docker-compose
mkdir -p ./tor-keys
$COMPOSE -p hiddenforge -f podman-compose.yml up -d
# Read the .onion address once Tor bootstraps (first boot: a few minutes, up to ~6)
$COMPOSE -p hiddenforge -f podman-compose.yml exec tor su-exec tor cat /var/lib/tor/hidden_service/myapp/hostnameConfirm the setup is rootless:
podman info --format '{{.Host.Security.Rootless}}'
# Expected output: trueMeasured on stock Ubuntu 24.04 (Podman 4.9.3, docker-compose-v2 2.40.3, no Docker engine): the service reached ready, pids.max was 256, memory.swap.max was 0, and DNS was isolated. With Tor killed, the container restarted with the same address and served HTTP 200 over Tor. After a real reboot it came back ready with the same address.
| Requirement | Why |
|---|---|
restart: always in the compose file |
Podman's boot service starts only always containers. The shipped Podman file sets it. |
loginctl enable-linger $USER |
Lets your user services run with no login session. |
systemctl --user enable podman-restart.service |
The unit that runs podman start --all --filter restart-policy=always at boot. |
The reason for always is a measured failure. On Ubuntu 24.04 with real reboots, the same stack with restart: unless-stopped left both containers stopped. With always it came back ready on the same address. The Docker file keeps unless-stopped, and three real reboots on Docker each came back by themselves.
Under Podman the address is read as the tor user:
$COMPOSE -p hiddenforge -f podman-compose.yml exec tor su-exec tor cat /var/lib/tor/hidden_service/myapp/hostnameThe Podman file drops DAC_OVERRIDE, so the root user that exec gives you cannot traverse the 0700 tor-owned data directory. Reading it as tor is the correct way. If you hit "Permission denied", do not add DAC_OVERRIDE back and do not loosen the key directory.
The same drop has a second effect. Tor writes hostname as tor with mode 0600, so the root supervisor cannot read it either, and reading it is how the <name>.onion file lands in your key volume. Under Podman that file is never created. The key directory also belongs to a subuid inside the user namespace, so the host cannot read it directly. hiddenforge show says exactly that:
$ hiddenforge show --keys ./tor-keys --name myapp --json
{"error": "address not published yet: tor-keys/myapp exists but is not readable
by this user, and tor-keys/myapp.onion does not exist. ...", "exit_code": 4,
"onion": null, ...}That is the trade working as intended, and the address is still served. hiddenforge show --container tor asks the container for it, as the tor user. Docker publishes <name>.onion normally, so show works from the host there.
| Capability | Docker (rootful) | Podman (rootless) |
|---|---|---|
DAC_OVERRIDE |
Required. ./tor-keys is owned by host uid 1000 and container root is a different user. |
Not needed. Inside the user namespace, container root is host uid 1000 and already owns the mount. |
FOWNER |
Required. Container root cannot chmod files it does not own. | Not needed, same reasoning. |
CHOWN |
Required | Required |
SETUID / SETGID
|
Required | Required |
podman-compose.yml therefore lists CHOWN, SETUID and SETGID after cap_drop: ALL. hiddenforge doctor knows the difference: on a rootless engine it requires those three, and on rootful Docker it requires all five.
The Podman file declares no healthcheck: key at all, not even disable: true.
Rootless Podman 4.9 runs healthchecks through systemd user timers. When no systemd user manager is reachable (a service account nobody logs into, sudo -iu, cron, a broken user bus), it never restarts a container that has a healthcheck. Measured on Ubuntu 24.04: with a healthcheck, the container stayed stopped after it exited. Without one, it restarted every time.
This container heals by exiting and being restarted: after Tor dies, when a backend moves to a new IP, and when a backend that was down at boot comes up. A restart that never happens is an outage. disable: true does not help, because Docker Compose sends it to Podman as test [NONE], which Podman 4.9 still treats as a healthcheck (measured: not restarted).
Readiness comes from hiddenforge status, which runs the same check itself when the engine reports no health.
If you use podman-compose instead of Docker Compose (pip install podman-compose), two declared limits are not applied:
| Setting | podman-compose behaviour | Result |
|---|---|---|
pids_limit: 256 |
Honoured only from podman-compose 1.1. Ubuntu 24.04 ships 1.0.6. | Podman's default of 2048 processes |
memswap_limit: 512m |
Honoured by no version | The container may use swap |
Workarounds: bring the stack up with --podman-run-args="--pids-limit=256" (it applies to every service in the file, your backend included), and for swap, run the host with none. Docker Compose on the Podman socket applies both, which is why it is the recommended path.
podman-compose -f podman-compose.yml up -d
podman-compose -f podman-compose.yml exec tor su-exec tor cat /var/lib/tor/hidden_service/myapp/hostname- No explicit
apparmor=option. Rootless Podman often cannot load thedocker-defaultprofile, so it applies its own. - The engine's default seccomp profile applies under Tor's own sandbox, as on Docker. Do not add
seccomp=unconfined. -
tmpfsentries carry nouid=,gid=ormode=options, because Podman does not support them. The entrypoint chowns/var/lib/torat startup. -
dns: 127.0.0.1stops an unanswered backend name from going to your host's resolver. Podman's aardvark-dns would otherwise forward it. - A backend on port 80 or 443 needs
NET_BIND_SERVICEunder rootless Podman, or a port of 1024 or above (for example"80:web:8080").
hiddenforge doctor --container tor --keys ./tor-keys --json| Check | Severity |
|---|---|
CHOWN, SETUID and SETGID are present, and nothing outside the allowed five |
fail |
A runtime seccomp profile is applied (not unconfined) |
fail |
| Process count capped at 512 or fewer (fails under old podman-compose, and says why) | fail |
Swap disabled, measured from memory.swap.max
|
fail, or warn if the host has no swap |
Restart policy set (always required for a reboot under Podman) |
fail if none, warn if not always
|
| Linger enabled | warn |
podman-restart.service enabled |
warn |
dns: set to a loopback address |
warn |
These are measured inside the running container where possible, so the result reflects what was applied and not what the compose file asked for. For the full list, and for the systemd-unit case, see The hiddenforge CLI.
Start here
Older releases
Going deeper
- The Security Model
- Verifying the Image
- Reproducing the Build
- The hiddenforge CLI
- Rootless Podman
- Backing Up Your Onion Address
- Upgrading Safely
- Running Multiple Services
Help