netpulse.service 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. # NetPulse — unit systemd
  2. # NOTA: la skill 'infraestructura' del usuario refinará este fichero en el
  3. # despliegue real (puerto 80 con CAP_NET_BIND_SERVICE, reverse proxy HTTPS, etc).
  4. # Esta unidad es el punto de partida razonable: usuario dedicado, hardening
  5. # básico y arranque tras la red.
  6. #
  7. # Instalación:
  8. # sudo useradd --system --home /opt/netpulse --shell /usr/sbin/nologin netpulse
  9. # sudo cp deploy/netpulse.service /etc/systemd/system/
  10. # sudo systemctl daemon-reload && sudo systemctl enable --now netpulse
  11. [Unit]
  12. Description=NetPulse — dashboard de monitorización de red doméstica
  13. After=network-online.target
  14. Wants=network-online.target
  15. [Service]
  16. Type=simple
  17. User=netpulse
  18. Group=netpulse
  19. WorkingDirectory=/opt/netpulse/server
  20. EnvironmentFile=/opt/netpulse/server/.env
  21. # NODE_ENV ya viene en .env; descomentar para forzar:
  22. #Environment=NODE_ENV=production
  23. ExecStart=/usr/bin/node src/index.js
  24. Restart=on-failure
  25. RestartSec=3
  26. # Hardening
  27. NoNewPrivileges=true
  28. PrivateTmp=true
  29. ProtectSystem=strict
  30. # La DB vive en DATA_DIR; el auto-actualizador escribe en todo /opt/netpulse
  31. ReadWritePaths=/opt/netpulse
  32. # NOTA modo live: ProtectHome=true impide leer claves SSH bajo /home o /root.
  33. # Coloca la clave de los routers en /opt/netpulse/server/data/.ssh (o ajusta
  34. # SSH_KEY_PATH + ReadWritePaths/ProtectHome en consecuencia).
  35. ProtectHome=true
  36. ProtectKernelTunables=true
  37. ProtectKernelModules=true
  38. ProtectControlGroups=true
  39. RestrictSUIDSGID=true
  40. LockPersonality=true
  41. [Install]
  42. WantedBy=multi-user.target