Desk
File SH-LAB/01Class: Restricted Public

Security assessment

Raspberry Pi 5 homelab

Subject
sh_lab, one Raspberry Pi 5
Exposure
0 inbound ports · 0 forwards
Access
WireGuard key per device · Tailnet Lock
Watch
Prometheus → Alertmanager → phone
Recovery
Checksummed backups, restore steps
Findings
3 incidents, each closed with proof
Public IP
redacted
LAN range
redacted
Prepared by D. PournatzisPage 1 / 7

Routing slip · SH-LAB/01

To: whoever opens this
From: Dimitris Pournatzis

A homelab, declassified.

One Raspberry Pi 5. No open ports. Six layers between the internet and a service, and every incident closed with proof.

Raspberry Pi 5, top view Technical drawing of the Raspberry Pi 5 that runs sh_lab, with four numbered callouts: the Ethernet port, the BCM2712 processor, the activity LED, and the microSD slot on the underside. ETH BCM2712 4 × A76 · 2.4 GHz µSD PWR ACT SH_LAB · PI 5 REV 2026.11
  1. 1Ethernet Tailnet only. No ports are forwarded, so nothing here answers the open internet.
  2. 2BCM2712 Runs every service as a hardened container on its own network.
  3. 3Activity LED Prometheus watches each service, and alerts reach my phone.
  4. 4microSD, underside Backups leave the board for a separate device and are checked by checksum.

Fig. 1 · Top view, illustrative. Dashed outlines sit on the underside.

Hardware
Raspberry Pi 5
Inbound ports open to the internet
0
Layers of defense
6
Alert path
Tested end to end
Largest repair
29,048 paths

Stack-up

Six layers between the internet and a service.

Read it like a cross-section of a circuit board. Traffic from the internet stops at the first layer. A request from one of my own devices passes every control on its way to a service, and the last layer filters the lookups that go back out.

  1. L1

    Network edge

    No ports are forwarded on the router, so nothing on the Pi answers the open internet. A scan from outside finds nothing to talk to.

    Router · zero port forwards

  2. L2

    Private mesh

    Tailscale connects my devices over WireGuard, each with its own key. Tailnet Lock is on, so a new device can’t join until a device I already trust signs it.

    Tailscale · WireGuard · Tailnet Lock

  3. L3

    Service access

    Services listen on localhost. A reverse proxy serves them over HTTPS inside the mesh and renews its own certificates.

    Reverse proxy · automatic TLS

  4. L4

    Host firewall

    UFW allow-lists each Docker subnet for only the ports it needs. SSH is accepted over the tailnet and refused from the local network.

    UFW · per-subnet rules

  5. L5

    Segmentation

    Monitoring, proxy, and application containers sit on separate Docker networks. One compromised container can’t reach unrelated ones.

    Docker bridge networks

  6. L6

    DNS, on the way out

    Pi-hole filters lookups for every device on the network. Unbound resolves recursively and validates DNSSEC.

    Tested Queried domains with valid and deliberately broken signatures. The resolver rejected the broken ones.

    DNSSEC CHECK · 2026-11-24
    ---------------------------------
    $ dig dnssec-failed.org
      status  SERVFAIL     rejected
    $ dig +cd dnssec-failed.org
      status  NOERROR      checks off
    $ dig +dnssec ietf.org @unbound
      flags   qr rd ra ad  validated
    ---------------------------------
    resolver  Pi-hole → Unbound

    Pi-hole · Unbound · DNSSEC

Monitoring

When something breaks quietly, my phone finds out.

Metrics and logs from the host, the containers, and each service flow into one place. Rules decide what counts as broken, and alerts arrive without anyone watching a dashboard.

Sources

  • Host exporterCPU, memory, disk, temperature
  • Container metricsPer-container usage
  • App exportersDNS and service metrics
  • Endpoint probesDoes it answer?
  • LogsHost and containers

Collect

  • PrometheusStores metrics, evaluates alert rules
  • Loki + AlloyShips and indexes logs

Route & view

  • AlertmanagerGroups alerts and routes them
  • GrafanaHost, container, and DNS dashboards

Reach

  • My phonePush notification on failure and recovery

Answering is not the same as working.

Probes ask whether each endpoint responds. A separate rule checks that the metrics I expect are arriving, because an exporter can stay reachable while the data behind it disappears. That happened once.

The alert path is tested too.

I sent a synthetic alert through Alertmanager and confirmed it arrived on my phone. A rule that fires into a broken delivery pipeline protects nothing.

ALERTMANAGER · NOTIFICATION
---------------------------
[FIRING:1] synthetic test
instance    [redacted]
severity    test
route       phone (push)
---------------------------
delivered   yes
resolved    yes

Hardening

Every container starts with nothing and asks for what it needs.

The same pattern repeats across my Compose files. It’s applied wherever the image supports it, and exceptions are added back by name.

compose.yamlsanitized excerpt

