Built in
"How's the machine doing?" "My PC froze last night, what happened?" "What's the Unraid server's address?" "Is the kokoro service running? Restart it if it isn't." None of that needs a script:
| Piece | What it gives her | Asks first? |
|---|---|---|
system_health | a verdict, then load, RAM and swap, every disk, CPU and GPU temperatures, failed services, errors since boot by program | no, it only reads |
last_boot | how the previous session ended, and the likeliest cause from the journal: a GPU hang, memory running out, a panic, overheating, disk errors | no, it only reads |
find_device | a machine's IP by name or MAC: what she remembers first, then the name each machine gives itself over mDNS, your router's DNS, then one quiet pass over your /24. Remembered by MAC, since IPs move | no, it only looks |
run_command | a shell, as you. "Is Plex running on the tower?" becomes ssh root@tower docker ps in a popup | every command |
| Discord | the same Luna from your phone, owner only | per the approval setting |
Helper scripts
Anything with more than a step or two goes in a script: one file in agent/jobs/ inside Luna's
folder, kept out of git so your host names stay yours. She never writes the commands on the spot. She
runs the script and reads what it printed, so the same check gives the same answer every time, and a small
model only has to explain a report, not get twenty commands right. These six are from the setup Luna is
built on, a desktop, a VM with the graphics card, a web server and a NAS, and they come with her in
examples/jobs/: copy one into agent/jobs/, change the address line at the top,
and it works.
Linux only. They're bash scripts that use Linux's own tools (systemd, apt or dnf,
/proc, dig, nmap), so the computer Luna runs on and the machines
they check need to be Linux. Unraid is Linux too. Of the built-in tools, last_boot is
Linux only too, and system_health gives its full report there; on Windows and macOS it reports what it
can. find_device and run_command work everywhere.
vm-health.sh
The machine her model runs on: up, load, memory, disks, the graphics card (busy, VRAM, temperatures, power), llama-server (up, which model, context, busy slots), failed services, driver warnings and errors since boot.
Read-only. "check vm health", as a recipe.
web-health.sh
The web server: the same basics, then Apache and MariaDB, certificate renewal, and every site Apache serves, with its answer and how many days its certificate has left.
Read-only. "check the web server", as a recipe.
backups-to-nas.sh
Copies the web server's nightly database dumps to the NAS, checks each copy, and thins out old ones: the last 30 days, the first of each month for a year, never fewer than 7.
A scheduled job, every Sunday at 4am. The walkthrough is on Scheduled jobs.
cve-check.sh
Known security holes with a fix out, from each machine's own package manager: debsecan on Debian (by urgency, and what's remotely exploitable), apt on Ubuntu, dnf on Fedora, arch-audit on Arch. Also says when an installed kernel is waiting on a reboot.
Read-only. Any machine you can reach with an SSH key.
web-update.sh
Lists what's waiting and how much of it is security fixes, then upgrades it all. Nothing is removed, your config files are kept, it never reboots, and it checks Apache and MariaDB afterwards.
You run it, in a terminal, where sudo can ask for your password. Luna can run --check, which only lists.
site-check.sh
A security once-over of a website from the outside: HTTPS, the certificate, TLS versions, security headers, cookies, version banners, and the domain's email security. With --active, open ports and files that shouldn't be public.
Changes nothing. More below.
Every one needs SSH key login to the machines it reads (it fails instead of waiting for a password), and
prints a short report with problems marked in words: FAILED, [HIGH],
reboot waiting. Make one a one-sentence check with a recipe (Skills she
learns), or have it run on a timer (Scheduled jobs).
Checking a website
bash ~/ai-voice/agent/jobs/site-check.sh example.com
bash ~/ai-voice/agent/jobs/site-check.sh example.com --active
bash ~/ai-voice/agent/jobs/site-check.sh example.com --active --report
| Part | What it checks |
|---|---|
| DNS and email | SPF, DMARC and DKIM (can anyone send mail as you?), CAA (who may issue your certificates), DNSSEC |
| Web | the redirect to https, HSTS, Content-Security-Policy, framing, nosniff, Referrer-Policy, version numbers in headers and the page, cookie flags, security.txt |
| Certificate and TLS | days left, TLS 1.0 and 1.1 still accepted, TLS 1.3 |
Open ports (--active) | nmap's top 100 with versions: databases, admin panels like Webmin and cPanel, FTP, a DNS server that answers for anyone |
Leaked files (--active) | a readable .git, .env, backups, phpinfo, Apache's server-status, phpMyAdmin's login. nuclei's safe checks too, if it's installed |
Without --active it only looks at what any visitor's browser or mail server already sees, so
it's fine for any site. --active is for your own sites, or a client's who
said yes in writing: scanning ports on someone else's server can count as unauthorised use. It never
logs in, never sends a form and changes nothing either way. It needs curl,
openssl and dig, and nmap for --active.
The report
Each finding is one line, and nearly every one has the fix under it, written for the server it found:
Apache, nginx, or Plesk's panel. With --report it prints the same findings as a report to
read, grouped worst first with a bold title and a fix under each, and that's what she hands you. A small
model asked how to fix a missing header will happily invent a config file that doesn't exist, and asked to
tidy a report it copies the look of its last one. Passing on a finished report, she gets it right.
== shop.example.com (public face + active)
== DNS and email
[MED] no DMARC record: spoofed mail from shop.example.com isn't rejected or reported
fix: add a TXT record named _dmarc.shop.example.com: v=DMARC1; p=none; rua=mailto:you@shop.example.com (reports first; raise p=none to p=quarantine once they show only your own mail)
== web
[LOW] Server header shows a version: Apache/2.4.62 (Debian)
fix: in /etc/apache2/conf-available/security.conf: ServerTokens Prod and ServerSignature Off, one per line, then sudo systemctl reload apache2
[MED] cookie PHPSESSID is missing: Secure HttpOnly SameSite
fix: in php.ini (Debian: /etc/php/<version>/apache2/php.ini): session.cookie_secure = 1, session.cookie_httponly = 1, session.cookie_samesite = Lax, then reload Apache
== open ports (active)
[HIGH] port 10000 open: almost certainly Webmin, a full server admin panel, open to the whole internet
fix: allow=<your IP> in /etc/webmin/miniserv.conf, then sudo systemctl restart webmin
== files that shouldn't be public (active)
[HIGH] https://shop.example.com/.git/HEAD is readable: the site's git history, source code and maybe passwords
fix: Apache: RedirectMatch 404 /\.git in the site's config, or deploy without the .git folder
== summary: 2 high, 2 medium, 1 low
Your own network, from inside
If the site is hosted at home and you scan it from home, the address it resolves to is your own router, and the router answers for itself the way it does for anything on your network: its DNS, UPnP, its admin page. None of that is reachable from the internet. The script notices (the site's address is your own public one), says so at the top, and marks the router's usual ports as INFO instead of counting them. Forwarded ports are still real. For the outside view, run it from a phone hotspot.
As a skill
Run it once by asking: "Run site-check.sh on example.com with --active." Scans take a minute or two, so the command gets more time than the usual 60 seconds. Then teach her the recipe, in a message of its own:
Remember this recipe for website security scans: run bash ~/ai-voice/agent/jobs/site-check.sh <domain> --active --report with a 180 second timeout. Reply with the report exactly as the script printed it, first line to last: don't reformat it, drop lines or add fixes of your own. After it, one or two sentences of your own on what to fix first. Never say the scan was from my network unless the report says so.
From then on, "scan example.com" is the whole request. The command still asks every time:
Good to know
- Read-only unless it says otherwise. Of the six, only the backup copy writes (to the NAS) and only the update changes a machine, and you run that one yourself.
- Every command asks. A script she runs at the desk is one popup with the whole command. On a timer, the script was approved once and is pinned by its fingerprint.
- No passwords anywhere. SSH keys, made once, and a script that fails instead of asking.
- Write your own the same way: read-only where you can, a short report, problems in plain words she can find.