I run AI agents on a VPS 24/7. They manage my workflows, process data, and talk to me over Telegram. That VPS is always on, always connected, and always a target.

So every night at 11pm, another agent wakes up and runs a full security audit. If everything passes, it logs "security audit passed" and goes back to sleep. If something fails, it explains the issue and fixes it immediately.

No dashboards to check. No alerts to configure. Just an agent doing the boring work every single night.

🔥 FirewallUFW active and configured correctly
🚫 Fail2BanHow many IPs got banned in 24h
🔑 SSH ConfigPassword auth disabled, keys only
🔍 Open PortsNothing unexpected listening
🐳 DockerNo rogue containers running
💾 Disk UsageUnder 80% capacity

The setup

I use Hermes for this, not OpenClaw. Hermes is an open-source AI agent built by Nous Research, running GPT-5.4. It's security-conscious by design and particularly good at agentic crons. Built-in cron scheduler, learning loop, and a paranoid default posture that's exactly what you want for this kind of work.

Why a separate agent? Same reason you don't use your daily driver for security. Separation of concerns. Hermes runs this audit independently on the same VPS. If my main agent goes down, the security checks still run.

The prompt

This is the exact cron prompt. Nothing fancy. Plain language instructions that the agent executes with shell access.

Run a security audit every night at 11pm.

Check:

1. ufw status (firewall active?)
2. fail2ban status (how many IPs banned?)
3. SSH config (password auth disabled?)
4. open ports (anything unexpected listening?)
5. docker containers (any rogue containers?)
6. disk usage (under 80%?)
7. failed login attempts last 24h

If everything passes, say "security audit passed."

If anything fails, explain the issue and fix it immediately.

Prompt originally shared by @johann_sath on X.

What happens behind the scenes

When the cron fires, Hermes runs each check as a shell command and evaluates the output. Here's what it actually executes:

CheckCommandPass condition
Firewallufw statusStatus: active
Fail2Banfail2ban-client status sshdRunning, reports ban count
SSHsshd -Tpasswordauthentication no
Open portsss -tlnpOnly expected ports (22, 80, 443, etc.)
Dockerdocker psOnly known containers running
Diskdf -h /Usage under 80%
Failed loginsjournalctl -u sshd --since "24h ago"No successful unauthorized logins

The agent doesn't just check. If it finds password auth enabled on SSH, it edits the config and restarts sshd. If disk is over 80%, it finds and cleans up the biggest offenders (old logs, docker images, temp files). If there's a rogue container, it stops it and alerts me.

A note on auto-remediation

Giving an AI agent permission to fix security issues means trusting it with root access. I'm comfortable with this because (1) the checks are well-scoped, (2) the fixes are standard sysadmin procedures, and (3) I review the logs. If you're not comfortable with auto-fix, change the prompt to "explain the issue and suggest a fix" instead.

Why Hermes

Hermes is open-source, runs on any model (OpenRouter, OpenAI, local), and has a built-in cron scheduler that delivers results to Telegram, Discord, or Slack. The relevant features for this use case:

You could do this with OpenClaw, cron + a bash script, or any agent framework with shell access. Hermes just happens to be what I use for this job because it runs independently from my main agent stack.

Setting it up yourself

1. Install Hermes

curl -fsSL https://raw.githubusercontent.com/NousResearch/hermes-agent/main/scripts/install.sh | bash
source ~/.bashrc
hermes setup

2. Configure your model

hermes model

I run it on GPT-5.4 via OpenRouter. For security audits you want a model that's thorough and follows instructions precisely. 5.4 is good at this.

3. Set up the cron

Open Hermes and paste the prompt from above. Tell it to run as a cron. It handles the scheduling natively.

4. Connect Telegram (optional)

hermes gateway

Follow the setup to connect a Telegram bot. Now your audit results land in your DMs every morning.

The baseline matters

Before running this, make sure your VPS has the basics: UFW installed and enabled, fail2ban configured, SSH key-only auth, and unattended-upgrades for automatic security patches. The audit checks these are still in place. It doesn't set them up from scratch.

What I've caught

In the months I've been running this:

None of these were emergencies. All of them were things I wouldn't have noticed until they became emergencies.

The pattern

This isn't really about security. It's about using AI agents for the maintenance work that humans forget, skip, or procrastinate on. Security audits. Log rotation. Certificate renewal checks. Dependency updates. Backup verification.

The work that's important but never urgent, until it is.

Set up an agent. Give it the checklist. Let it run every night. Read the results over coffee.

┌──────────────┐ 11pm daily ┌─────────────────┐ │ │ ──────────────────> │ Security Audit │ │ Hermes │ │ 7 checks │ │ (cron) │ <────────────────── │ auto-remediate │ │ │ results │ │ └──────┬───────┘ └─────────────────┘ │ │ Telegram ▼ ┌──────────────┐ │ Your phone │ │ ☕ morning │ └──────────────┘
About this guide

Built by Alex Yao. I teach professionals how to build AI agent systems that do real work. Join Agent-J+ if you want to learn how.