Repository navigation
Remote Sensors
Remote sensors extend leetha's visibility to network segments it can't capture on directly. A sensor is a lightweight binary that runs on a remote device, captures raw packets, and streams them back to leetha over an encrypted WebSocket connection. Packets from remote sensors flow through the same fingerprinting pipeline as local capture -- same parsers, same processors, same verdict engine.
Remote Device Leetha Server
+-------------------+ +-------------------+
| leetha-sensor | WSS (mTLS) | Sensor Listener |
| | ===============> | (:8443) |
| - pcap capture | binary frames | |
| - per-interface | + heartbeats | -> _classify() |
| threads | + discovery | -> packet_queue |
| - heartbeat 30s | | -> pipeline |
+-------------------+ <============== | -> store / UI |
control msgs +-------------------+
(capture_start,
capture_stop)
- Sensor connects to leetha over WebSocket with mutual TLS (mTLS). Both sides authenticate using certificates signed by leetha's internal CA.
- Discovery -- the sensor reports all available network interfaces with IP addresses and link state.
- Idle by default -- the sensor starts idle and waits for the user to select interfaces from the dashboard.
-
Capture start -- the user selects interfaces in the UI; the server sends a
capture_startcommand. The sensor spawns one capture thread per interface. - Packet streaming -- captured frames are serialized (16-byte header + raw L2 frame) and sent as WebSocket binary messages.
-
Heartbeat -- every 30 seconds, the sensor sends per-interface packet and byte counts. If the server doesn't hear from a sensor for 90 seconds, it emits a
sensor_disconnectfinding. - Reconnect -- if the connection drops, the sensor reconnects with exponential backoff. The server re-sends the previously saved interface selection so capture resumes automatically.
-
Rust toolchain --
rustcandcargo. Install via rustup:curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
-
For cross-compilation (ARM64, ARM, MIPS targets):
-
cross --
cargo install cross -
Docker -- required by
crossfor containerized toolchains. Install Docker
-
cross --
- Linux with raw socket access (root, sudo, or
CAP_NET_RAW) - Network connectivity to the leetha server on port 8443
- Navigate to Adapters > Remote Sensors tab
- Click Build Sensor
- Fill in the build form:
-
Sensor Name -- a unique identifier (e.g.,
dmz-sensor,iot-vlan) - Server Address -- the IP and port the sensor will connect back to (auto-populated from the server's interfaces)
-
Target Platform -- select the architecture matching the remote device:
- Linux x86_64 -- standard servers, VMs, desktops
- Linux ARM64 -- Ubiquiti Dream Machine Pro/SE, Raspberry Pi 4/5, modern ARM servers
- Linux ARM (32-bit) -- Raspberry Pi 2/3, older ARM devices
- Linux MIPS -- embedded devices, some routers
- Windows x86_64 -- Windows servers
- Buffer (MB) -- ring buffer size for offline packet storage during connection loss (default: 100 MB)
-
Sensor Name -- a unique identifier (e.g.,
- Click Build -- the build log streams in real-time
- Download the binary when the build completes
leetha remote ca init # initialize the certificate authority (first time only)
leetha remote ca issue my-sensor # issue a certificate for the sensorThen compile the sensor manually:
cd sensor/
cargo build --release --target x86_64-unknown-linux-muslscp leetha-sensor user@remote-host:/opt/leetha/
ssh user@remote-host
chmod +x /opt/leetha/leetha-sensor
sudo /opt/leetha/leetha-sensor -vThe sensor connects to the server, reports its interfaces, and waits for capture instructions.
The UDM Pro runs ARM64 Linux with SSH access:
# Build for ARM64 in the dashboard, then:
scp leetha-sensor root@<udm-ip>:/data/leetha-sensor
ssh root@<udm-ip>
chmod +x /data/leetha-sensor
/data/leetha-sensor -v -i br0-
/data/persists across firmware updates -
br0is the main LAN bridge -- sees all inter-VLAN and broadcast traffic
To run on boot, create /data/on_boot.d/10-leetha-sensor.sh:
#!/bin/sh
nohup /data/leetha-sensor -i br0 -d &Switches don't support running binaries directly. Use port mirroring instead:
- In the UniFi controller: Settings > Traffic Management > Mirror
- Set the mirror source to the target port or VLAN
- Set the mirror destination to a port connected to a sensor host
- Run the sensor on that host, capturing on the mirrored interface
Build for Linux ARM64 (Pi 4/5) or Linux ARM (Pi 2/3):
scp leetha-sensor pi@raspberrypi:/home/pi/
ssh pi@raspberrypi
chmod +x leetha-sensor
sudo ./leetha-sensor -vDeploy directly on the Proxmox host to capture on virtual bridges (vmbr0, vmbr1):
scp leetha-sensor root@proxmox:/opt/leetha-sensor
ssh root@proxmox
chmod +x /opt/leetha-sensor
/opt/leetha-sensor -v -i vmbr0This gives visibility into LXC container and VM traffic that stays on the bridge.
Once a sensor connects and appears in the Remote Sensors tab:
- Each discovered interface is listed with its name, IP addresses, and UP/DOWN status
- Toggle the switch next to each interface you want to capture on
- Click Start Capture
- The sensor starts capturing and reports per-interface packet counts via heartbeat
Interface selections are persisted -- if the sensor reconnects, capture resumes automatically on the previously selected interfaces.
Click Stop Capture in the sensor card. The sensor stops all capture threads and returns to idle.
Click Disconnect to forcibly close the sensor connection. The sensor will attempt to reconnect.
leetha-sensor [OPTIONS]
Options:
-s, --server <IP:PORT> Override embedded server address
-i, --interface <NAME> Override interface (bypasses server control, captures immediately)
-d, --daemon Run as background daemon (Linux only)
-v, --verbose Increase verbosity (-v for info, -vv for debug)
-V, --version Show version and embedded config
-h, --help Show help
# Default: connect to server, wait for interface selection
sudo ./leetha-sensor -v
# Override interface (legacy mode, captures immediately)
sudo ./leetha-sensor -v -i eth0
# Override server address
sudo ./leetha-sensor -v -s 10.0.0.5:8443
# Run as daemon
sudo ./leetha-sensor -dWhen using -i, the sensor starts capturing immediately without waiting for server instructions. This is useful for quick testing or when you want a specific interface without using the dashboard.
All sensor connections use mutual TLS:
- Server certificate -- auto-generated and signed by leetha's internal CA. Includes all server IP addresses in the SAN.
- Client certificate -- issued per sensor during the build process. Embedded in the binary at compile time.
- CA verification -- the sensor verifies the server's certificate against the embedded CA, and the server verifies the sensor's certificate. Unknown or revoked certificates are rejected.
When rebuilding a sensor with the same name, the old certificate is automatically revoked. A sensor with a revoked certificate cannot connect.
- Verify the server address is correct:
./leetha-sensor -Vto see embedded config - Check that port 8443 is reachable:
nc -zv <server-ip> 8443 - Ensure leetha is running with the sensor listener active (check logs for "sensor listener started")
- If the server's IP changed, delete the old server cert and restart leetha:
The server cert regenerates automatically with current IP addresses.
rm ~/.leetha/ca/server.crt ~/.leetha/ca/server.key
- Ensure the process thread is running (check leetha logs for "Process thread initialized")
- Verify you've selected interfaces and clicked Start Capture in the dashboard
- Check the sensor's heartbeat in the UI for per-interface packet counts
- If using the
anyinterface, note that promiscuous mode is not supported -- use a specific interface for full visibility
- Check for certificate revocation: rebuild the sensor if the cert was revoked
- Check the heartbeat interval -- the server expects a heartbeat every 90 seconds
- Ensure the network path between sensor and server is stable
- Ensure Docker is running:
docker info - Ensure
crossis installed:cargo install cross - For ARM64: the first build may take longer as Docker pulls the cross-compilation image
Leetha generates findings for sensor lifecycle events:
| Finding | Severity | When |
|---|---|---|
sensor_connect |
INFO | A remote sensor establishes a connection |
sensor_disconnect |
WARNING | A sensor disconnects or fails to send a heartbeat within 90 seconds |
These findings appear in the Detections page and trigger notifications if configured.