Skip to content

About

Tor hidden service container with Vanguards on Alpine. Built for a state-level adversary threat model.

Topics

Resources

Security policy

Stars

33 stars

Watchers

1 watching

Forks

Latest commit

 

History

470 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

HiddenForge

Latest release: 3.0.1.

I run my own services as onion services, and I wanted one container that gets the Tor side right and that anyone can check: pinned inputs, signed releases and a build you can reproduce. It hardens Tor and its surroundings. It does not protect an application that gives away where it lives; see What HiddenForge cannot protect you from.

docker pull sambent.dev/sam/hiddenforge   # the maintainer's own registry
docker pull doingfedtime/hiddenforge      # Docker Hub

Both registries serve the same digest, and the same signatures verify either one. Verify what you pulled with the verification guide. The full guide is in the wiki.

Upgrading from 2.1.x? Nothing to do: same compose file, same keys, same address. Inside the container every command is now hiddenforge <command>. See Upgrading. From 2.0.4? Your keys carry over, but read Upgrading from 2.0.4 first.

HiddenForge

Quick Start (3 steps)

docker compose up pulls the image (sambent.dev/sam/hiddenforge) by itself:

# 1. Download the compose file
curl -O https://sambent.dev/sam/HiddenForge/raw/branch/master/docker-compose.yml

# 2. Make the two edits marked <-- EDIT in docker-compose.yml
#    - Change MYAPP to your service name (e.g. BLOG, TIPSITE); it appears twice
#    - Replace nginx:alpine with your actual backend image

# 3. Start it
mkdir -p ./tor-keys
docker compose up -d

# Your .onion address appears here once Tor bootstraps (first boot: a few minutes, up to ~6):
# Replace "myapp" with whatever you named your service in step 2
docker compose exec tor hiddenforge show --name myapp

All security flags are set in the compose file. The backend service is network-isolated and never exposed to the internet.

The compose file pulls :latest. Run hiddenforge verify-image before you deploy, and pin the verified digest if you want a deployment that never moves.

What it is: a hardened Tor onion service container. Tor 0.4.9.17, compiled from Tor Project's signed source, on Docker Hardened Images' minimal static base, with Tor's vanguards-lite pinned on and native bandguards and rendguard attack detectors. The image holds Tor, its libraries and one small Rust binary: no shell, no package manager, no Python. Zero known vulnerabilities at every severity, from two scanners. It is built offline from a locked set of verified inputs, and the build is reproducible. It is built against a state-level adversary; the assumptions and their limits are in docs/THREAT-MODEL.md, and how it maps to NIST and CIS guidance is in docs/COMPLIANCE.md.

The compose files

File What it is
docker-compose.yml Docker quick start. Five capabilities, a healthcheck, restart: unless-stopped
podman-compose.yml Rootless Podman quick start. Three capabilities, no healthcheck, restart: always
examples/demo/app.yml A demo backend only, with no Tor service. It is merged with a generated fragment
compose.service.yml Generated by hiddenforge setup for your deployment. Not in this repository
compose.yml Your own base file in the examples. Not in this repository
tests/golden_setup/compose.service.yml Expected output of setup, used by a test. Not deployable

The two shipped files differ on purpose; the differences are listed in docs/INTEGRATION.md.


Adopt it programmatically (CLI + machine contract)

You do not have to edit a compose file by hand or build mkp224o yourself. The hiddenforge CLI emits a merge fragment, and the vanity generator ships inside the image.

# 1. Emit a ready-to-merge fragment (does not touch your files)
hiddenforge setup --backend web:80 --name myapp --out ./deploy

# 2. Merge and start: your app needs no ports and no Tor code
docker compose -f compose.yml -f ./deploy/compose.service.yml up -d

# 3. Read the .onion (also written to ./tor-keys/myapp.onion)
hiddenforge show --keys ./tor-keys --name myapp --json

The CLI is a single file, scripts/hiddenforge in this repository: Python 3.10 or later, standard library only, nothing to pip install. Install it where sudo also finds it (backup needs root under Docker): sudo install -m 0755 scripts/hiddenforge /usr/local/bin/hiddenforge.

