Skip to content
DevOps

S.A.R.A. Control Plane: Headless Linux Server Management via Encrypted Webhooks

Implementation details of an automated headless server management daemon with systemd watchdogs, HMAC-SHA256 signature verification, and Telegram command relays.

Remix into Workplace Studio:

What Was I Trying to Do?

Managing personal servers and home lab appliances when away from a laptop usually means struggling with slow mobile SSH apps on touchscreen keyboards. Opening SSH ports to the public internet also invites continuous automated brute-force attacks from IP scanning bots.

I engineered the S.A.R.A. Task Control Plane as an event-driven system daemon that listens for cryptographically signed administrative commands over Telegram, executes whitelisted operations in a sandbox, and returns clean markdown status digests.

Security Architecture

Telegram User ➔ TLS Webhook with HMAC-SHA256 Signature ➔ Whitelist Command Parser ➔ Restricted Linux Subprocess ➔ Sanitized Output Stream ➔ Response Message
  1. Zero Public SSH Ports:
    • Server runs without external inbound port forwards. The daemon polls Telegram long-polling or accepts webhooks behind Cloudflare Tunnel.
  2. HMAC-SHA256 Payload Verification:
    • Every inbound control message is validated against the sender user ID and a rotating secret key before reaching the command dispatcher.
  3. Strict Command Whitelist:
    • Arbitrary shell execution is completely disallowed. Commands are mapped to strict deterministic functions:
      • /status: Queries systemd service health and CPU load.
      • /disk: Runs df -h and reports disk usage percentages.
      • /cleanup: Purges dangling Docker containers and systemd journal logs older than 7 days.
      • /restart <service>: Restarts only approved application daemons.

Key Highlights & Performance

  • Execution Latency: Command-to-response roundtrip time averages under 850 milliseconds.
  • Memory Footprint: The Node.js daemon runs as an isolated systemd unit consuming under 28 MB of RAM.
  • Self-Healing: Managed by systemd with Restart=always and WatchdogSec=30s, auto-recovering within 2 seconds if a process fault occurs.

What I Learned

Allowing arbitrary shell input via chat interfaces is a major security vulnerability waiting to happen. Constraining remote mobile operations to a strict whitelist of parameterized tasks provides complete operational peace of mind.

DevOpsSystemdTelegram WebhookAutomationLinux
Md Sabbirul Islam Khan

Md Sabbirul Islam Khan

Written by THE SABBiR