Notes

Home-lab security: do the few things that prevent most incidents

The realistic risk for a home AI server is exposure, weak passwords, stale images and missing backups. Work through exposure, auth, secrets, containers, segmentation, backups and incident response.

Threat model: you are an ordinary target

A home lab rarely faces a custom attack. The common cases are:

  • a public scanner finds a service with no authentication;
  • a container image is months old and carries a known issue;
  • a password is reused, or an admin port is exposed;
  • a disk fails, or data is deleted, before anyone checks a backup;
  • a test environment keeps its debug endpoint open.

This does not mean advanced attacks do not exist. It means fixing cheap mistakes pays more than chasing a complex design.

Exposure: if a port is not needed, do not open it

  • Prefer Tunnel or a VPN over inbound port forwarding.
  • If a port is unavoidable, open only what is needed, restrict sources, isolate the service.
  • Do not expose router, NAS, Proxmox or Docker admin interfaces.
  • Make services listen on internal addresses; use a reverse proxy or tunnel for public access.
  • Keep a list per public service: hostname, port, auth method, owner, last update.

Quick checks:

ss -tulpn | sort -k5
nmap -Pn -p- your-public-ip   # run from another machine

An external scan is more reliable than “I think it is closed”.

Authentication and authorisation

  • Enable MFA on admin services; disable password login where possible.
  • Use a different password per service and a password manager.
  • Create separate tokens for automation, with limited scope and expiry.
  • Entrance auth and application auth are different: Access protects the door, not the app’s roles.
  • Remove unused accounts and tokens on a schedule.

Secrets

  • Never commit .env, private keys or Cloudflare tokens.
  • Use the runtime’s secret mechanism rather than baking keys into an image.
  • Inject via environment or mounted files with tight permissions.
  • Split tokens by purpose: read-only, write-only, single resource.
  • After a leak, rotate first, then investigate; deleting the commit is not enough.

Host and containers

  • Pull from trusted sources; pin versions or digests instead of betting on latest.
  • Run containers as non-root and drop unneeded capabilities.
  • Mount only the directories that are needed; never mount / or the Docker socket casually.
  • Set resource limits so one model cannot take down the host.
  • Update base images and applications; read the notes before updating, verify after.

Minimum checklist:

  • Image versions are pinned and you can explain why.
  • Containers are not root, or have no extra privileges.
  • Data directories are backed up and have been restored once.
  • Logs do not contain tokens, passwords or full request bodies.
  • Public ports have authentication; admin ports are not public.

Network segmentation

Split devices into at least three groups:

  1. Work/personal: laptops, phones.
  2. Lab/servers: models, containers, NAS.
  3. IoT/guests: cameras, TVs, visitor devices.

Use VLANs or separate SSIDs where possible; otherwise firewall rules that restrict cross-network access. IoT devices update slowly and should not reach server admin ports.

Backups: a backup that was never restored is a hope

  • At least two copies, one offline or immutable.
  • Restore one on a schedule; record duration and missing pieces.
  • Cover config, databases, model files, certificates and keys.
  • Never keep every copy on one disk, one machine or one account.
  • Verify integrity so the backup itself is not corrupt.

A simple 3-2-1 variant: local copy, NAS copy, offline disk or object storage copy.

Logs and alerts

  • Record failed logins, permission changes, config changes and backup results.
  • Do not record passwords, tokens, identity documents or full chat content.
  • Set retention so logs do not grow forever.
  • Keep alerts few and precise: disk full, backup failed, certificate expiring, service down.
  • Read the logs occasionally so alerts do not become noise.

Incident response: stop the bleeding first

When something looks wrong:

  1. Isolate: cut the network or close the entrance; preserve evidence.
  2. Scope: which accounts, tokens and data may be affected.
  3. Rotate: passwords, API tokens, SSH keys, cookie secrets.
  4. Restore: from a verified backup, and check that no backdoor came back.
  5. Review: timeline, root cause, improvements, owner.

Do not investigate while the service is still exposed, and do not restore without rotating credentials.

Pre-launch checklist

  • Only required public entrances; admin ports are internal.
  • MFA on admin accounts; passwords are unique.
  • Image versions pinned; updates recorded.
  • Secrets not in Git or image layers.
  • Backups exist and have been restored.
  • Logs exclude sensitive data; retention defined.
  • A written “who to call, what to do first” flow exists.

Related notes

Email is the only channel. Questions, corrections or a scope request: [email protected]. This page also exists as Markdown: /security.md.