admin / Synapse-Sonar
publicAttack Surface Simulation
Synapse-Sonar / synapse-sonar / public / agents / sensor / install.sh
1374 B · main
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | #!/usr/bin/env bash # Install the Synapse Sonar passive sensor on Debian / Ubuntu. # Run this on a host attached to a SPAN / mirror port. # Usage: sudo ./install.sh set -euo pipefail if [ "$(id -u)" -ne 0 ]; then echo "Please run as root (sudo ./install.sh)" >&2 exit 1 fi SRC="$(cd "$(dirname "$0")" && pwd)" echo "==> Ensuring dependencies (python3)" if command -v apt-get >/dev/null 2>&1; then apt-get update -qq apt-get install -y -qq python3 fi echo "==> Installing sensor to /opt/sonar-sensor" install -d /opt/sonar-sensor install -m 0755 "$SRC/sonar-sensor.py" /opt/sonar-sensor/sonar-sensor.py echo "==> Installing config to /etc/sonar-sensor" install -d /etc/sonar-sensor if [ ! -f /etc/sonar-sensor/sonar-sensor.env ]; then install -m 0640 "$SRC/sonar-sensor.env.example" /etc/sonar-sensor/sonar-sensor.env echo " -> created /etc/sonar-sensor/sonar-sensor.env (EDIT THIS before starting)" else echo " -> /etc/sonar-sensor/sonar-sensor.env already exists, leaving as-is" fi echo "==> Installing systemd unit" install -m 0644 "$SRC/sonar-sensor.service" /etc/systemd/system/sonar-sensor.service systemctl daemon-reload echo echo "Done. Next steps:" echo " 1. Edit /etc/sonar-sensor/sonar-sensor.env (SONAR_URL, SONAR_INGEST_KEY, SONAR_IFACE)" echo " 2. sudo systemctl enable --now sonar-sensor" echo " 3. journalctl -u sonar-sensor -f" |