fix(security-threats): Detect DPI from netifyd when ndpid not installed

The threat monitor now checks netifyd_running and dpi_available fields
in addition to ndpid running status. This fixes the "nDPId not running"
warning when only netifyd is installed.

- Check ndpid.running OR netifyd_running OR dpi_available
- Show flow count in DPI service badge
- Rename badge from "nDPId" to "DPI" for clarity

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
CyberMind-FR 2026-01-31 18:59:49 +01:00
parent 7b67b0329a
commit 0dd406d517
2 changed files with 13 additions and 4 deletions

View File

@ -356,12 +356,13 @@ function getDashboardData() {
callGetStatsByType(),
callGetBlockedIPs(),
callGetSecurityStats(),
callNdpidStatus().catch(function() { return { running: false }; }),
callNdpidStatus().catch(function() { return { running: false, dpi_available: false }; }),
callNdpidFlows().catch(function() { return { flows: [] }; }),
callNdpidTopApps().catch(function() { return { applications: [] }; })
]).then(function(results) {
var ndpidFlows = results[6].flows || [];
var ndpidApps = results[7].applications || [];
var ndpidStatus = results[5] || {};
// Build device list from ndpid flows
var devicesMap = {};
@ -403,6 +404,10 @@ function getDashboardData() {
return dev;
});
// DPI is available if either ndpid or netifyd is running
var dpiRunning = ndpidStatus.running || ndpidStatus.netifyd_running || ndpidStatus.dpi_available || false;
var dpiUptime = ndpidStatus.uptime || ndpidStatus.netifyd_uptime || 0;
return {
status: results[0] || {},
threats: results[1].threats || [],
@ -410,8 +415,11 @@ function getDashboardData() {
blocked: results[3].blocked || [],
securityStats: results[4] || {},
ndpid: {
running: results[5].running || false,
uptime: results[5].uptime || 0
running: dpiRunning,
uptime: dpiUptime,
ndpid_running: ndpidStatus.running || false,
netifyd_running: ndpidStatus.netifyd_running || false,
flow_count: ndpidStatus.flow_count || 0
},
devices: devices,
topApps: ndpidApps,

View File

@ -86,7 +86,8 @@ return L.view.extend({
'🛡️ CrowdSec'
]),
E('span', { 'class': 'service-badge ' + (ndpid.running ? 'active' : 'inactive') }, [
'📡 nDPId'
'📡 DPI',
ndpid.flow_count ? ' (' + ndpid.flow_count + ')' : ''
])
])
]),