Article

Schlagbaum - Securing our home network perimeter

I am a longtime listener of the great Security Now podcast, and these days many security topics are directly related to AI. The time between a vulnerability’s disclosure and a working exploit keeps shrinking, and LLMs now help attackers at every stage of the attack cycle.

Arguably, the best way to secure a home network is to not expose any internal tools to the internet at all, and to use Tailscale or another kind of VPN instead. That would work great for me, but not for the whole household: a phone can only run one VPN at a time, and we often use Proton VPN.

A cute 3D cartoon mouse wearing glasses standing next to a yellow and white striped security barrier.
Our “Zipfelmaus” mascot watches over the gate, which helped a lot with household approval.

So I tried Cloudflare Zero Trust in the past, and I also hosted my own Pangolin instance with CrowdSec. Cloudflare felt too complicated for what I needed, and I didn’t like that it terminates TLS and sees all traffic in plain text. Pangolin was simple until it went down the path of all software that is built for a living: it acquired a lot more features like an AI gateway, uptime monitoring and overlay networking. That's kind of neat for a company, but every extra feature is another way for the software to become insecure. I don’t need that feature set, and I don’t want to maintain and trust code I never use. On top of that, the CrowdSec challenge blocked my browser automation, and my static sites went down whenever the home server did.

So I decided to build my own reverse proxy with passkey pre-authentication and geo-blocking on a tiny netcup VPS pico called Schlagbaum (German for "barrier gate"). The idea: my spouse and I authenticate via WebAuthn to this proxy, which sits behind a Caddy web server. Only then does it open the gates to the kingdom and route traffic into my home network, to my containers. Apps that can’t do passkeys get a per-device token instead (more on that below).

How a request travels through Schlagbaum: static sites never leave the VPS, and apps only open after the country check and a passkey or device token.
How a request travels through Schlagbaum: static sites never leave the VPS, and apps only open after the country check and a passkey or device token.

Caddy also serves my static sites straight from the VPS, so they stay up even when the home server is down.

I ended up using Tailscale after all, just not as a VPN for the family: the link from the VPS into my home network is a Tailscale tunnel. Schlagbaum embeds it as a library (tsnet), so the VPS runs no Tailscale daemon, and the log upload to Tailscale is switched off in code.

Apps that can’t do passkeys, like Jellyfin or RSS readers, get a long random per-device token in the URL. I can revoke each one, and it is stripped before forwarding and never logged.

It's a very small Go program with three direct dependencies: one for WebAuthn, one for the GeoIP database and tsnet. Granted, tsnet brings a long tail of indirect dependencies, but it is still a very small concept to understand, and hopefully a very small attack surface. The VPS node may only reach the home Caddy on a fixed port, so a compromised VPS doesn’t get the whole network, and the apps behind it still have their own logins.

The VPS itself is a 1 GB Alpine box provisioned with Ansible. It installs new Schlagbaum releases / Alpine packages daily, verifies their checksums, and rolls back automatically if the health check fails.

Is it more secure than Pangolin? I don't know, maybe. It's definitely cuter and simpler to use. It's so much simpler that it's far easier for me to reason about and to review for security problems, and I fully understand what happens under the hood. Will it stop a targeted attack? Probably not. Being non-standard might also help it slip past the scanners that make up the internet’s background radiation, though that’s a bonus, not a defense.

An added bonus: small side projects that are done in a few days are always a lot of fun. Okay, I have to merge Dependabot updates and take care of patching myself, but hey, that's the price of rolling your own stuff.

  • self-hosting

Replies

To reply from the fediverse, follow @robert@rocu.de or look up the address of this post from your account.