Skip to content

Deploy SSH Health Monitoring Dashboard #6

@Bobthe3

Description

@Bobthe3

Overview

Deploy the SSH Health Monitoring system that allows monitoring a remote Mac's health via a Vercel-hosted dashboard with WebAuthn/Passkey authentication (Touch ID/Face ID).

Architecture

┌─────────────────┐         ┌─────────────────┐         ┌─────────────────┐
│  Remote Mac     │  push   │   Vercel KV     │  read   │  Vercel App     │
│  (SSH target)   │ ──────► │   (Redis)       │ ◄────── │  (Dashboard)    │
│                 │  every  │                 │         │                 │
│  health-agent   │  30s    │  health data    │         │  + WebAuthn     │
└─────────────────┘         └─────────────────┘         └─────────────────┘

Current Status

The code is complete and builds successfully. Located at:

  • ssh-health-monitor/dashboard/ - Next.js 16 app
  • ssh-health-monitor/agent/ - Bash scripts for remote Mac

Deployment Tasks

1. Deploy Dashboard to Vercel

  • Run vercel from dashboard/ directory
  • Configure custom domain (e.g., ssh-health.devanvelji.com)

2. Set Up Vercel KV Store

  • Go to Vercel Dashboard → Storage → Create KV Store
  • Link KV store to the project

3. Configure Environment Variables

Set these in Vercel project settings:

Variable Description Generate With
HEALTH_API_KEY Agent authentication openssl rand -base64 32
JWT_SECRET Session signing openssl rand -base64 64
WEBAUTHN_RP_ID Domain name devanvelji.com
WEBAUTHN_RP_NAME Display name SSH Health Monitor
WEBAUTHN_ORIGIN Full URL https://ssh-health.devanvelji.com
ALLOWED_USERS Authorized users devan

4. Install Agent on Remote Mac

  • Copy agent folder to remote Mac: scp -r agent/ user@remote:~/health-agent-setup/
  • SSH in and run installer: ~/health-agent-setup/install.sh
  • Verify agent is running: launchctl list | grep health

5. Verify Everything Works

  • Visit dashboard URL
  • Register passkey (first time)
  • Confirm health data appears
  • Test login with Touch ID/Face ID

Features

Dashboard

  • Real-time health metrics (CPU, Memory, Disk, Network)
  • SSH status with diagnostics (sshd running, port 22, firewall)
  • Current logged-in users
  • Recent authentication failures
  • Auto-refresh every 30 seconds
  • Red/yellow/green status indicators

Security

  • WebAuthn passkeys only (no password fallback)
  • API key for agent authentication (stored in macOS Keychain)
  • JWT sessions with HTTP-only cookies
  • 24-hour data retention

Health Metrics Collected

Metric Source
CPU usage & load average top, sysctl
Memory (total/used/free) vm_stat, sysctl
Disk usage df
Network status & IPs ping, curl, ipconfig
SSH status pgrep sshd, lsof, firewall check
System uptime sysctl kern.boottime
Current users who
Auth failures log show

Troubleshooting Reference

Dashboard shows "No health data":

# On remote Mac
launchctl list | grep health
tail -f ~/health-agent/health-agent.log
~/health-agent/health-check.sh  # Test manually

WebAuthn fails:

  • Ensure using HTTPS
  • Verify WEBAUTHN_ORIGIN matches URL exactly (including protocol)

SSH shows unavailable:

sudo systemsetup -getremotelogin
sudo systemsetup -setremotelogin on

Related Files

  • ssh-health-monitor/README.md - Full documentation
  • ssh-health-monitor/dashboard/.env.example - Environment template

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions