Skip to content

Latest commit

 

History

History
330 lines (257 loc) · 24.8 KB

README.md

File metadata and controls

330 lines (257 loc) · 24.8 KB

Patchdeck

Patchdeck

The agentless patch dashboard for your homelab.
Scan, apply, reboot, and schedule updates across your Debian, Ubuntu & Proxmox boxes — over plain SSH, from one self-hosted pane of glass.

Quick Start · Features · Configuration · API · Development

Build Latest release Container image Go License


Keeping a homelab patched is death by a thousand ssh box && sudo apt update && sudo apt upgrade. Patchdeck gives you one place to see what needs updating across every box — your Proxmox nodes, VMs and LXC containers, your Raspberry Pis, that NUC in the closet, bare metal, anything you can reach over SSH — and to actually do something about it.

It's agentless: nothing to install on your hosts, no daemon phoning home. Patchdeck connects out over SSH, checks apt, and streams the output back live. It runs as a single container right next to the rest of your self-hosted stack, encrypts every credential at rest, and has no cloud, no telemetry, and no account — your fleet's details never leave the box.

Patchdeck dashboard

More screenshots — host detail, settings, schedules, activity, light & mobile

Dashboard — light
Dashboard (light)

Select mode — pick cards, then act on just those (with a confirm)
Selecting hosts

Host detail — packages, reboot/restart, per-host settings
Host detail

Settings — notifications, SSO, tokens, 2FA
Settings

Schedules — cron scan/apply per host, tag, or fleet
Schedules

Activity log
Activity log

Mobile
Dashboard (mobile)    Host detail (mobile)

Fits the way you already run things

  • Point it at your fleet over SSH — with Patchdeck's own key (generated on first start, rotatable), a pasted key, or a password, per host. First connection to a host pauses so you review and approve its SSH key before Patchdeck ever uses it.
  • Through your SSH bastion — works through Warpgate (user:target@host -p 2222): paste the ssh command and Patchdeck fills in the host. One connection per operation, so the bastion records one session per scan, not a handful.
  • Behind your reverse proxy — Traefik, Caddy, Nginx Proxy Manager. Serves HTTPS on its own by default; flip one env var to let your proxy terminate TLS.
  • Through your notification stack — native alerts to Gotify, ntfy, Discord, Telegram, Slack, Pushover, email, or a webhook. No Apprise/python container to babysit.
  • With your homelab login — optional single sign-on via any OIDC provider (Authentik, Authelia, Keycloak, Pocket ID, …), or a local admin with TOTP two-factor.
  • On your phone or your desktop — the UI is responsive and theme-aware (system / light / dark), so a quick "what needs patching?" check works from the couch.

Features

See what needs patching

  • Agentless scanning — connects out over SSH; nothing to deploy or maintain on your hosts
  • Live, filterable dashboard — hosts that need attention are pinned on top and re-file themselves the moment their status changes (no reload); filter by facet (updates · reboot/restart · healthy), search by name or tag, and optionally group by tag
  • Reboot and restart detection — a pending reboot is caught from /var/run/reboot-required and from needrestart's kernel and CPU-microcode check (so Debian and Proxmox hosts running an older kernel than the one installed are flagged too, with the reason: kernel 6.8.12-4 → 6.8.12-5). Services still running old code are listed per host, split into restart-now vs reboot-required

