Add autonomous monitor: 5-min systemd timer + on-chain USDC balance check

deploy/monitor.py probes /health, /mcp/rpc initialize, /scan x402 challenge,
and reads USDC.balanceOf(wallet) on Base mainnet via public RPC. Appends one
JSON line per run to data/monitor.jsonl and persists state to detect:
- service_down / ingest_stale / mcp_transport_broken / x402_misconfig
- FIRST_PAYMENT_RECEIVED (when wallet balance crosses 0)
- balance_changed (delta vs previous run)

Installed as aegis402-monitor.{service,timer} on the VPS with hardened
systemd sandbox (NoNewPrivileges, ProtectSystem=strict, ReadWritePaths
limited to data/). Timer active, first run green: cves=500, mcp=ok,
x402 challenge returns 402 with payTo=0x3D1F...4ff6, balance=0 USDC.
This commit is contained in:
Kaouani Jaouad
2026-04-13 13:20:31 +02:00
parent ca764b6766
commit 6df6b80a68
5 changed files with 259 additions and 0 deletions
+18
View File
@@ -0,0 +1,18 @@
[Unit]
Description=Aegis402 monitoring probe
After=network-online.target
[Service]
Type=oneshot
User=aegis
Group=aegis
WorkingDirectory=/home/aegis/aegis402
EnvironmentFile=/etc/aegis402.env
ExecStart=/home/aegis/aegis402/venv/bin/python deploy/monitor.py
StandardOutput=journal
StandardError=journal
NoNewPrivileges=yes
PrivateTmp=yes
ProtectSystem=strict
ReadWritePaths=/home/aegis/aegis402/data
ProtectHome=read-only