Skip to content
Host Guard

Host Guard

github.com • November 24, 2026

Security, health, backups and early warning for one Linux server. For anyone running a product on a single cloud instance, VPS or bare-metal box without a platform team.

Install · Versions and rollback · How it works · Advisories · Approvals · Clouds · Mail · Red team · Configuration · Running cost · Panel · Releasing · CI and testing · Security

Small products often run on one server. Nobody watches it at night, backups are "probably fine", and security updates wait until something breaks. Monitoring suites and security agents cost money, need their own servers, and send data somewhere else.

host-guard is one Python file (standard library only) and a few systemd timers. It installs with one command, keeps every secret in one root-only file on the server, and mails every admin when a person is needed. Nothing leaves the server except the mail and, if you want, an encrypted backup copy in S3.

On install it also hardens the base: SSH by key only for one user, fail2ban for SSH and repeat offenders (and for sign-in floods and probes when you give it the web logs), kernel network settings, outbound mining ports blocked, automatic security updates.

Every change is attacked in CI before it can merge: 67 real attacks on an isolated network against a server installed by the version manager, plus the dashboard attacked from a real browser, each mapped to MITRE ATT&CK. 64 stopped or detected, 3 known gaps, 0 failed. The suite lives in ci/redteam/ and runs as the Red team job, required for every merge and release.

Known gaps, reported rather than hidden: a miner renamed like a kernel thread, run from /usr/local/bin; a port scan of 20 common ports; stolen session cookie replayed from another browser. The suite found and fixed five real defects on its first runs. Full report, screenshots and samples of the mails it sent .

Runs anywhere, sets itself up

The cloud is read from its own metadata service; anything else is a VPS or bare metal. The installer records it and adapts: the off-site store that fits, the cost estimate (AWS prices only on AWS), the usual login user.

Mail that sorts itself

Severity, then category, then server, in every subject, plus List-Id and X-Host-Guard-* headers for filters. P1 always goes out at once; similar P2 and P3 mails are capped per hour, so an attack does not bury the inbox. docs/MAIL.md .

On the server (Ubuntu 22.04 to 26.04 or Debian 12), with an SSH key that works and a second session open:

(From a clone instead: sudo ./host-guard install ... in the repository folder.)

It asks for the Gmail app password of the first address (not shown as you type), then sends a test mail. Copy the backup passphrase somewhere offline: sudo grep BACKUP_PASSPHRASE /etc/host-guard/.env .

Pick the profile closest to your server, or start from plain-vps.conf and edit /etc/host-guard/guard.conf later:

Full steps for EC2, a VPS and bare metal, other mail providers and an off-site S3 copy: docs/INSTALL.md .

Upgrade, roll back, remove

Every install is recorded file by file in /opt/host-guard , so it can be undone exactly:

A failed install undoes itself; a file you edited since is kept, not overwritten; SSH settings are checked before they apply. docs/VERSIONS.md .

More diagrams (the life of an alert, a night's backup, the weekly rhythm, the panel's security split): docs/HOW-IT-WORKS.md .

The dashboard (optional)

One page with everything host-guard knows, for the admins: open problems, health, intrusion watch, bans, backups and restore tests, scans, early warning and recent mails. No password : an admin types their email address and signs in with the 6-digit code mailed to it (single use, 10 minutes); every sign-in is mailed to all admins. The admins are the --mail-to addresses. It runs as an unprivileged user that cannot read any secret (root mails the codes, and only to admins), and listens on 127.0.0.1 only.

Install it with --with-panel , then open it through a tunnel, no port opened and no VPN:

AWS SSM, Google IAP, Azure Bastion and OCI Bastion tunnels work the same way: docs/PANEL.md . Every change is attacked in a real browser in CI (sign-in with the code from the mailbox, address enumeration, code flooding, a taken-over panel abusing the mailer, stored script injection, CORS, cross-site posts, framing, session fixation, guessing).

Contributing and security

Issues and pull requests are welcome: CONTRIBUTING.md . Please report vulnerabilities privately: SECURITY.md .

MIT licensed. Built by Prince Kumar , first for the server that runs EdgeShell .

Extracted Entities

Attack Types (1)

Companies (3)

MITRE ATT&CK (1)

Platforms (1)

Tools (2)