Skip to content

Security: metharda/tor-exit-node

Security

docs/security.md

Security

What this project protects, what it doesn't, and how secrets are handled. The mechanisms are described in architecture.md.

Threat model

It protects:

  • Your IP address from the sites you visit. They see a Tor exit, never the device's or the KVM host's address. Only TCP is carried.
  • Your DNS. Lookups are resolved through Tor, not by your ISP, your local network or the KVM host's resolver.
  • Your traffic from the local network you're on. The device only talks WireGuard to your tailnet; the exit node is reached directly or through Tailscale's DERP relays.
  • Your activity from the KVM host's ISP. It sees Tor traffic from the VM, plus the VM's own Tailscale, update and time-sync connections.

It does not protect:

  • Your identity in the browser. Cookies, logins, browser fingerprinting and WebRTC still identify you. Use Tor Browser for that.
  • Unencrypted traffic from the exit relay. A Tor exit can read plain HTTP. Use HTTPS.
  • Metadata at Tailscale. The coordination server knows which of your devices exist and that they use this exit node, not what they send.
  • Anything against an attacker who controls the KVM host or your tailnet admin account. They can change or watch the VM.
  • UDP applications. They don't work at all while the exit node is selected; they aren't leaked.

Leak guards

Risk Guard
Client traffic forwarded with the VM's real IP TOR_FORWARD rejects anything a client sends that wasn't redirected; tailscaled adds no NAT/forward rules (--netfilter-mode=off); UFW's routed policy is deny.
Client DNS bypassing Tor Client UDP 53 to any server is redirected to Tor; MagicDNS queries are answered by the VM's resolver, whose UDP 53 is redirected to Tor.
DNS over TCP Blocked from the VM. Client TCP to port 53 is carried through Tor like any other TCP.
Tailnet DNS settings (e.g. a DNS-over-HTTPS provider) applied on the exit node --accept-dns=false: tailscaled doesn't apply them to the VM.
IPv6 Disabled on the VM; anything forwarded from tailscale0 is dropped.
Tor down Redirected connections are refused and DNS gets no answer. Nothing falls back to direct.
Firewall service stopped The redirects go, the guards stay, so client traffic is dropped.
Repairs while Tor is broken The node is taken off the tailnet first (tailscale down), then repaired.
Tor ports used as an open proxy TOR_INPUT and UFW only admit loopback and tailscale0; SocksPolicy adds a second check.

make verify checks most of these on the running node; see operations.md.

Hardening

  • SSH: key-only (ED25519 key generated by Terraform), AllowUsers the admin user, root password locked, fail2ban on sshd. The configuration is validated with sshd -t before it is installed.
  • Firewall: UFW denies incoming connections except SSH, Tailscale (UDP 41641) and the tailnet interface.
  • Updates: unattended security upgrades.
  • Kernel: IPv6 disabled; ICMP redirects off; loose reverse-path filtering; SYN cookies.
  • Tor container: non-root, read-only root filesystem, all capabilities dropped, no-new-privileges, Docker's default seccomp profile.

Secrets

Secret Where it lives
Tailscale auth key Passed to Ansible via TS_AUTHKEY, used once with logging disabled, never written to cloud-init, the inventory or the VM's disk. Only needed until the node joins.
VM console password Terraform state, and the cloud-init ISO in the VM's storage pool on the KVM host. SSH doesn't accept it.
SSH private key terraform/vm_key (mode 0600) and Terraform state.

terraform/terraform.tfstate and terraform/vm_key are git-ignored. Keep the checkout on the deploying machine private, and revoke auth keys you no longer need in the Tailscale admin console.

Prefer a non-ephemeral, tagged auth key for a permanent node, and restrict who may use exit nodes with your tailnet policy.

There aren't any published security advisories