-
Notifications
You must be signed in to change notification settings - Fork 3
Installation and Setup
This guide covers the full setup of Hybrid R-Sentry on Kali Linux.
- Kali Linux (tested on latest)
- Python 3.13
- Node.js 22
- Docker & Docker Compose
- Git
For eBPF sensor (default mode):
- Linux kernel ≥ 6.19 (
uname -rto check) - BCC 0.35 + kernel headers:
sudo apt install python3-bpfcc bpfcc-tools linux-headers-$(uname -r) -y
If your kernel is older than 6.19 or BCC install fails, set
SENSOR_BACKEND=inotifyin.envand the system will fall back to the watchdog-based sensor automatically.
git clone https://github.com/Mohhudib/hybrid-rsentry.git
cd hybrid-rsentrysudo apt install python3-bpfcc bpfcc-tools linux-headers-$(uname -r) -yThis is required for the default eBPF sensor backend. Skip this step and set SENSOR_BACKEND=inotify in .env if your kernel is below 6.19.
Verify your kernel version:
uname -r # must be ≥ 6.19.0bash setup.shsetup.sh handles everything automatically:
- Installs system packages (
python3-venv,libpq-dev,iptables,nodejs,npm, etc.) - Creates the Python virtual environment at
./venv - Installs all Python dependencies from
requirements.txt - Installs all Node/React dependencies in
frontend/ - Copies
.env.exampleto.envif it doesn't already exist
nano .envYou must fill in:
-
POSTGRES_PASSWORD— choose a strong password -
DATABASE_URL— update the password to match -
NVIDIA_API_KEY— your AI provider API key -
NVIDIA_API_KEY_ALERTS— second AI API key (can be the same if you only have one) -
WATCH_PATH— a directory outside the project folder (e.g./home/your-username/Documents)
See the Configuration page for the full variable reference.
bash start.shstart.sh starts all five processes in the correct order and logs to /tmp/rsentry-*.log. Press Ctrl+C to stop all services cleanly.
http://localhost:3000
Once the venv and node_modules are installed, just run:
bash start.shUse this when you need to see each process's output in its own terminal.
Terminal 1 — Infrastructure
cd ~/hybrid-rsentry && docker compose up -dTerminal 2 — Backend
cd ~/hybrid-rsentry
set -a && source .env && set +a
source venv/bin/activate
uvicorn backend.main:app --reloadTerminal 3 — Celery Workers
cd ~/hybrid-rsentry
set -a && source .env && set +a
source venv/bin/activate
PYTHONPATH=. celery -A backend.workers.tasks:celery_app worker --loglevel=infoTerminal 4 — Agent
eBPF sensor (default — kernel ≥ 6.19 + BCC required):
cd ~/hybrid-rsentry
set -a && source .env && set +a
sudo -E venv/bin/python -m agent.monitorWait until: [ebpf] mode=enforce lsm=True … then [ebpf] BPF loaded.
inotify fallback (any kernel, no BCC needed):
cd ~/hybrid-rsentry
set -a && source .env && set +a
SENSOR_BACKEND=inotify sudo -E venv/bin/python -m agent.monitorWait until: Monitor running. Press Ctrl+C to stop.
sudo -Eis mandatory — it preservesWATCH_PATHand the AI keys through the privilege boundary. Without-E, sudo strips env vars and the agent watches the wrong path.
Terminal 5 — Frontend
cd ~/hybrid-rsentry/frontend && npm startWait until: VITE v5.x.x ready in … ms and Local: http://localhost:3000/
- Dashboard shows the LIVE connection indicator
- Agent log shows canary files being placed:
tail -f /tmp/rsentry-agent.log - Backend log shows heartbeat events arriving:
tail -f /tmp/rsentry-backend.log - Celery log shows tasks being received:
tail -f /tmp/rsentry-celery.log
Run the one-command pipeline test to verify the full detection flow:
bash test_event.shThis sends a CANARY_TOUCHED event and verifies a CRITICAL alert + AI analysis is produced end-to-end.
When SENSOR_BACKEND=ebpf (the default), the agent uses the kernel-level sensor for sub-millisecond detection. There are two optional enhancements:
tail -f /tmp/rsentry-agent.log
# Should show: [ebpf] mode=enforce lsm=True threshold=2 window=3.0s
# If it shows BCC import error, run: sudo apt install python3-bpfcc bpfcc-tools linux-headers-$(uname -r) -yWithout BPF LSM, detection fires after the rename. With BPF LSM, canary renames are blocked before any bytes are overwritten (-EPERM in nanoseconds):
# Edit grub config
sudo nano /etc/default/grub
# Add lsm=bpf to GRUB_CMDLINE_LINUX:
# GRUB_CMDLINE_LINUX="lsm=bpf"
sudo update-grub && sudo reboot# Add to .env:
SENSOR_BACKEND=inotify
# Then restart the agent only (other services don't need to restart)| Symptom | Cause | Fix |
|---|---|---|
Agent watches wrong path / monitors all of /home
|
sudo stripped env vars |
Always use sudo -E after sourcing .env
|
| Agent log empty after start | BCC not installed | sudo apt install python3-bpfcc bpfcc-tools linux-headers-$(uname -r) -y |
| Backend port 8000 in use after git pull | Old uvicorn still running | sudo pkill -f uvicorn && bash start.sh |
| Frontend port 3000 already in use | Previous node process | kill $(lsof -t -i:3000) 2>/dev/null && bash start.sh |
npm install fails with ENOTEMPTY |
Corrupted node_modules | rm -rf frontend/node_modules && cd frontend && npm install |
| CRITICAL alerts not auto-containing | Celery worker down |
tail /tmp/rsentry-celery.log — source .env before starting Celery |
See the Known Issues & Fixes page for the full list of problems and solutions.
If started with start.sh: press Ctrl+C — all processes stop cleanly.
If started manually:
-
Ctrl+Cin each terminal (frontend, agent, Celery, backend) -
docker compose downto stop PostgreSQL and Redis
Never run
docker compose down -v— the-vflag deletes the Postgres data volume and all stored events and alerts.