Subcommands: setup, info, version, show, status, doctor, vanity, backup, restore, rotate, encrypt-key, decrypt-key, client-auth, unseal-keys, verify-image, sbom. Every one supports --json, never prompts off a TTY, and uses stable exit codes. vanity --bench prints the time estimate for a prefix on your machine before you start.

→ Full integrator guide: docs/INTEGRATION.md

The image carries its own manifest and CLI:

docker run --rm sambent.dev/sam/hiddenforge:latest version --json
docker run --rm sambent.dev/sam/hiddenforge:latest info --json   # the machine contract

What the Compose File Does

The included docker-compose.yml is ready to use as it is:

What How
Drops all Linux capabilities cap_drop: ALL
Prevents privilege escalation security_opt: no-new-privileges:true
Two stacked seccomp filters runtime default profile + Tor's Sandbox 1
Read-only container filesystem read_only: true
No host-side log file logging: driver: none
Network-isolated backend internal: true network, no ports: on backend
No DNS query leaves the tor container dns: 127.0.0.1 (backend names still resolve internally)
Key persistence ./tor-keys volume mount

The only two edits you need to make are flagged with <-- EDIT.


Environment Variables

  • {NAME}_TOR_SERVICE_HOSTS sets the hidden service port mappings.
    • Three-part "80:web:80" routes onion port 80 to Docker service web on port 80.
    • Two-part "80:8080" routes onion port 80 to 127.0.0.1:8080 (same-container only).
    • Multiple ports: "80:web:80,443:web:443"
    • NAME is lowercased and used as the service directory name (underscores become hyphens).
    • Docker service names resolve to IP addresses at startup, so no static IPs are required.
  • TOR_SANDBOX set to 0 disables Sandbox 1 (default: 1)
  • HIDDENFORGE_VANGUARDS set to full pins layer-2 and layer-3 guards (the full Vanguards defence) instead of Tor's vanguards-lite; it needs TOR_SANDBOX=0. See Full vanguards.
  • HIDDENFORGE_KEY_PASSPHRASE_FILE turns on key encryption at rest (written for you by hiddenforge setup --encrypt-keys)
  • {NAME}_TOR_EXPORT_CIRCUIT_ID set to haproxy gives that service's backend a way to tell visitors apart (default: off). Tor then starts every connection to the backend with a PROXY protocol v1 header whose source address carries the Tor circuit ID (fc00:dead:beef:4dad::<id>), so the backend can rate-limit or block one circuit without blocking every visitor. The backend must expect the header, or every request to it fails: for nginx, listen 80 proxy_protocol; and use $proxy_protocol_addr as the visitor's key.

Tor keeps its entry guards across restarts. Tor records the entry guards it has chosen in its state file, and the DataDirectory is in memory, so each restart used to make Tor choose new ones. Every new choice is another chance of picking a hostile relay, and HiddenForge restarts itself on purpose (a moved backend, Tor exiting, a host reboot). The state file is now saved as tor-state (mode 0600, owned by the tor user) in the key directory of the service whose name sorts first, every 10 minutes and at shutdown, and restored before Tor starts. It is not encrypted by --encrypt-keys. backup and restore carry it with the keys, and rotate moves it out with the old key, so a new address never inherits the old one's guards. Deleting it only means Tor chooses guards once more.

A recreated backend is followed automatically. Tor accepts only IPs, so the service name is resolved at startup and the IP is written into the torrc. The supervisor re-resolves every 30 seconds. When two successful lookups in a row no longer include the old IP, it exits and the restart policy starts the container again with a fresh lookup. The .onion address does not change.

Measured on 3.0.1: after the backend moved to a new IP the container restarted 61 seconds later and served the same address again at 77 seconds, and a backend that was simply down for two and a half minutes caused no restart at all. A backend whose name does not resolve when the container starts (after a host reboot the runtime starts containers in no particular order) is watched the same way. Its service is left out, and once the name resolves the container restarts and configures it: 46 seconds after the backend came up in that measurement.

