From bca0ba5adaa36d51023a4ba0d07c843918611f5a Mon Sep 17 00:00:00 2001 From: CyberMind-FR Date: Tue, 27 Jan 2026 12:34:50 +0100 Subject: [PATCH] fix(multi): CrowdSec health check, MetaBlogizer menu, Portal apps - CrowdSec Dashboard: Add bouncer_count, geoip_enabled, acquisition_count, scenario_count fields to get_overview and get_health_check RPCD functions - MetaBlogizer: Fix menu path to admin/secubox/services/metablogizer - Portal: Add MetaBlogizer and Gitea to apps registry for services section Co-Authored-By: Claude Opus 4.5 --- .../usr/libexec/rpcd/luci.crowdsec-dashboard | 45 ++++++++++++++++++- .../luci/menu.d/luci-app-metablogizer.json | 6 +-- .../resources/secubox-portal/portal.js | 24 ++++++++++ 3 files changed, 71 insertions(+), 4 deletions(-) diff --git a/package/secubox/luci-app-crowdsec-dashboard/root/usr/libexec/rpcd/luci.crowdsec-dashboard b/package/secubox/luci-app-crowdsec-dashboard/root/usr/libexec/rpcd/luci.crowdsec-dashboard index a791d7a4..dfe646da 100755 --- a/package/secubox/luci-app-crowdsec-dashboard/root/usr/libexec/rpcd/luci.crowdsec-dashboard +++ b/package/secubox/luci-app-crowdsec-dashboard/root/usr/libexec/rpcd/luci.crowdsec-dashboard @@ -1816,6 +1816,7 @@ get_health_check() { cs_running=1 fi json_add_boolean "crowdsec_running" "$cs_running" + json_add_string "crowdsec" "$([ "$cs_running" = "1" ] && echo running || echo stopped)" # Version local version="" @@ -1908,6 +1909,27 @@ get_health_check() { json_add_int "local_decisions" "${local_decisions:-0}" json_add_int "capi_decisions" "${capi_decisions:-0}" + # GeoIP status - check if GeoIP database exists + local geoip_enabled=0 + [ -f "/var/lib/crowdsec/data/GeoLite2-City.mmdb" ] && geoip_enabled=1 + [ -f "/var/lib/crowdsec/data/GeoLite2-ASN.mmdb" ] && geoip_enabled=1 + json_add_boolean "geoip_enabled" "$geoip_enabled" + + # Acquisition sources count + local acquisition_count=0 + if [ -d "/etc/crowdsec/acquis.d" ]; then + acquisition_count=$(ls -1 /etc/crowdsec/acquis.d/*.yaml 2>/dev/null | wc -l) + fi + [ -f "/etc/crowdsec/acquis.yaml" ] && acquisition_count=$((acquisition_count + 1)) + json_add_int "acquisition_count" "${acquisition_count:-0}" + + # Scenario count (installed scenarios) + local scenario_count=0 + if [ -x "$CSCLI" ]; then + scenario_count=$(run_cscli scenarios list -o json 2>/dev/null | jsonfilter -e '@[*]' 2>/dev/null | wc -l) + fi + json_add_int "scenario_count" "${scenario_count:-0}" + json_dump } @@ -2192,7 +2214,28 @@ get_overview() { json_add_int "local_decisions" "${local_decisions:-0}" json_add_int "capi_decisions" "${capi_decisions:-0}" json_add_int "alerts_24h" "${alerts_count:-0}" - json_add_int "bouncers" "${bouncers_count:-0}" + json_add_int "bouncer_count" "${bouncers_count:-0}" + + # GeoIP status - check if GeoIP database exists + local geoip_enabled=0 + [ -f "/var/lib/crowdsec/data/GeoLite2-City.mmdb" ] && geoip_enabled=1 + [ -f "/var/lib/crowdsec/data/GeoLite2-ASN.mmdb" ] && geoip_enabled=1 + json_add_boolean "geoip_enabled" "$geoip_enabled" + + # Acquisition sources count + local acquisition_count=0 + if [ -d "/etc/crowdsec/acquis.d" ]; then + acquisition_count=$(ls -1 /etc/crowdsec/acquis.d/*.yaml 2>/dev/null | wc -l) + fi + [ -f "/etc/crowdsec/acquis.yaml" ] && acquisition_count=$((acquisition_count + 1)) + json_add_int "acquisition_count" "${acquisition_count:-0}" + + # Scenario count (installed scenarios) + local scenario_count=0 + if [ "$cs_running" = "1" ] && [ -x "$CSCLI" ]; then + scenario_count=$(run_cscli scenarios list -o json 2>/dev/null | jsonfilter -e '@[*]' 2>/dev/null | wc -l) + fi + json_add_int "scenario_count" "${scenario_count:-0}" # Top scenarios (from cached/limited alerts) local scenarios="" diff --git a/package/secubox/luci-app-metablogizer/root/usr/share/luci/menu.d/luci-app-metablogizer.json b/package/secubox/luci-app-metablogizer/root/usr/share/luci/menu.d/luci-app-metablogizer.json index 893c02c7..78a610ac 100644 --- a/package/secubox/luci-app-metablogizer/root/usr/share/luci/menu.d/luci-app-metablogizer.json +++ b/package/secubox/luci-app-metablogizer/root/usr/share/luci/menu.d/luci-app-metablogizer.json @@ -1,5 +1,5 @@ { - "admin/services/metablogizer": { + "admin/secubox/services/metablogizer": { "title": "MetaBlogizer", "action": { "type": "view", @@ -11,7 +11,7 @@ }, "order": 85 }, - "admin/services/metablogizer/overview": { + "admin/secubox/services/metablogizer/overview": { "title": "Sites", "action": { "type": "view", @@ -19,7 +19,7 @@ }, "order": 10 }, - "admin/services/metablogizer/settings": { + "admin/secubox/services/metablogizer/settings": { "title": "Settings", "action": { "type": "view", diff --git a/package/secubox/luci-app-secubox-portal/htdocs/luci-static/resources/secubox-portal/portal.js b/package/secubox/luci-app-secubox-portal/htdocs/luci-static/resources/secubox-portal/portal.js index aaad20fe..a8d327f7 100644 --- a/package/secubox/luci-app-secubox-portal/htdocs/luci-static/resources/secubox-portal/portal.js +++ b/package/secubox/luci-app-secubox-portal/htdocs/luci-static/resources/secubox-portal/portal.js @@ -380,6 +380,30 @@ return baseclass.extend({ path: 'admin/services/nextcloud/overview', service: 'nextcloud', version: '28.0' + }, + 'metablogizer': { + id: 'metablogizer', + name: 'MetaBlogizer', + desc: 'KISS static site publisher with auto-vhost creation, QR codes, and social sharing', + icon: '\ud83d\udcdd', + iconBg: 'rgba(102, 126, 234, 0.15)', + iconColor: '#667eea', + section: 'services', + path: 'admin/secubox/services/metablogizer/overview', + service: null, + version: '1.0.0' + }, + 'gitea': { + id: 'gitea', + name: 'Gitea', + desc: 'Self-hosted Git service for code hosting, collaboration, and CI/CD', + icon: '\ud83d\udc19', + iconBg: 'rgba(34, 197, 94, 0.15)', + iconColor: '#22c55e', + section: 'services', + path: 'admin/secubox/services/gitea/overview', + service: 'gitea', + version: '1.22.0' } },