secubox-openwrt/package/secubox/secubox-app-crowdsec-custom/files/99-secubox-app-crowdsec-custom
CyberMind-FR 3e52444a73 feat(crowdsec): Add custom CrowdSec scenarios package for SecuBox
- Add secubox-app-crowdsec-custom package with:
  - HTTP auth bruteforce detection
  - Path scanning detection
  - LuCI/uhttpd auth monitoring
  - Trusted IP whitelist for private networks
- Fix Lyrion Docker image path to ghcr.io/lms-community/lyrionmusicserver:stable

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-22 14:50:36 +01:00

37 lines
1.2 KiB
Bash

#!/bin/sh
# SecuBox CrowdSec Custom - First boot setup
# Configures logging for CrowdSec monitoring
# Enable uhttpd syslog logging
if command -v uci >/dev/null 2>&1; then
uci set uhttpd.main.syslog='1' 2>/dev/null
uci commit uhttpd 2>/dev/null
fi
# Ensure syslog writes to file for CrowdSec
if [ -f /etc/config/system ]; then
uci set system.@system[0].log_file='/var/log/messages' 2>/dev/null
uci set system.@system[0].log_size='512' 2>/dev/null
uci commit system 2>/dev/null
fi
# Restart logging service
/etc/init.d/log restart 2>/dev/null || true
# Restart uhttpd to apply logging changes
/etc/init.d/uhttpd restart 2>/dev/null || true
# Register firewall bouncer if not already registered
if [ -f /etc/crowdsec/bouncers/crowdsec-firewall-bouncer.yaml ]; then
if command -v cscli >/dev/null 2>&1; then
if ! cscli bouncers list 2>/dev/null | grep -q "firewall-bouncer"; then
API_KEY=$(cscli bouncers add firewall-bouncer -o raw 2>/dev/null)
if [ -n "$API_KEY" ]; then
sed -i "s/^api_key:.*/api_key: $API_KEY/" /etc/crowdsec/bouncers/crowdsec-firewall-bouncer.yaml
fi
fi
fi
fi
exit 0