Secure Home Lab: expose services through a cloud edge#
This guide exposes services running on your home lab to the internet without opening any inbound port at home. A small cloud server (a “droplet”) runs PosternProxy as the public edge; it reaches your home services over a Tailscale private network; and you optionally place Cloudflare in front for a WAF, bot protection and DDoS absorption.
All addresses here use documentation-reserved values — example.com,
192.0.2.0/24, and Tailscale 100.x placeholders. Substitute your own.
Architecture#
Visitor
│ (public internet)
▼
[ Cloudflare ] optional edge: WAF, bot/DDoS, origin hiding
│ (origin pull)
▼
[ Cloud droplet ] PosternProxy controller + Caddy (the public edge)
│ (Tailscale, 100.x)
▼
[ Home-lab service ] no inbound ports open; reachable only on the tailnetThe home service never listens on the public internet. The droplet dials it over Tailscale, so your home network stays closed. The only public surface is the droplet, and Cloudflare (if used) sits in front of that.
Dropping the Cloudflare leg does not re-expose your home. Tailscale still protects the backends either way. Removing Cloudflare only changes the exposure of the droplet edge — see Choose your edge.
What you need#
- A cloud droplet: Debian 11/12 or Ubuntu 22.04/24.04, amd64 or arm64 (see Installation).
- A Tailscale account and tailnet, with the home service already reachable on it.
- A domain (
example.com) you control. - For the Cloudflare option: the domain’s DNS managed by Cloudflare.
1. Install PosternProxy on the droplet#
Follow Installation, then the first steps of the Quick Start (log in, change the admin password). Keep the management UI (port 81) off the public internet — you will reach it over Tailscale in step 2. See Security Hardening.
2. Join the droplet to Tailscale#
Install Tailscale on the droplet and bring it up:
curl -fsSL https://tailscale.com/install.sh | sh
sudo tailscale upAuthenticate with the printed URL. Confirm the droplet can reach a home service over the tailnet (replace with your service’s Tailscale IP and port):
curl -I http://100.64.0.10:8080Administer privately. Now that the droplet is on your tailnet, restrict port 81 to Tailscale and manage PosternProxy over the private network instead of the public internet (
ufw allow from 100.64.0.0/10 to any port 81).
3. Add the proxy host#
Add a proxy host that forwards to the service’s Tailscale address:
- Domain Names:
app.example.com - Forward Scheme:
http(orhttpsif the upstream serves TLS) - Forward Hostname / IP: the service’s Tailscale IP, e.g.
100.64.0.10 - Port: the upstream port, e.g.
8080
Caddy on the droplet now dials the home service over Tailscale. Leave TLS for the edge step below.
Choose your edge#
| Option A — Cloudflare in front | Option B — droplet direct | |
|---|---|---|
| Public WAF / bot / DDoS | Yes (Cloudflare) | None at the edge |
| Origin IP hidden | Yes | No — droplet IP is public |
| TLS | Cloudflare Origin Certificate | Let’s Encrypt on the droplet |
| Best for | Public, internet-scale services | Internal/sovereign use, or small public services you harden yourself |
Removing Cloudflare does not touch your home network; it only removes the shield in front of the droplet. For a host-level filtering layer when you skip Cloudflare, see Add a host-level WAF.
Option A — Cloudflare in front#
A1. Point DNS at the droplet (proxied)#
In Cloudflare DNS, add an A record for app.example.com → the droplet’s public
IP, Proxied (orange cloud). Traffic now flows through Cloudflare.
A2. Origin TLS with a Cloudflare Origin Certificate#
PosternProxy has no DNS-challenge integration, and a Let’s Encrypt HTTP challenge behind an orange-clouded proxy is fragile. Use a Cloudflare Origin Certificate:
- In Cloudflare: SSL/TLS → Origin Server → Create Certificate. Save the certificate and private key.
- In PosternProxy: Custom Certs → Upload Certificate, upload both, and select it on the proxy host’s SSL tab. See Certificates.
- In Cloudflare: set SSL/TLS mode to Full (Strict).
A3. Recover the real visitor IP#
So access lists, rate limits and logs see the visitor and not Cloudflare, set the server’s trusted proxies to the Cloudflare preset:
- Security → Trusted Proxies → Edit beside the droplet.
- Source: Cloudflare. Apply snapshot or Refresh from source.
- Confirm the header is
CF-Connecting-IP, then Save.
See Trusted Proxies.
A4. Lock the origin to Cloudflare#
An IP allowlist alone does not stop someone hitting the droplet IP directly and bypassing the WAF. Close that path:
- Cloud/host firewall: allow inbound
80/443only from Cloudflare’s published ranges; keep81(management) and SSH restricted to Tailscale. - Access list: add an access list in Connection source mode allowing only Cloudflare ranges, and select it on the host. This matches the connecting peer (the CDN edge), not the visitor IP.
Correct forwarding headers alone do not prevent direct-origin bypass. Enforce the origin lockdown above (firewall + connection-source access list), and prefer Cloudflare authenticated origin pull where your threat model needs it. See Security Hardening.
Option B — droplet direct (no Cloudflare)#
B1. DNS and TLS#
Point app.example.com directly at the droplet’s public IP (a plain A record).
On the proxy host’s SSL tab, turn Force HTTPS on — Caddy obtains a Let’s
Encrypt certificate automatically (public DNS and inbound port 80 required).
B2. Trust no forwarded headers#
The droplet now faces visitors directly, so it must not trust any forwarding header: Security → Trusted Proxies → Edit, choose Custom (manual), clear the ranges, and Save. Empty ranges trust no proxy, so the client IP is the true socket peer.
B3. Harden the edge#
The droplet is now the whole attack surface:
- Firewall:
80/443open to the world;81and SSH restricted to Tailscale. - Keep per-host rate limits and fail2ban on (the installer configures fail2ban by default).
- Put an access list in front of anything sensitive — or keep it tailnet-only and don’t publish public DNS at all.
Smallest attack surface: don’t publish public DNS for private apps at all. Reach them over Tailscale directly, or restrict the host to your tailnet with a Connection-source access list. This is the most secure home-lab setup.
Optional: add a host-level WAF#
PosternProxy does not bundle a WAF. Without Cloudflare (Option B), you can add a host-level filtering layer on the droplet with CrowdSec, which bans known-bad IPs at the host firewall based on log analysis.
Only when the droplet is the direct edge. A firewall bouncer bans the connecting IP. Behind Cloudflare (Option A) the connecting IP is Cloudflare’s edge, so a firewall ban would block the CDN, not the attacker — rely on Cloudflare’s own WAF there instead.
A minimal install on the droplet, following the current CrowdSec documentation for your OS:
# After installing the CrowdSec engine, add the firewall (nftables) bouncer:
sudo cscli bouncers add home-edge
sudo apt-get install crowdsec-firewall-bouncer-nftablesCrowdSec needs a log source. Caddy access logging is off by default in the beta, so point CrowdSec at the system auth log and PosternProxy’s fail2ban signals, or enable a log source for it. Keep an allowlist for your admin and Tailscale ranges.
For a multi-server or production deployment, see CrowdSec remediation (enterprise). A native request WAF is available on each proxy host. Open the host, choose Security, and enable WAF. Detection logs matched rule IDs in the Caddy journal and does not block. Blocking denies requests the OWASP Core Rule Set marks. The ruleset is the one shipped with this PosternProxy version. See Web Application Firewall. CrowdSec remains the choice for IP reputation; it does not inspect request bodies.
4. Verify#
# Option A (through Cloudflare) or B (direct):
curl -I https://app.example.comYou should get your upstream’s response. If not:
- 502 / 503: the droplet cannot reach the upstream. Confirm
tailscale statuson the droplet and that the service answers on its Tailscale IP:port. - Cloudflare 52x: origin TLS mismatch — check the Origin Certificate and that SSL/TLS mode is Full (Strict).
- Connection refused / timeout (Option A): the origin lockdown is working, but your firewall may be blocking Cloudflare — verify the allowed ranges.
- Check configuration application status on the server after any change.