-
Notifications
You must be signed in to change notification settings - Fork 3
Known Issues and Fixes
This page documents all significant problems encountered during development and how they were resolved.
Problem: pip install -r requirements.txt blocked by Kali's system Python protection.
Fix: Always use a virtual environment. setup.sh handles this automatically:
bash setup.shProblem: scipy 1.13.1 has no pre-built wheel for Python 3.13 on Kali. Compilation fails because libopenblas-dev and libatlas-base-dev don't exist on this Kali version.
Fix: setup.sh installs python3-scipy, python3-numpy, python3-pandas via apt and then installs from pip using --only-binary :all:. Emergency manual fix if needed:
sudo apt install -y python3-scipy python3-numpy python3-pandas
cp -r /usr/lib/python3/dist-packages/scipy venv/lib/python3.13/site-packages/
cp -r /usr/lib/python3/dist-packages/numpy venv/lib/python3.13/site-packages/
cp -r /usr/lib/python3/dist-packages/pandas venv/lib/python3.13/site-packages/Problem: asyncpg==0.29.0 is not available for Python 3.13.
Fix: Use asyncpg==0.31.0 in requirements.txt. Already fixed.
Problem: venv was created with --system-site-packages, causing it to use system SQLAlchemy which couldn't see venv's asyncpg.
Fix: Recreate venv without --system-site-packages. Use venv/bin/uvicorn explicitly instead of system uvicorn.
Problem: Celery fork workers don't inherit environment variables. DATABASE_URL is empty, causing ArgumentError: Could not parse SQLAlchemy URL.
Fix: tasks.py reads the .env file directly as plain text — no dotenv dependency needed:
def _env(key, default=""):
value = os.getenv(key, "")
if value:
return value
env_file = Path(__file__).resolve().parent.parent.parent / ".env"
if env_file.exists():
for line in env_file.read_text().splitlines():
if line.strip().startswith(f"{key}="):
return line.split("=", 1)[1].strip().strip('"').strip("'")
return defaultProblem: asyncio.run() breaks in forked Celery workers on Python 3.13.
Fix: Create a new event loop per task:
def _run(coro):
loop = asyncio.new_event_loop()
try:
return loop.run_until_complete(coro)
finally:
loop.close()Problem: Agent started with sudo drops environment variables, so WATCH_PATH is not set and defaults to /home (entire home directory).
Fix: Use sudo -E to preserve environment and source .env first:
cd ~/hybrid-rsentry && set -a && source .env && set +a
sudo -E ~/hybrid-rsentry/venv/bin/python -m agent.monitorProblem: When WATCH_PATH pointed inside the project directory, canary files named AAA_* ended up inside .git/refs/heads/, breaking git.
Three-layer prevention now in place (no longer occurs on new installs):
-
AAA_*.txtand**/AAA_*.txtexcluded in.gitignore -
_validate_watch_path()inmonitor.py— agent exits at startup with a clear error ifWATCH_PATHis inside a git repo -
_is_safe_target()inadaptive.py— Markov repositioner refuses to move canaries into.git/,/proc/,/sys/,/dev/,/run/
Emergency fix if corruption has already occurred:
find ~/hybrid-rsentry/.git/refs -name "AAA_*" -delete
git pull origin mainProblem: backend/workers/tasks.py was committed as an empty file. All Celery tasks were missing, causing ImportError on startup.
Fix: File was fully rebuilt from scratch and pushed via GitHub API.
Problem: agent/graph.py was empty, causing ImportError: cannot import name 'FilesystemGraph'.
Fix: FilesystemGraph class rebuilt from scratch with BFS canary placement and orphan cleanup.
Problem: StatsBar used limit: 500 and counted array length. AlertFeed fetched all alerts including acknowledged ones. Numbers didn't match.
Fix:
- Added
/api/alerts/countsbackend endpoint returning exact counts with no limit -
StatsBarnow uses this endpoint -
AlertFeednow filtersacknowledged: falseand removes alerts immediately on ACK
Problem: Agent was generating hundreds of ENTROPY_SPIKE alerts from Firefox browser cache activity because:
-
WATCH_PATHdefaulted to/home(entire home dir) -
lineage.pylistedpython,bash,shas suspicious parents — everything on Linux -
lineage.pylisted/.cache/as a suspicious spawn path — matched Firefox
Fix:
- Added
WATCH_PATH=/home/mohammad/Documentsto.env - Removed
python,bash,shfrom suspicious parents inlineage.py - Removed
/.cache/from suspicious spawn paths inlineage.py - Created
agent/exceptions.pywith comprehensive whitelist - Added whitelist check at start of
monitor._handle_event()
Problem: Multiple Celery workers calling NVIDIA API simultaneously triggers rate limiting.
Fix: Lua-based atomic Redis rate limiter in ai_analyst.py enforces minimum delay between calls per provider. Two separate API keys (events vs alerts) prevent them from blocking each other. Cerebras (AI_API_KEY_CEREBRAS) can be added as the primary provider with higher rate limits.
Problem: tasks.py was publishing final AI results as ai_analysis_update but App.jsx only handled ai_analysis. Analysis cards never appeared.
Fix: App.jsx now handles both ai_analysis and ai_analysis_update message types.
Problem: Acknowledging alerts via bulk SQL or ACK button did not trigger update_host_risk, so risk score stayed at 100.
Fix: acknowledge_alert endpoint now calls update_host_risk.delay(host_id) after each acknowledgment.
Problem: analyze_alert endpoint was passing event_id instead of alert_id to the analyze_alert_ai Celery task. Auto-acknowledge after AI analysis never fired.
Fix: Endpoint now passes the correct alert_id. The event_id is embedded in event_data so the AI Analyst page can still match and render the correct card.
Problem: Vite grabbed a different port (e.g. port 3002) because port 3000 was already occupied. api/client.js had a hardcoded http://localhost:8000 base URL, bypassing the Vite proxy. The backend's CORS policy only allowed port 3000, so all requests from port 3002 were blocked.
Symptom: Dashboard loads but no alerts or events appear. Browser console shows CORS errors.
Fix: Changed client.js base URL from 'http://localhost:8000' to '' (empty string). Axios now uses relative paths (/api/...) which Vite proxies to port 8000 regardless of which port Vite is on.
Also fix the port conflict:
sudo pkill -f uvicorn && sudo pkill -f celery && sudo pkill -f agent.monitor
kill $(lsof -t -i:3000) 2>/dev/null
sleep 2 && bash start.shProblem: After git pull, old root-owned uvicorn was still holding port 8000. New start.sh backend failed silently with [Errno 98] Address already in use. Frontend hit the old stale backend with stale data.
Symptom: tail /tmp/rsentry-backend.log shows ERROR: [Errno 98] Address already in use
Fix: Always kill all running processes before restarting after a pull:
sudo pkill -f uvicorn
sudo pkill -f celery
sudo pkill -f "agent.monitor"
kill $(lsof -t -i:3000) 2>/dev/null
sleep 2
bash start.shProblem: update_host_risk was called from events.py at the same time as auto_ack_containment, so the risk recalculation raced against the acknowledgment write — the score often recalculated before the alerts were marked acknowledged and stayed elevated.
Fix: Removed update_host_risk.delay() from events.py. It is now called at the end of auto_ack_containment and auto_ack_by_event, after the DB commit, so the score always reflects the cleared alert state.
Problem: LockBit 5.0 and Qilin encrypt 1 000+ files in under 1 second using a create-new + delete-original pattern (not os.rename()). The rename velocity tracker never fires. BPF behavioral score reached 60 (above SCORE_ALERT=50, below SCORE_BLOCK=70). Python _handle_behavior required entropy >= 6.5 to trigger containment, but files were already deleted/restored before the 1 ms poll ran — entropy read as 0.0.
Fix (v2.2.0):
-
Signal 6 added to
__calc_score:del_per_sec >= 20 && files_deleted >= 5 → +15. Pushes score 60 → 75, crossingSCORE_BLOCKbefore thealertedflag is set. -
_block_on_unlink_scoreinjected into__handle_unlink: whenscore >= SCORE_BLOCK, PID is immediately written toblocked_pidsBPF map at the kernel level. -
Entropy gate relaxed in
_handle_behavior:if entropy >= 6.5 or ev.score >= 70:— high-confidence kernel scores now trigger SIGSTOP without a readable sample file.
Problem: After a docker compose up that includes the production frontend container (rsentry_frontend mapped to 0.0.0.0:3000→80/tcp), the Vite dev server cannot bind port 3000.
Symptom: npm start exits with Error: listen EADDRINUSE: address already in use :::3000
Fix:
docker stop rsentry_frontend
cd ~/hybrid-rsentry/frontend && npm startProblem: agent.monitor defaults to SENSOR_BACKEND=ebpf but python3-bpfcc was not installed. The agent starts and logs backend=eBPF mode=enforce but immediately exits — no events are detected.
Symptom: tail /tmp/rsentry-agent.log shows something like [ebpf] python3-bpfcc not installed or the log file stays empty after agent start.
Fix:
sudo apt install python3-bpfcc bpfcc-tools -yThen restart the agent. Temporary workaround (no restart needed for other services):
# Add to .env
SENSOR_BACKEND=inotify
# Then restart just the agent
sudo pkill -f agent.monitor
cd ~/hybrid-rsentry && set -a && source .env && set +a && sudo -E ~/hybrid-rsentry/venv/bin/python -m agent.monitorProblem: npm install failed with ENOTEMPTY: directory not empty, rename node_modules/typescript.
Fix:
rm -rf node_modules
npm install