Until then hiddenforge status lists the mapping in dropped_mappings. ready means every service Tor is configured with is reachable, and a dropped mapping is not configured. With other services up, the container can be ready while one is missing, so check that dropped_mappings is empty as well.

This relies on a restart policy, which both shipped compose files set (restart: unless-stopped; always in the Podman file).


Upgrading

From any 2.1.x or 3.0.x release: pull the new image and recreate the container. The compose files, the key volume, the *_TOR_SERVICE_HOSTS lines and the onion address stay as they are, and the healthcheck your compose file already declares keeps working. Upgrading a 2.1.6 volume and rolling it back were both tested with the same key.

Inside the container every command is hiddenforge <command>; the image has no shell, no Python and no cat. Read the address with hiddenforge show --name myapp, or from ./tor-keys/myapp.onion on the host. The full list is in the CHANGELOG.

Four hardening options are new in 3.0, all off by default:

Option What it does How
No-root mode The container starts as the tor user with no capabilities at all; nothing ever runs as root hiddenforge setup --no-root
Full vanguards Pins 3 layer-2 and 8 layer-3 guards, rotated as the Vanguards addon does, against guard discovery on a long-lived service. Costs Tor's own seccomp sandbox HIDDENFORGE_VANGUARDS: full and TOR_SANDBOX: "0" in the tor service's environment
Client authorization Only clients you give a key to can reach the service; to anyone else the address leads nowhere hiddenforge client-auth add --name myapp --client alice, then restart the container
Key encryption at rest The service key is kept on the volume only encrypted (AES-256-GCM, scrypt), and decrypted into RAM at every start hiddenforge setup --encrypt-keys. The generated deploy.sh creates a random passphrase in ./key-passphrase.txt if there is none

Key encryption protects a volume, disk or backup taken while the service is stopped. It does not protect a running host, and it protects nothing if the passphrase file sits on the same disk. Back the passphrase up separately: without it the address is gone. To turn it off (or before rolling back to 2.1.6, which cannot read a sealed key), stop the service and run hiddenforge unseal-keys --keys ./tor-keys --name myapp --passphrase-file ./key-passphrase.txt, then remove the passphrase lines from the compose file.

Full vanguards

Tor's built-in vanguards-lite pins four layer-2 guards and nothing at layer 3. Tor's own proposal 333 says a long-lived, high-risk onion service relying on that alone "might provide those services with a false sense of security" and should run the full Vanguards defence. HIDDENFORGE_VANGUARDS: full does that natively: 3 layer-2 guards (each kept 1 to 45 days) and 8 layer-3 guards (1 to 48 hours), chosen bandwidth-weighted the way the Vanguards addon chooses them, replaced when they expire or leave the consensus, and kept across restarts in <first service>/vanguards-full.state on the key volume.

The cost: the pins are applied with SETCONF, and Tor's Sandbox 1 rejects every SETCONF, so this mode needs TOR_SANDBOX: "0". The container still runs under the engine's seccomp profile, Landlock and the capability drop; what goes is the second, Tor-specific filter. The container refuses to start with full and the sandbox on, rather than run without the pins. Which risk weighs more depends on your adversary: guard discovery against a long-lived service, or a remote exploit in Tor itself.

Client authorization

For a service only certain people should reach (a source drop for one newsroom, an admin panel), give each person a key:

hiddenforge client-auth add --keys ./tor-keys --name myapp --client alice
hiddenforge client-auth list --keys ./tor-keys --name myapp
hiddenforge client-auth remove --keys ./tor-keys --name myapp --client alice

Restart the container after a change. From the first client on, Tor encrypts the service's descriptor to the authorized keys, so someone who has only the address cannot find the service on the network at all. add prints the client's private line once and does not keep it: hand it over on a channel you trust. The client puts it in a file ending in .auth_private in the directory its torrc names with ClientOnionAuthDir (Tor Browser asks for the key when it opens the address). The service stores only public keys (<name>/authorized_clients/<client>.auth), so the key volume leaking does not leak a client's key. Removing the last client opens the service again.

Upgrading from 2.0.4