services:
  exporter:
    image: example/exporter
    user: "1000:1000"             1
    read_only: true               2
    cap_drop: [ALL]               3
    security_opt:
      - no-new-privileges:true    4
    networks: [monitoring]        5
    secrets: [scrape_token]       6
  1. 1

    Unprivileged user

    The process runs under a mapped UID and GID instead of root.

  2. 2

    Read-only root filesystem

    Nothing can rewrite the image at runtime. Paths that must be writable are mounted on purpose.

  3. 3

    No Linux capabilities

    Everything is dropped first. A service that needs one gets it back with an explicit cap_add.

  4. 4

    No privilege escalation

    Processes can’t gain privileges after start, even through setuid binaries.

  5. 5

    One network

    The container joins only the bridge it needs, which keeps lateral movement short.

  6. 6

    Secrets as files

    Tokens are mounted read-only and never written into version-controlled config. Prometheus reads its scrape token from a file.

Reviewed updates. Stateful services are excluded from automatic image updates. Upgrades to anything that holds data get read, backed up, and applied by hand.

Parts list

What runs on the board.

Open-source tools, each with one job. Reference designators group them the way a bill of materials would.

RefPartJob
Network and DNS
NET-1TailscaleEncrypted mesh between my devices, and the only way in from outside the house.
NET-2Pi-holeFilters DNS for every device on the network.
NET-3UnboundResolves recursively and validates DNSSEC, with no third-party resolver.
NET-4UFWHost firewall with per-subnet allow rules.
NET-5Reverse proxyHTTPS for internal web apps, with automatic certificate renewal.
Platform and automation
SYS-1Raspberry Pi 5Runs Raspberry Pi OS and every workload in the lab.
SYS-2Docker ComposeDeclares each service with its networks and hardening.
SYS-3systemd timersRun recurring jobs and record whether they succeeded.
SYS-4Shell scriptsAutomate maintenance and report the outcome.
SYS-5rsyncCopies backups off the board and retries pending transfers.
SYS-6GitHistory for configuration and runbooks.
Observability
OBS-1PrometheusScrapes metrics and evaluates alert rules.
OBS-2AlertmanagerGroups alerts and pushes them to my phone.
OBS-3GrafanaDashboards for the host, containers, and DNS.
OBS-4Loki + AlloyCollect and search host and container logs.
OBS-5Exporters and probesMeasure host health, application metrics, and whether endpoints respond.

Incident reports

Things that broke, and how I proved they were fixed.

Each fix ends with a check I could observe, not with the first change that looked right.

IR-01

Monitoring and detection

Verified

A healthy scrape hid missing data.

Symptom
Prometheus could reach the exporter and the scrape looked healthy, but the application metrics a dashboard needed were gone.
Diagnosis
I compared scrape health with the series the dashboard relied on, then traced the gap through the exporter’s logs.
Fix
Restored collection, then added an alert for expected metrics that go missing while the exporter is still reachable.
Alert rule test
InputExpectedObserved
Metric present with a real zeroStays quietQuiet
Series missing, exporter upFiresFired
Data restoredClearsCleared

IR-02

Linux recovery

Verified

Repaired ownership on 29,048 system paths.

Symptom
File ownership across system paths was wrong, and scheduled jobs had stopped running.
Approach
I rebuilt the expected ownership from package archives that matched the installed versions, then reviewed local exceptions by hand.
Verification
Checked every planned path, confirmed file contents were preserved, and watched a normal scheduler run complete.

29,048paths re-owned and checked

0reboots needed

IR-03

Backup automation

Verified

Backups kept missing their destination.

Symptom
Backups finished locally, but their copies often missed the window when the destination device was online.
Fix
Added a scheduled retry job that sends pending archives and skips copies that already exist.
Verification
Compared checksums on both sides, opened selected archives, and added a metric for the last successful transfer. Restore steps for each service live in a runbook.
  1. PackageData and config archived
  2. Store locallyCopy on the Pi
  3. TransferRetries until delivered
  4. VerifyChecksums match

Each stage reports its own last success, so a healthy local backup can’t hide an overdue transfer.

Known gaps

What this setup doesn’t cover.

Every report above is closed, but the lab still has limits. These are the ones I know about.

  1. GAP-1

    Physical access

    The board sits in my home. Anyone who can touch it can pull its storage, so everything on this page assumes the room is controlled.

  2. GAP-2

    Tailscale’s service

    Remote access depends on Tailscale for coordination and relays. Tailnet Lock stops its servers from adding a device on their own, but an outage on their side can still cut off remote access.

  3. GAP-3

    Upstream images

    Containers run images built by their own projects. Hardening limits what a bad image could do. It doesn’t prove an image is clean.

  4. GAP-4

    Storage wear

    Flash storage wears out under constant writes. Backups leave the board, but a failed card or drive still means downtime until a restore.

  5. GAP-5

    One board

    There is no failover. If the Pi fails, every service is down until it’s replaced.