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

View File

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