Your key directory and *_TOR_SERVICE_HOSTS lines carry over unchanged, and the onion address stays the same. Upgrading a 2.0.4 deployment to 2.1.x and rolling it back were both tested with the same key. What changed is the compose file around them. If you wrote your own compose file from the 2.0.4 one, make these changes:

Change in 2.1.0 What to do
seccomp=unconfined is gone; the engine's default seccomp profile now applies, stacked under Tor's own sandbox Remove it. hiddenforge doctor fails a container that still sets it
ulimits.nproc is gone Remove it. It counts every process of uid 100 on the host, so on a busy host Tor could not start. pids_limit: 256 is the cap
dns: 127.0.0.1 on the tor service Add it, so an unresolved backend name never reaches an outside resolver. Name the backend by its compose service name; an external hostname will no longer resolve
A restart policy is required Keep restart: unless-stopped (Docker) or always (Podman). The container exits on purpose when a backend changes IP and relies on the restart to pick up the new address
Readiness is stricter ready waits until Tor has uploaded the service descriptor, so it arrives later than in 2.0.4, and a container with no service configured never reports ready
Startup is stricter about the key volume A symlinked service directory stops the container with an error naming the path. A key file with more than one hard link is not taken over (a warning names it), so Tor usually cannot read it: remove the extra links
Podman uses restart: always and no healthcheck Use the shipped podman-compose.yml; see Rootless Podman

2.0.4 has no hiddenforge CLI: on 2.0.4, docker run <image> version --json just starts Tor. The full list of changes is in the CHANGELOG.

Known issues

Issue Status
2.1.1 shipped /opt/hiddenforge and /usr/local/bin/tests as mode 0644 Fixed in 2.1.2 and later. Do not deploy 2.1.1
3.0.x and 2.1.x have no hardware (SSH-FIDO2) signature ML-DSA-65 only. hiddenforge verify-image needs --allow-pq-only and reports complete: false
arm64 was tested in a full-system arm64 VM (real aarch64 kernel, emulated CPU) Not tested on real ARM hardware

Not planned

Decision
No desktop installer and no hosted setup page. The setup wizard is one offline file (wizard/hiddenforge-wizard.html) that makes no network request
No cosign or Sigstore after 2.0.3: signatures are ML-DSA-65 plus SSH-FIDO2

Supply Chain Security

Supply chain attacks (xz-utils, PyPI package hijacks, compromised npm packages) are why the build trusts nothing it has not checked. 3.0 is built from a locked set of inputs. Every build step runs with no network at all (RUN --network=none), and the only images pulled are the base, the two builders and BuildKit, each by digest.