Patch

  • One-click patching — apply updates with live output in the browser. Each apply finishes any interrupted dpkg run, refreshes the package lists, then runs apt-get dist-upgrade (the full upgrade Debian and Proxmox recommend), keeping your existing config files on conflicts so nothing stops to ask
  • Never loses an upgrade — the upgrade runs detached on the host, so a dropped connection (a network or tailscale restart mid-upgrade, a bastion hiccup, Patchdeck itself restarting) never kills apt or loses the result: Patchdeck reattaches and records what actually happened
  • Intelligent service restart — one Restart services action picks the right method per unit (a clean restart where it's safe, needrestart's coordinated handler where a naive restart would sever the session). Anything still flagged afterwards is learned as reboot-required, so you never have to guess. A reboot clears the learned set. Units that must never be restarted on a running host (unattended-upgrades, apt-daily*, rc-local, cloud-init, user@<uid>, display managers — needrestart's own "don't restart" list) are left alone and shown as Clears at next reboot, without flagging the host for a reboot
  • Catches services that stop afterwards — 30 seconds after a restart, and after any apply that installed something, Patchdeck checks that services still run. One that stopped (and wasn't failed before) is flagged on its card (1 service stopped), logged and notified, and stays until a scan finds it running again or you dismiss it; Try restart again is one click on the host page
  • Reboots you can walk away from — Patchdeck waits for the host to really come back (its uptime resets), then re-scans it

Act on the whole fleet, or just part of it

  • Bulk actions — Scan all, Apply all, Restart all, Reboot all, each host streaming on its own card, with a status line while it runs (Apply on 6 hosts: 2 done, 1 running, 3 queued)
  • Act on a selection — tap Select, tick the cards you want (or All shown for the current filter), and scan, apply, restart or reboot just those. The confirm names the hosts, warns about protected hosts you picked on purpose, and lists anything left out and why
  • Actions run on the server — close the tab, lose your connection, or switch devices: everything keeps going, and any page you open later shows its live progress. A host does one thing at a time (manual, scheduled or API). If Patchdeck restarts mid-run, it reattaches to upgrades still running on hosts, finishes reboot watches, and offers Resume remaining for hosts that never started
  • Safe by default — the host Patchdeck runs on is patched last and never swept by a bulk reboot or restart (detected automatically); protect any other host from fleet reboots; concurrency cap and apply stagger so a big fleet doesn't bounce all at once

Schedule it

  • Cron schedules targeting one host, several hosts, a tag, or All hosts (the whole fleet as it is at each run, so hosts you add later are included) — scan, apply, or scan + apply, with per-job run history. Any schedule can be edited in place
  • Per-host opt-out — Skip this host in scheduled applies: Apply schedules skip it, Scan + apply schedules only scan it, and you can still patch it by hand

Know what happened

  • Notifications — native alerts to Gotify, ntfy, Discord, Telegram, Slack, Pushover, email (SMTP), and webhooks: one message per action or scheduled run, sent when it finishes (or one per event, if you prefer). Global and per-host toggles
  • Activity log — every scan, apply, restart, reboot, and change, with configurable retention and CSV export

Access and security

  • Patchdeck's own SSH key — an Ed25519 keypair generated on first start; pick Patchdeck key for a host and copy the public key from Settings. Two-phase rotation (both keys work until you finish, with a per-host "is the new key installed?" check) so rotating never locks you out
  • First-connection host-key approval — every new host's SSH key is held for your approval before it's trusted; a changed key later pauses operations for re-approval (fail-closed, no silent trust)
  • Bastion / Warpgate support — user:target logins, paste-to-fill from an ssh command, root-aware escalation (no sudo needed when the bastion logs in as root), one bastion session per operation
  • Single sign-on (optional OIDC, Authorization Code + PKCE), TOTP two-factor with recovery codes, and API tokens (Bearer)
  • Encrypted secrets — AES-256-GCM at rest for every SSH credential; stored passwords and keys can be cleared on save
  • HTTPS by default — auto-generated self-signed cert out of the box; one env var to defer to your reverse proxy

Proxmox, VMs and LXC containers

  • Proxmox VE nodes work like any Debian host: Patchdeck runs the full dist-upgrade Proxmox requires and flags a new -pve kernel for a reboot. Mark nodes you'd rather patch by hand with Skip this host in scheduled applies.
  • Add each VM and LXC container as its own host. Patchdeck then sees and patches what's inside it (its own packages, services and reboots). The Proxmox node's card only covers the node itself.

Quick Start

Prerequisites

  • Docker & Docker Compose
  • SSH access to your target hosts (password or key auth)

1. Create your project directory

mkdir patchdeck && cd patchdeck

2. Create your .env file

# Generate the one required secret (encrypts SSH credentials at rest)
echo "PATCHDECK_MASTER_KEY=$(openssl rand -hex 32)" > .env

3. Create your compose.yaml

services:
  patchdeck:
    image: ghcr.io/roydufek/patchdeck:latest
    container_name: patchdeck
    restart: unless-stopped
    ports:
      - "6070:6070"
    environment:
      PUID: 1000                                          # set to match your host user
      PGID: 1000                                          # set to match your host group
      PATCHDECK_PORT: 6070
      PATCHDECK_MASTER_KEY: ${PATCHDECK_MASTER_KEY}
      #TZ: America/Los_Angeles                             # timezone for scheduled jobs (default UTC)
      #PATCHDECK_TLS: true                                 # default; set false if behind a reverse proxy
      #PATCHDECK_DB_PATH: /data/patchdeck.db               # default, optional
      #PATCHDECK_SSH_TIMEOUT_SECONDS: 20                   # default, optional — SSH dial timeout
      #PATCHDECK_EXEC_TIMEOUT_SECONDS: 600                 # default, optional — max wall-clock for a remote command
      #PATCHDECK_CONNECTIVITY_TIMEOUT_SECONDS: 15          # default, optional — live connectivity-check timeout
      #PATCHDECK_APPRISE_URL: gotifys://gotify.example.com/TOKEN    # optional — default notification destination
    volumes:
      - ./data:/data

4. Start

docker compose up -d

Patchdeck will be available at https://localhost:6070 (or https://<your-server-ip>:6070).

Note: Patchdeck serves HTTPS by default with an auto-generated self-signed certificate, so your browser will warn on first visit — that's expected. Behind a reverse proxy (Traefik, Caddy, Nginx Proxy Manager) set PATCHDECK_TLS=false so you don't double-encrypt.

5. Create your admin account

Open the web UI and create the first admin account. You can turn on TOTP two-factor and wire up OIDC single sign-on afterwards in Settings.

6. Add hosts

Hit + to add a server's SSH details — or paste the ssh … command you'd use and let Patchdeck fill them in. The simplest auth is Patchdeck key: copy its public key from Settings → SSH key into the host's ~/.ssh/authorized_keys (the card has a ready-made one-liner). Patchdeck encrypts any credentials at rest, then walks you through approving the host's SSH key on first connect before it scans.

Building from Source

git clone https://github.com/roydufek/patchdeck.git
cd patchdeck
cp .env.example .env    # then edit PATCHDECK_MASTER_KEY
docker compose up -d --build

Stack

Component Technology
Backend Go 1.26 — Chi router + pure-Go SQLite (WAL), native Go scheduler & notifications
Frontend Server-rendered Go html/template + HTMX + SSE — no Node, no bundler, no build step
Runtime A single ~30 MB static Go binary on Alpine; assets embedded — no interpreter, tiny CVE surface
Deployment Docker Compose (one container, one SQLite file)

Patchdeck's UI is rendered by the Go binary itself — there is no JavaScript build pipeline, no Node, no bundler. The whole thing is one container and one ./data folder to back up.

Configuration

All configuration is via environment variables. Only PATCHDECK_MASTER_KEY is required — everything else has sensible defaults.

Variable Required Default Description
PATCHDECK_MASTER_KEY ✅ — 32+ char secret; an AES-256 key is derived from it (HKDF) to encrypt SSH credentials at rest
PUID / PGID 1000 User/group ID for the container process (linuxserver.io convention)
TZ UTC Timezone for scheduled jobs (IANA name, e.g. America/Los_Angeles). Cron fires in this zone; tzdata is embedded, so no extra package needed
PATCHDECK_DB_PATH /data/patchdeck.db SQLite database path inside the container
PATCHDECK_SSH_TIMEOUT_SECONDS 20 SSH dial/handshake timeout
PATCHDECK_EXEC_TIMEOUT_SECONDS 600 Max wall-clock for a single remote command (scan/apply)
PATCHDECK_CONNECTIVITY_TIMEOUT_SECONDS 15 Timeout for the live dashboard connectivity check
PATCHDECK_BULK_CONCURRENCY 4 Max hosts Patchdeck works on at once, across every running action (bulk, selections, single hosts); <1 = no cap
PATCHDECK_APPLY_STAGGER_SECONDS 0 Minimum gap between successive applies (blast-radius safety); 0 = off
PATCHDECK_APPRISE_TIMEOUT_SECONDS 10 Notification delivery (HTTP/SMTP) timeout
PATCHDECK_APPRISE_URL — Default notification destination URL (see Notifications)
PATCHDECK_TLS true Enable HTTPS with an auto-generated self-signed cert; set false if behind a reverse proxy
PATCHDECK_TLS_CERT / PATCHDECK_TLS_KEY /data/tls/… Paths to a custom TLS cert/key (auto-generated if missing)

Architecture

        Browser  (phone / desktop)
           │  :6070 HTTPS
┌──────────▼───────────────────┐
│  Patchdeck  (one container)   │
│  ┌─────────────────────────┐  │
│  │ Go server                │  │
│  │  · JSON API + token auth │  │
│  │  · server-rendered UI    │  │   html/template + HTMX + SSE
│  │  · task queue            │  │   actions run here, not in the browser
│  │  · cron scheduler        │  │
│  │  · SQLite (WAL)          │  │
│  │  · native notifications  │  │
│  └───────────┬─────────────┘  │
└──────────────┼────────────────┘
               │ outbound SSH
     ┌─────────▼──────────┐
     │  your Linux hosts   │   VMs · LXC · Pis · bare metal
     └────────────────────┘

Security

  • Credentials encrypted at rest — AES-256-GCM; the key is derived from PATCHDECK_MASTER_KEY via HKDF-SHA256, and secrets are never returned by the API
  • Fail-closed SSH host keys — first connection is held for operator approval; a later key change blocks all operations until you approve or reject it (no silent trust-on-first-use)
  • Cookie sessions — httpOnly, Secure, SameSite=Lax, server-side store with a sliding 7-day expiry (no JWT, no token in URLs)
  • Login brute-force lockout — per-IP sliding-window lockout after repeated failures
  • TOTP two-factor — optional, with one-time recovery codes; plus optional OIDC SSO
  • Root passwords never on a command line — sudo and su passwords are fed on stdin, so other users on the host can't read them from /proc
  • Command-injection guards — strict validation of service names and power actions sent over SSH
  • Parameterized SQL, bcrypt password hashing, per-host scan/apply rate limiting, and a full audit trail
  • Minimal runtime — a static Go binary on Alpine, no interpreter or JS runtime in the image; both trivy and grype gate every release for fixable HIGH/CRITICAL CVEs

SSH keys & Warpgate

Patchdeck key. On first start Patchdeck generates an Ed25519 keypair. The private key is encrypted with PATCHDECK_MASTER_KEY and never leaves Patchdeck. The public key — and an install one-liner — is in Settings → SSH key. Choose Patchdeck key as a host's authentication and there's nothing to paste.

Rotation is two-phase, so it never locks you out:

  1. Rotate key creates a new key. From then on Patchdeck offers both keys on every connection.
  2. Install the new public key on your hosts (or on your bastion user). Check hosts logs into each "Patchdeck key" host with only the new key and shows ✓/✗.
  3. Finish rotation retires the old key — it refuses while any host still rejects the new one (or finish anyway, e.g. after a compromise). Then remove the old line (patchdeck-<timestamp>) from authorized_keys.

Warpgate. Add a host with user <warpgate-user>:<target>, Warpgate's address, and its SSH port (e.g. paste ssh 'patchdeck:web-01@warpgate.example.com' -p 2222). Put Patchdeck's public key on that Warpgate user and give it a role covering the targets. Notes:

  • The host key you approve is Warpgate's own — the same for every target.
  • Warpgate logs into targets as root, so no sudo/root password is needed; Patchdeck detects that it's already root.
  • Each operation (probe + scan, or an apply and its follow-ups) shares one SSH connection — one recorded Warpgate session.
  • Rotating through Warpgate is a single edit: swap the key on the Warpgate user.

Notifications

Patchdeck delivers alerts (new updates available, apply succeeded / failed, scan failed, restart or reboot failed) natively in Go — no python or Apprise dependency in the image. Configure a single destination URL in Settings → Notifications (or via PATCHDECK_APPRISE_URL), with optional per-host overrides. URLs follow the familiar Apprise-style scheme, so most existing URLs keep working.

Service URL format Notes
Gotify gotifys://host/TOKEN gotify:// = http, gotifys:// = https. ?priority=N optional
ntfy ntfys://host/topic or ntfy://topic topic-only uses ntfy.sh. user:pass@ or ?token= for auth
Discord discord://webhook_id/webhook_token from a Discord channel webhook URL
Telegram tgram://bot_token/chat_id one chat id per URL
Slack slack://TokenA/TokenB/TokenC[/channel] incoming-webhook tokens
Pushover pover://user_key@app_token ?priority=N optional
Email (SMTP) mailtos://user:pass@smtp.host[:port]/?to=you@example.com mailtos:// = TLS (465), mailto:// = STARTTLS (587). Explicit SMTP host required
Webhook jsons://host/path or forms://host/path json* posts JSON {title,message,…}, form* posts form data

Digest delivery (default): one message per run.

  • Scheduled runs send one message when the run ends: a title with the totals (5 of 12 hosts need updates (24 packages, 4 security) · 1 failed; prefixed Patchdeck: everywhere except Gotify, which already shows the app name) and a body listing every host that needs updates — security count, reboot/restart flags, and which hosts are new since the last scan. It only sends when something is new, an apply ran, or something failed (or every run, with Send the scheduled digest every run).
  • Dashboard actions — one host, an "… all" button, or a selection — send one message the moment the action finishes, however long it takes.
  • API calls within about a minute of each other arrive as one message.

Switch Delivery to Per host for one message per event instead. The per-event and per-host toggles apply in both modes.

One destination per instance — use your notification backend (an ntfy topic, a webhook) for fan-out. Hit Send test to verify a URL before saving.

API

The web UI authenticates via an httpOnly session cookie. For automation, create an API token in Settings and send it as Authorization: Bearer pd_....

Method Endpoint Description
POST /api/login Authenticate (sets session cookie)
GET /api/hosts List all hosts
POST /api/hosts Add a host
POST /api/hosts/:id/scan · /apply Scan, or apply updates; returns the result as JSON when done
GET /api/hosts/:id/scan/stream · /apply/stream The same, streamed live (Server-Sent Events)
POST /api/hosts/:id/restart-services · /restart-all Restart flagged services (chosen ones, or needrestart's own pass)
POST /api/hosts/:id/power Reboot or shutdown
PUT /api/hosts/:id/operations checks_enabled, skip_scheduled_apply
GET /api/activity · /api/activity/export Activity log (paginated) · CSV export
GET/POST /api/jobs · /api/jobs/:id/runs Scheduled jobs (target host_id, host_ids, tag_filter, or all_hosts: true) · run history
PUT /api/hosts/:id Update a host; blank secrets keep the stored ones, clear_password / clear_private_key / clear_sudo_password: true remove them
GET /api/settings/ssh-key Patchdeck's public key (and the rotation's new key, if one is in progress)
POST /api/settings/ssh-key/rotate · /check · /finish · /cancel Key rotation — finish takes optional {"force": true}
GET/PUT /api/settings/* Notification, OIDC, audit, and token settings

Host actions answer 409 while the host is busy with another action (a dashboard task or a scheduled job); retry when it finishes.

Development

No Node, no bundler — the UI is Go templates + HTMX served by the binary. Editing the front end means editing .html templates and rebuilding the binary.

cd api
go build ./...
go test ./...
go run ./cmd/server    # needs PATCHDECK_MASTER_KEY set

Templates and static assets live under api/cmd/server/ and are embedded at build time (//go:embed), so the compiled binary is fully self-contained.

Roadmap

  • Apply preview / dry-run (apt-get -s) with disk-space and reboot prechecks
  • Package holds (apt-mark) and security-only update mode
  • Auto-reboot within scheduled maintenance windows
  • Fleet patch-status report / export
  • Notification delivery log (per-attempt success/failure)
  • RPM/dnf support (RHEL, Fedora, Rocky)
  • Dashboard metrics and charts

License

MIT

Contributing

Issues and pull requests welcome.