From ca562f69cd2234eabda3a5cf63ee2c30d78186af Mon Sep 17 00:00:00 2001 From: CyberMind-FR Date: Tue, 13 Jan 2026 13:49:59 +0100 Subject: [PATCH] fix(crowdsec): Restart CrowdSec after console enrollment - Add automatic restart after successful console enrollment - Update wizard UI to inform user about validation on app.crowdsec.net - Service must restart after enrollment is validated on CrowdSec Console Co-Authored-By: Claude Opus 4.5 --- package/secubox/luci-app-crowdsec-dashboard/Makefile | 2 +- .../luci-static/resources/view/crowdsec-dashboard/wizard.js | 4 +++- .../root/usr/libexec/rpcd/luci.crowdsec-dashboard | 6 ++++++ 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/package/secubox/luci-app-crowdsec-dashboard/Makefile b/package/secubox/luci-app-crowdsec-dashboard/Makefile index 812e4289..6531e4a6 100644 --- a/package/secubox/luci-app-crowdsec-dashboard/Makefile +++ b/package/secubox/luci-app-crowdsec-dashboard/Makefile @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=luci-app-crowdsec-dashboard PKG_VERSION:=0.7.0 -PKG_RELEASE:=23 +PKG_RELEASE:=24 PKG_ARCH:=all PKG_LICENSE:=Apache-2.0 diff --git a/package/secubox/luci-app-crowdsec-dashboard/htdocs/luci-static/resources/view/crowdsec-dashboard/wizard.js b/package/secubox/luci-app-crowdsec-dashboard/htdocs/luci-static/resources/view/crowdsec-dashboard/wizard.js index 7823a4db..dff407b9 100644 --- a/package/secubox/luci-app-crowdsec-dashboard/htdocs/luci-static/resources/view/crowdsec-dashboard/wizard.js +++ b/package/secubox/luci-app-crowdsec-dashboard/htdocs/luci-static/resources/view/crowdsec-dashboard/wizard.js @@ -342,7 +342,9 @@ return view.extend({ 'input': function(ev) { self.config.machineName = ev.target.value; } }), E('p', { 'style': 'margin: 8px 0 0 0; font-size: 0.85em; color: #64748b;' }, [ - _('Note: Hub update requires CAPI connection.') + _('After enrollment, validate on '), + E('a', { 'href': 'https://app.crowdsec.net', 'target': '_blank', 'style': 'color: #818cf8;' }, 'app.crowdsec.net'), + _('. Service will restart automatically.') ]) ]) : E([]), 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 c0ba33d0..114e6354 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 @@ -1415,6 +1415,12 @@ console_enroll() { run_cscli console enable share_manual_decisions >/dev/null 2>&1 run_cscli console enable share_tainted >/dev/null 2>&1 run_cscli console enable share_context >/dev/null 2>&1 + + # Restart CrowdSec to activate enrollment + # Note: User must validate enrollment on app.crowdsec.net first + secubox_log "Restarting CrowdSec to apply enrollment..." + /etc/init.d/crowdsec restart >/dev/null 2>&1 & + json_add_boolean "restart_triggered" 1 else json_add_boolean "success" 0 json_add_string "error" "Enrollment failed"