Input Where it comes from How it is checked
Base image dhi.io/static (Docker Hardened Images), by digest Docker's signed provenance verified when the digest was adopted. Used unchanged: the image is that base plus one layer
Builder images DHI python dev and DHI rust dev, by digest Same
Tor 0.4.9.17 Tor Project's release tarball Its SHA-256 file is signed by Tor's release keys, pinned in signatures/tor-release-keys.gpg; the build checks the hash again
Tor's libraries and the build tools DHI's apk repository (zlib from Alpine's) Each package index is RSA-signed by a key pinned in signatures/; each package must match the checksum its signed index lists
libc crate (the Rust binary's only dependency) crates.io, vendored The checksum Cargo.lock pins
mkp224o vendored source SHA-256 in the Dockerfile

build-inputs.sha256 lists every input file with its hash. Before a build, scripts/build_inputs.py verify <dir> refuses an archive that differs from it in any file, then runs every check above. An older archive, even one where everything is validly signed, fails at the first step.

This replaces 2.x's exact-version apk pins. Alpine removes superseded packages from its index, and every time it did a 2.x build stopped resolving. The 3.0 inputs are archived for the current release and the one before it, so that can no longer happen. The full list is in docs/DEPENDENCIES.md.


Verifying the Image

Pinning protects what goes into the image. Signing and reproducible builds let you verify the image you pull.

Releases are signed over the image digest with a post-quantum ML-DSA-65 signature (FIPS 204) and, when the hardware key is available, an SSH-FIDO2 YubiKey signature. Neither depends on an outside service or a transparency log. The files are in signatures/. 3.0.1 carries the ML-DSA-65 signature only. There is no hardware signature for it, so hiddenforge verify-image needs --allow-pq-only and reports complete: false.

hiddenforge verify-image sambent.dev/sam/hiddenforge:latest --json
hiddenforge sbom --image sambent.dev/sam/hiddenforge:latest --out hf.spdx.json

The CLI checks the registry digest against the signed digest, then both signatures against the pinned keys, never against keys found in the signature directory. It exits 1 when a half cannot be checked, unless you accept that absence: --allow-classical-only when the ML-DSA half is missing, --allow-pq-only when the SSH-FIDO2 half is. It reads ./signatures, so run it from the root of this repository or pass --sigdir. sbom runs on the host: it drives a digest-pinned syft container through the Docker socket, which the image deliberately does not have.

The signed digest for 3.0.1 is sha256:a267ae01f604b0c5a6a125972cb6d92ccfdb9a9f8e9240ab709108baafc09b76. Signature files verify against whatever public key sits beside them, so the keys are the trust anchor. They must match these values, which are also pinned in scripts/hiddenforge:

ssh-keygen -lf allowed-signers   # SHA256:YcUo1tBtj+Mlnpv9QpsWnJcMt77B4SipyD6OWSMjMB4
                                 # SHA256:wL6piZbyXpTOzT7Z66f/Q+vegj0Ml0ZwVouGJ06+3Q0
sha256sum sambent-mldsa.pub      # 4ae873ade7ee596c815f55f3052c0f01020b1817f86eaf15ab67c8fc77cbfd22

Releases up to 2.0.3 also carried a cosign signature; cosign.pub stays in the repository so those releases remain verifiable. Later releases do not use it.

Verify from master, not from a release tag: signatures are committed after the tag they sign.

Reproduce it yourself. The build inputs for each release are published as one archive. Fetch and verify it, then build from the release tag; the digest must match the signed one:

Build from a fresh clone, not an existing checkout (file times in a working tree reach the image), and log in to dhi.io with any Docker account first: it serves the base and builder images and refuses anonymous pulls.

docker login dhi.io
git clone --branch v3.0.1 https://sambent.dev/sam/HiddenForge.git hf && cd hf
python3 scripts/build_inputs.py fetch \
  https://sambent.dev/api/packages/sam/generic/hiddenforge-inputs/3.0.1/hiddenforge-inputs-3.0.1.tar ./inputs
docker buildx create --name hf-repro --driver docker-container \
  --driver-opt image=moby/buildkit@sha256:0168606be2315b7c807a03b3d8aa79beefdb31c98740cebdffdfeebf31190c9f
docker buildx build --builder hf-repro --no-cache --provenance=false \
  --platform linux/amd64,linux/arm64 --build-context inputs=./inputs \
  --build-arg SOURCE_DATE_EPOCH=$(git log -1 --format=%ct) \
  --output type=oci,dest=hf.tar,rewrite-timestamp=true .

Building the arm64 half on an x86_64 machine needs QEMU user emulation (binfmt_misc) on the host. The step-by-step procedure, the manual openssl and ssh-keygen checks, and how to reproduce the build are in the wiki:

→ Verifying the Image


Offline Key Generation (Recommended for High-Risk Deployments)

By default the container generates hidden service keys on first run on the production host. For a high-risk deployment, generate keys offline on an air-gapped machine so the private key never touches the production host in plaintext.

# Option A: the vanity generator built into the image (mkp224o, pinned and
# hash-checked in the Dockerfile). Pull the image while online, then on the
# air-gapped machine. The generator container itself also runs with no network:
hiddenforge vanity --prefix myprefix --name myapp --keys ./keys --bench   # how long?
hiddenforge vanity --prefix myprefix --name myapp --keys ./keys           # writes ./keys/myapp/

# Option B: run Tor once on an air-gapped machine, let it generate
# keys, copy the service directory out, then wipe the machine.

Mount pre-generated keys:

# Service directory must contain:
#   hostname                (your .onion address, plaintext)
#   hs_ed25519_secret_key   (binary, keep offline backups, never share)
#   hs_ed25519_public_key   (binary)

mkdir -p ./tor-keys/myapp
cp /path/to/offline/keys/* ./tor-keys/myapp/
chmod 700 ./tor-keys/myapp
chmod 600 ./tor-keys/myapp/hs_ed25519_secret_key

docker compose up -d

Back up hs_ed25519_secret_key before the container runs. Losing it means losing your .onion address permanently, with no recovery.


Log Handling

Inside the container, Tor runs with SafeLogging 1 (IPs and .onion addresses scrubbed from output) and AvoidDiskWrites 1 (no log files written to disk).

The compose file sets logging: driver: none so Docker does not write a JSON log file on the host either. For debugging, keep the shipped file as it is and add a small override file that only restores logging:

# compose.debug.yml
services:
  tor:
    logging:
      driver: "json-file"
      options:
        max-size: "10m"
        max-file: "1"
docker compose -f docker-compose.yml -f compose.debug.yml up -d

Delete the override when you are done, and remove the log files it created.


What HiddenForge Cannot Protect You From

This container hardens the Tor layer. That is almost never the layer that gets an onion service located. The service is usually found because the application behind it told someone where it lives, and nothing in this image can stop that:

Leak What happens What to do
Backend makes outbound requests Your app fetches an avatar, a font, an update check, or sends error telemetry: directly, over clearnet, from the server's real IP. One request is enough. Keep the backend on the internal: network (the shipped compose does). Never add an outbound route "just for updates". Verify: from inside the backend, any internet connection must fail.
Absolute URLs / configured hostname The app emits https://realhost.example.com/... in a redirect, canonical tag, RSS feed, e-mail, or error page. Configure the app's public URL as the .onion. Grep rendered output for the real domain before going live.
Server / framework banners Server:, X-Powered-By, ETag formats, default error pages and admin paths fingerprint the exact host, which can be matched against a clearnet scan. Strip identifying headers; do not run the same fingerprintable stack on clearnet and onion.
Same content on clearnet and onion Trivially correlated by anyone scanning both. If it must exist on both, do not let them share favicons, ETags, analytics IDs, TLS certs, or timestamps.
Timestamps and locale Logs, generated files, and feeds leak the server's timezone, narrowing location. Run the backend in UTC.
Analytics / third-party assets Any CDN, font, or tracker call runs from the client, but a server-side render can run it from the server. Serve every asset locally.
The onion address itself Publishing it beside a clearnet identity links them permanently. Decide the linkage deliberately; it cannot be undone.

The host is also outside this container's control. A hidden service is only as anonymous as the machine hosting it: how it was paid for, provisioned, and administered. In a high-risk deployment, treat offline key generation and rootless Podman as required.


Time Synchronisation

Tor is sensitive to clock skew. If the host clock is more than ~30 minutes off, Tor will fail to build circuits. Run ntpd or systemd-timesyncd on the host and confirm it is synced before you start the container.

timedatectl status   # check sync status on systemd hosts

Rootless Podman (Recommended for High-Risk Deployments)

In rootless mode, container uid 0 maps to your regular host user through Linux user namespaces, so a container escape gives an attacker your user account, not root on the host. The full procedure, with the measurements behind it, is on the wiki: Rootless Podman.

The short version, on Ubuntu 24.04:

sudo apt install podman
sudo apt install --no-install-recommends docker-compose-v2   # without the flag apt also starts a root Docker engine
systemctl --user enable --now podman.socket
loginctl enable-linger $USER                                 # needed to come back after a reboot
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
$COMPOSE -p hiddenforge -f podman-compose.yml exec tor hiddenforge show --name myapp

What to know before you rely on it:

  • Use Docker Compose v2 on the Podman socket. podman-compose skips memswap_limit in every version and pids_limit before 1.1.
  • The Podman file drops DAC_OVERRIDE and FOWNER, so a root exec cannot traverse the tor-owned key directory. hiddenforge show, doctor and healthcheck switch to the tor user for the read by themselves. Do not add the capabilities back to make a permission error go away.
  • The <name>.onion file is written to the key volume under the Podman file too.
  • There is no healthcheck under Podman. Rootless Podman 4.9 never restarts a container that has one when no systemd user manager is reachable, and this container heals itself by exiting and being restarted.
  • restart: always is required, because Podman's boot service starts only always containers.

hiddenforge doctor reads the limits the container really has, so it tells you whether they apply to you:

hiddenforge doctor --container tor --keys ./tor-keys --json
podman info --format '{{.Host.Security.Rootless}}'   # expected: true

Security Architecture

Layer Mechanism
Minimal image DHI static base, unchanged, plus Tor, its libraries and one binary. No shell, package manager or interpreter; no setuid file
Syscall filtering Engine default seccomp profile, with Tor's Sandbox 1 stacked under it
Filesystem confinement Landlock: the supervisor confines itself after start-up; each helper gets a stricter domain with TCP denied, and a helper whose domain cannot be built is not started
Privilege drop Tor and the guard monitors run as uid 100 with no capabilities. The supervisor keeps only what republishing the address needs: measured CapEff 0xc2 under Docker, 0xc0 under rootless Podman, and no CAP_KILL
No-root mode (opt-in) setup --no-root: the container starts as uid 100 with no capabilities; nothing runs as root
Key encryption at rest (opt-in) setup --encrypt-keys: AES-256-GCM, scrypt-derived key, decrypted only into RAM
Client authorization (opt-in) client-auth add: Tor's restricted discovery; the descriptor is encrypted to the authorized clients' x25519 keys
No core dumps RLIMIT_CORE 0 and not dumpable for every HiddenForge process; DisableDebuggerAttachment 1 for Tor
Disk minimisation AvoidDiskWrites 1
Log scrubbing SafeLogging 1
DoS defence (rendezvous) HiddenServicePoWDefensesEnabled 1 per service
DoS defence (intro point) HiddenServiceEnableIntroDoSDefense 1 (rate 25/s, burst 200)
Circuit overload HiddenServiceMaxStreams 100, HiddenServiceMaxStreamsCloseCircuit 1
Guard protection Tor's vanguards-lite, pinned with VanguardsLiteEnabled 1 so a consensus parameter cannot switch it off, plus native bandguards and rendguard detectors. Opt-in full vanguards adds pinned layer 3 (by default L2 only; see the Security Model wiki page for the L3 limitation on long-lived services)
Key-volume tampering Privileged start-up chown/chmod refuse to follow symlinks out of the hidden-service directory
No relay or exit Relay code compiled out of Tor; ClientOnly 1, ExitPolicy reject *:*
Input validation All environment variables validated before the torrc is written
Supply chain Offline build from locked, signature-checked inputs; reproducible; zero known vulnerabilities from two scanners
Host isolation (optional) Rootless Podman: a container escape lands in an unprivileged host user

Tor version: 0.4.9.17 (3.0; 2.1.6 runs 0.4.9.15)

Documentation

Page What it covers
Wiki Quick start, the CLI, rootless Podman, verifying and reproducing the image
docs/INTEGRATION.md Using HiddenForge from another project; compose differences
docs/THREAT-MODEL.md What it defends against and what it does not
docs/CI.md What each CI job checks and when it runs
docs/DEPENDENCIES.md Every build input and how it is checked
docs/COMPLIANCE.md How it maps to NIST SP 800-190, 800-218, 800-53, 800-57, SLSA and CIS
docs/PRODUCTION-READINESS.md The release checks, what each one showed, and what was not tested
SECURITY.md Supported versions and how to report a vulnerability
CHANGELOG.md Every release

The input-integrity check runs nightly. Mutation testing of the Rust runtime runs on request.

License

HiddenForge is licensed under the GNU General Public License v3.0. See LICENSE.

About

Tor hidden service container with Vanguards on Alpine. Built for a state-level adversary threat model.

Topics

Resources

Security policy

Stars

33 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages