feat: external HTTPS monitoring pull via monitor.php

Add cron-ready pull checks for critical URLs with SSL expiry warnings,
retry-before-alert, JSON results in private/data, email alerts, and a
90-day target-list review reminder.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Frank Schwenk
2026-06-12 10:05:43 +02:00
parent 69f183d356
commit c007d5ebdc
8 changed files with 456 additions and 21 deletions
+29 -21
View File
@@ -1,6 +1,7 @@
# 03 — Monitoring Pull (Phase 1)
**Priorität:** high
**Status:** erledigt (2026-06-12)
**Abhängigkeiten:** 01, 02, 05
**Siehe auch:** [`../MONITORING.md`](../MONITORING.md)
@@ -12,36 +13,43 @@
### Implementierung
- [ ] `config/` — lädt `.env` (oder `config.php` außerhalb `httpdocs`)
- [ ] `public/monitor.php` — CLI/Cron-tauglich, kein Browser-Output nötig
- [ ] URL-Liste aus MONITORING.md Mindestliste konfigurierbar (`config/targets.php`)
- [ ] Pro URL: HTTP-Status, Timeout ~10s, optional erwarteter Code (200, 301, 401)
- [ ] SSL-Ablauf: Warnung wenn &lt; 14 Tage
- [ ] Retry: bei Fehler 2 Min warten, zweiter Versuch — Alarm nur wenn beide scheitern
- [ ] Ergebnisse nach `data/last-checks.json` schreiben (für Landing Page)
- [ ] Bei Alarm: E-Mail an `ALERT_EMAIL` via SMTP
- [ ] Optional: Telegram wenn `TELEGRAM_*` gesetzt
- [x] `config/` — lädt `.env` (oder `config.php` außerhalb `httpdocs`) — `bootstrap.php` → `private/server.env`
- [x] `public/monitor.php` — CLI/Cron-tauglich, kein Browser-Output nötig
- [x] URL-Liste aus MONITORING.md Mindestliste konfigurierbar (`config/targets.php`)
- [x] Pro URL: HTTP-Status, Timeout ~10s, optional erwarteter Code (200, 301, 401)
- [x] SSL-Ablauf: Warnung wenn &lt; 14 Tage (`warn` in JSON, kein Mail-Alarm)
- [x] Retry: bei Fehler 2 Min warten, zweiter Versuch — Alarm nur wenn beide scheitern
- [x] Ergebnisse nach `data/last-checks.json` schreiben (für Landing Page) — `private/data/` auf Webspace
- [x] Bei Alarm: E-Mail an `ALERT_EMAIL` via SMTP
- [x] Review-Reminder (90 Tage, `last_reviewed_at` + Hash-Auto-Reset) — Plan-Ergänzung, in `monitor-lib.php`
- [ ] Optional: Telegram wenn `TELEGRAM_*` gesetzt — bewusst Phase 2
### Mindest-URLs (Start)
- [ ] `https://schwenk.online`
- [ ] `https://gitea.schwenk.online`
- [ ] `https://pics.schwenk.online`
- [ ] `https://medis.schwenk.online`
- [ ] `https://portainer.schwenk.online`
- [ ] Eine `bsc-gp.de`-Subdomain (z. B. score)
- [ ] `https://vfb.red`
- [x] `https://schwenk.online`
- [x] `https://gitea.schwenk.online`
- [x] `https://pics.schwenk.online`
- [x] `https://medis.schwenk.online`
- [x] `https://portainer.schwenk.online` — `expect` `[200, 401]` (liefert aktuell 200)
- [x] Eine `bsc-gp.de`-Subdomain (z. B. score) — `https://score.bsc-gp.de`
- [x] `https://vfb.red`
### Sicherheit
- [ ] `data/` nicht öffentlich (`.htaccess` oder außerhalb Document Root)
- [ ] Keine Secrets in `last-checks.json`
- [x] `data/` nicht öffentlich (`.htaccess` oder außerhalb Document Root) — `private/data/`
- [x] Keine Secrets in `last-checks.json`
## Akzeptanzkriterien
- Manueller Aufruf / „Jetzt ausführen“ in Plesk läuft fehlerfrei
- Simulierter Down (falsche URL) löst Mail nach Retry aus
- `last-checks.json` aktualisiert sich
- [x] Manueller Aufruf / „Jetzt ausführen“ in Plesk läuft fehlerfrei
- [x] Simulierter Down (falsche URL) löst Mail nach Retry aus
- [x] `last-checks.json` aktualisiert sich
## Notizen
- Plesk-Cron: `httpdocs/monitor.php`, `*/10 * * * *`, „Nur Fehler“ (Todo 05)
- Browser-Aufruf `https://0012.de/monitor.php` → leere Seite (HTTP 200) ist korrekt
- SSL-`warn` auf boka-Hosts nach LE short→long-lived-Wechsel: bekannt, kein Handlungsbedarf auf 0012.de
## Geschätzter Aufwand