[Unit] Description=WhatsApp CRM Evolution watchdog (deep health check + safe, non-destructive recovery) Documentation=file:/home/raitoai/public_html/whatsapp/ops/README.md After=docker.service Wants=docker.service [Service] Type=oneshot # Optional overrides (APP_DIR, PHP_BIN, container names, thresholds): EnvironmentFile=-/etc/evolution-watchdog.env ExecStart=/usr/local/sbin/evolution-watchdog.sh Nice=10 # ── Hardening ──────────────────────────────────────────────────────────────── # Chosen NOT to block the operations the watchdog legitimately needs: talking to # the Docker socket (/run/docker.sock), running `systemctl restart docker`, # reading iptables, and running `php artisan` under /home. # - ProtectHome=false : the Laravel app lives under /home/raitoai. # - ProtectSystem=full : /usr,/boot,/etc read-only (leaves /var,/run writable # for the docker socket, logs and state). # - ReadWritePaths : explicit writable paths (survives a future # ProtectSystem=strict). # - NoNewPrivileges=true : the script/docker/systemctl need no setuid escalation. # - PrivateTmp=true : isolates the /tmp health JSON it writes+reads. NoNewPrivileges=true PrivateTmp=true ProtectHome=false ProtectSystem=full ProtectControlGroups=true ProtectKernelTunables=true ReadWritePaths=/var/log/evolution-watchdog.log /var/lib/evolution-watchdog /run /var/run # The script itself only performs the allow-listed, non-destructive actions.