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 <noreply@anthropic.com>
This commit is contained in:
CyberMind-FR 2026-01-13 13:49:59 +01:00
parent daacca2c3d
commit ca562f69cd
3 changed files with 10 additions and 2 deletions

View File

@ -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

View File

@ -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([]),

View File

@ -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"