mirror of
https://github.com/ntop/ntopng.git
synced 2026-05-03 09:20:10 +00:00
add notification for unexpected plugins (#4659)
This commit is contained in:
parent
109c79eafa
commit
cf16003826
18 changed files with 184 additions and 153 deletions
|
|
@ -5,11 +5,13 @@
|
|||
local user_scripts = require("user_scripts")
|
||||
local flow_consts = require("flow_consts")
|
||||
|
||||
local UNEXPECTED_PLUGINS_ENABLED_CACHE_KEY = "ntopng.cache.user_scripts.unexpected_plugins_enabled"
|
||||
|
||||
-- #################################################################
|
||||
|
||||
local script = {
|
||||
-- Script category
|
||||
category = user_scripts.script_categories.security,
|
||||
category = user_scripts.script_categories.security,
|
||||
|
||||
-- Priority
|
||||
prio = -20, -- Lower priority (executed after) than default 0 priority
|
||||
|
|
@ -46,7 +48,7 @@ function script.hooks.protocolDetected(now, conf)
|
|||
local ok = 0
|
||||
local flow_info = flow.getInfo()
|
||||
local server_ip = flow_info["srv.ip"]
|
||||
|
||||
|
||||
for _, smtp_ip in pairs(conf.items) do
|
||||
if server_ip == smtp_ip then
|
||||
ok = 1
|
||||
|
|
@ -70,4 +72,14 @@ end
|
|||
|
||||
-- #################################################################
|
||||
|
||||
function script.onEnable(hook, hook_config)
|
||||
-- Set a flag to indicate to the notifications system that an unexpected plugin
|
||||
-- has been enabled
|
||||
if isEmptyString(ntop.getCache(UNEXPECTED_PLUGINS_ENABLED_CACHE_KEY)) then
|
||||
ntop.setCache(UNEXPECTED_PLUGINS_ENABLED_CACHE_KEY, "1")
|
||||
end
|
||||
end
|
||||
|
||||
-- #################################################################
|
||||
|
||||
return script
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue