Self-Hosted Zero Trust – A Journey, Not a Masterclass
Part 1 – How I ended up running Pangolin, CrowdSec and k3s
I've been working in IT for more than 35 years, and somehow it still hasn't stopped being a hobby. My homelab is probably the best evidence of that.
What started as a simple self-hosted environment has gradually turned into something more interesting: a combination of Pangolin, Traefik, CrowdSec and k3s, running on a relatively inexpensive VPS and connected to services in my home network.
Getting there wasn't always easy. Some things worked surprisingly well. Others kept me busy for evenings that I had originally planned to spend doing something completely different. If you run a homelab, you probably know the feeling.
This is the first in a series of articles about that journey. It's not a reference architecture, and it certainly isn't a Kubernetes masterclass. I simply want to share some of the things I've learned along the way, including the mistakes.
The problem with exposing services
Running a service at home is easy enough these days. A container, a volume, a few environment variables, and you're usually up and running.
Making that service available from outside your network is where things get interesting. For years, the usual approach was something like this:
- Forward a port on your router.
- Set up a reverse proxy.
- Get a TLS certificate.
- Add authentication if the application needs it.
And it works. But as the number of services grows, so does the number of things you need to maintain and protect.
What happens if an application has an authentication vulnerability? What about an administration interface that was never really intended to face the internet? And how much unwanted traffic is reaching those services in the first place?
I wanted an alternative that wouldn't require opening incoming ports at home for the applications I wanted to access remotely. I also didn't want to connect to a conventional VPN every time I needed to access a web application.
That's where Pangolin came into the picture.
Enter Pangolin
Pangolin is a self-hosted remote access platform built around tunnels, identity-aware access and a reverse proxy.
The idea is simple. You run a gateway on a publicly reachable machine, and a connector inside your private network establishes an outbound connection to it. Your applications stay where they are.
In my case, the picture looks like this:
Internet | Public VPS (k3s) +-----------------------------------------+ | Traefik <-> CrowdSec + AppSec | | Pangolin | | Gerbil | | Forgejo, inbuxa | +-----------------------------------------+ ^ | WireGuard tunnel (outbound from home) | +-------------+ | Newt | +-------------+ | Home network | Private applications Newt establishes the tunnel from inside the network. There's no need to forward incoming ports on the home router for these tunneled resources. For this setup, the public HTTPS and tunnel endpoints live on the VPS, not at home.
Depending on the application, I can decide whether it should be publicly accessible, require authentication at the gateway or remain a private resource. For web applications exposed through the gateway, a browser is enough. For private network resources, Pangolin also offers a client – but that's not something I need for every web application.
That distinction matters. My Git server, for example, has different requirements from an internal administration interface. Treating every application in exactly the same way would make the system either unnecessarily restrictive or unnecessarily exposed.
A word on "Zero Trust"
I use the term in a practical sense, not as a NIST 800-207 checklist. No application is trusted just because a request comes from a particular network. Each resource gets its own access policy, and none of my remotely exposed homelab services require incoming ports to be opened on my home router.
It isn't perfect. The VPS terminates TLS, so it's a component I have to trust – and so is the provider it runs on. Being clear about where trust remains is, I think, more useful than pretending there is none.
A gateway is not a complete security solution
Pangolin solved an important part of the problem for me, but it didn't make unwanted internet traffic disappear. Public services still attract scanners, crawlers, bots and automated exploitation attempts.
Anyone who has looked through reverse proxy logs on a public server will recognise this:
GET /.env GET /.git/config GET /wp-login.php GET /xmlrpc.php It doesn't particularly matter whether you're running WordPress. Someone will still come looking for it.
Most of these requests are simply background noise on today's internet. Some are attempts to exploit known vulnerabilities. Either way, I'd rather not have my applications spend resources dealing with them.
That's why I added CrowdSec. CrowdSec analyses logs, identifies suspicious behaviour and shares threat intelligence. Its enforcement components, called bouncers, then act on the resulting security decisions.
Later, I added CrowdSec AppSec, which inspects HTTP requests before they reach an application. The two approaches complement each other: one looks at behaviour and reputation, the other examines the request itself.
But there's an important distinction I didn't fully appreciate at the beginning: blocking a malicious request and banning an IP address are not necessarily the same thing.
I'll come back to that in a later article.
Why k3s?
My Pangolin stack originally ran with Docker Compose. There was nothing fundamentally wrong with that, and I still use containers outside Kubernetes where it makes sense.
Over time, however, I wanted a more consistent way of managing the growing number of components, persistent data, configuration changes and upgrades. I eventually moved the stack to k3s, a lightweight Kubernetes distribution.
Before anyone closes this article because I mentioned Kubernetes: no, you don't need Kubernetes to run Pangolin or CrowdSec. Docker Compose may be perfectly sufficient for your needs.
For me, k3s was an opportunity to consolidate the infrastructure and learn something new. Helm became the way to manage the deployment, and over time the configuration became increasingly reproducible.
The important part isn't Kubernetes itself. It's being able to explain what is running, why it's running, and how to recover it when something goes wrong.
And something will go wrong eventually.
When your security system blocks you
One of the more memorable lessons came from CrowdSec: at one point, it banned my own IP address.
The trigger was a generic HTTP detection scenario, LePresidente/http-generic-403-bf, that treated repeated HTTP 403 responses as suspicious behaviour. CrowdSec was doing exactly what it had been configured to do – but the assumptions behind that configuration weren't right for my environment.
A 403 doesn't necessarily mean someone is attacking your service. It can also be generated by an access policy, an authentication layer or a security component that is temporarily unavailable. In a layered security architecture, there are quite a few places where that can happen.
The obvious quick fix would have been to allowlist my own IP. That would have stopped the bans, but not the underlying problem: any legitimate user running into an access policy could hit the same pattern.
Instead, I removed that particular scenario and moved towards a more selective remediation strategy based on what had actually been detected, rather than simply on the HTTP status code.
It was a useful reminder that adding another security rule is easy. Understanding how that rule interacts with everything else takes considerably more effort.
Sometimes removing a rule makes the system better.
What I'm running today
At the time of writing, the main components of my gateway are:
| Component | Runs on | Purpose |
|---|---|---|
| Pangolin | VPS | Remote access and application access policies |
| Gerbil | VPS | Tunnel endpoint for connectors |
| Newt | Home network | Outbound connector to the gateway |
| Traefik | VPS | Reverse proxy and TLS handling |
| CrowdSec | VPS | Behaviour-based detection and IP reputation |
| CrowdSec AppSec | VPS | HTTP request inspection and protection |
| k3s | VPS | Container orchestration |
| Helm | – | Deployment and configuration management |
Versions at the time of writing (November 2026): Pangolin EE 1.27.1, Traefik 3.8.0, CrowdSec 1.8.2 and k3s v1.36.5+k3s1.
The VPS is a Hetzner machine with 8 virtual CPUs and 16 GB of RAM. It doesn't just run the gateway – it also hosts Forgejo and inbuxa, a mail and groupware server I contribute to. Both deserve their own articles.
Not every component is necessary for every installation. I wouldn't suggest starting with the entire stack on day one.
Start with the problem you actually have.
What I'd like to share in this series
Over the coming articles, I'd like to look at:
- Getting started with Pangolin.
- Integrating CrowdSec without making the setup unnecessarily complicated.
- Understanding AppSec, WAF blocks and IP bans.
- Moving from Docker Compose to k3s, if that makes sense for you.
- Backups, upgrades and recovery.
- Running applications such as inbuxa behind the gateway.
I'm also working towards making my Helm chart easier for others to use. The current chart has grown alongside my infrastructure. It contains quite a few things that make sense in my own environment, but wouldn't necessarily make sense for someone deploying Pangolin for the first time.
I'd like to change that. Ideally, getting started should require a small configuration file and a Helm command, not an evening spent understanding several hundred lines of YAML. The advanced options can still be there for those who need them.
A final thought
Much of what I've learned over the years came from people who took the time to document their work, explain a problem in a forum or publish a solution that saved me hours of troubleshooting.
This series is my attempt to give a little of that back.
I'm not claiming to have found the perfect way to secure self-hosted infrastructure. There are other approaches, and some will undoubtedly be better suited to your environment.
But if something I learned the hard way saves somebody else an evening of troubleshooting, writing these articles will have been worthwhile. And if you've found a better way of doing something, I'd genuinely like to hear about it.
That's what a community is for.
Further reading
Next in this series: Getting started with Pangolin – and why you don't need to expose your entire homelab to the internet.

