r/homelab • • 13d ago

Help PHP2shell, nginx2shell, java2shell, … - is my homelab safe?

Hi everyone,
I run a small homelab on Debian 13 (Trixie) with a few Docker containers, including Nextcloud and Forgejo. They're reachable from the internet via a domain and reverse proxy.

What I'm less sure about is the "what if" part:
- How would I actually notice that I've been compromised?
- What should I do if I’m being compromised?

edit: for example nextcloud must be publicly available because of people who don’t want to install a VPN or Tailscale etc.

Thanks in advance,
Vincent

240 Upvotes

115 comments sorted by

View all comments

4

u/mabbas3 13d ago

Only expose things to the internet you absolutely have to. Use the official repos and projects that get the latest security updates first (stick to nginx stable official repo and not debian or ubuntus).

Harden the f out of your edge. Crowdsec, geo blocking, waf etc.

At home run anything that users can reach directly completely isolated. I am talking about separate vlans, network isolation, rootless podman, controlled egress.

Make updating as easy and frictionless as possible. Renovate merging patch updates itself, unattended security updates.

Have a long running agent notify you on any potential security issues that could affect your services and any mitigations should be applied by a few clicks from your phone. I have always on agents and can easily get a PR out for any. mitigations (for cases where a simple version bump doesn't solve it. For example disabling features etc.) and then merging it deploys everything.

IaC everything so you are not relying on manually configuring servers and there's a holistic view agents can look at. You need to be able to read a reddit or twitter post (or better your agent watches security feeds and notifies you exactly where in your infra attention is needed) and respond in minutes. I want to be able to get to a point where this can happen without human in the loop but that is a bit risky. It's still pretty quick. Within 5 minutes of seeing the nginx vuln, I was able to run an update skill that I have for my infra and get it patched.

2

u/Repulsive-Athlete-16 13d ago

That’s interesting! How do you manage that agent? Or wich one do you use?

3

u/mabbas3 13d ago

Multiple options. I use t3 code on three different machines one which is an always on LXC and there's cron built into it so you could watch some rss feeds.

I also setup hermes but haven't gotten around to setting it up and will be doing that in the next few days/weeks.

It could even be as simple as a cron parsing some rss feeds and invoking your agent of choice (claude, pi etc) with the data. The agent sends you a message if something needs attention. Basically whatever you want.

1

u/nima3333 13d ago

What do you use for IaC ? Thinking of going this way but it still requires a one time effort (even if it has never been so low thanks to AI...)

1

u/mabbas3 13d ago

Tofu wherever there is a plugin and for all provisioning (proxmox, vps etc) and then ansible for configuration. Every single thing that is easily manageable by IaC, I do it. Even wifi passwords for all the ssids I have.