Commit graph

183 commits

Author SHA1 Message Date
Simone Mainardi
c0ad0ff162 Simplifies host callbacks lua structure with callback_definitions/host 2021-04-13 10:53:15 +02:00
Simone Mainardi
b12fc91a6b Merge branch 'host-user-scripts' into dev 2021-04-03 10:18:09 +02:00
Luca
a4047c5a1c Implements flow callbacks and alerts in C++
Scaffolding code of the host scripts

Scaffolding code for host alerts

Adds host_callbacks/ for .cpp files

Implements all classes for host callbacks

Removes pro/enterprise host callbacks

Adds typedefs with callback deltas

Compilation fix

Creates instances of host callbacks in loader

Link fix

Removes redundant/non-necessary host alerts

Merges Scan and Flood callbacks together

Removes outdated API files

Refactors alert keys into entity|id

Refactors all flow alert_{...} into flow_alert_{...}

Refactors C++ flow alert_{...} into flow_alert_{...}

Reworks alert ids to include an entity type

Cleanup and merge alertTypeRaw with getAlertType

Minor fix

Refactors alert definitions and keys into sub directories

Implement host alert callback execution and trigger/release logic

Update callbacks API

Adds base CallbacksLoader for {Host,Flow}CallbacksLoader

Implements load of host user scripts with periodicities

Implements runtime reload of host callbacks

Add logic for periodic callbacks

Add 'expired' flag to host alerts

Implements execution of host callbacks and SYN flood checks

Adds triggerAlertAsync calls to SYNFlood

Implements JSON host alert generation info

Handle callback getPeriod. Optimize callback lookup.

Implements host recipients in C++

Add callback status

Define destructor

Iterator fixes

Cleanup host Lua calls (now performed in C++)

Changes to show new host alerts in SQLite

Adds release/engage action on alert JSON

Move AlertableEntity to OtherAlertableEntity, inheriting from a new AlertableEntity. Add HostAlertableEntity.

Implements SYN Flood Attacker with params

Uses parametrized thresholds to trigger syn flood alerts

Implements build alert of both attacker and victim

Implement HostAlertableEntity

Implements SYN scan attacker/victim alerts

Implements flow flood attacker/victim alerts

Removes a debug flag

Add virtual allocStatus

Add HostAlert disableAutoRelease()

Add Ãexplicit releaseAlert()

Implements SYNFloodHostCallbackStatus

Implements SYNScanHostCallbackStatus

Implements FlowFloodHostCallbackStatus

Change trigger API to handle cli/src score

Implements {DNS,SMTP,NTP}ServerContactsAlert

Reworks ServerContacts host alerts

Implement exclusion bitmaps for host alerts

Implements {SMTP,DNS,NTP}ServerContactsAlert

Adds host_info to the generated alert JSON

Minor cleanup

Optimize access to callback status

Move RepliesRequestsRatio to pro

Rework triggerAlert on host to avoid multiple call and unneeded status data

Compilation fix

Reworked host alerts API (wip)

Cleanup unused host callbacks

Compilation fixes

Finishes backend implementation of host alerts exclusions

Rework host callbacks executor

Implements disable of host alerts

Port SYNFlood to the new api

Cleanup

Reduce duplicated code

Comments

Port ServerContacts to the new api

Clenaup

Adds parsing of configuration for host callbacks

Port SYNScanAlert to the new API

Port FlowFlood to the new API

Cleanup unused HostAlert getName

Reworks DNSRequestsErrorsRatioAlert

Adds JSON for DNSTrafficAlert

Adds FlowsAlert

Adds P2PTrafficAlert

Add RepliesRequestsRatioAlert

Adds ScoreAlert

Adds ThroughputAlert

Adds TrafficAlert

Fixes for scan/flood alerts

DNS ratio alert support

Add HTTP stats getters

Implements deltas for many host callbacks

Host score inc

Adds missing Alert params to host alerts

Release all host alerts on idle

Refactors score classes

Implements class Score to contain scores for hosts, flows, etc

Adds scores to VLANs, Networks, ASes and Countries

Host callbacks can trigger a single alert now

FlowFlood, SYNFloo, SYNScan now inherit from FlowHits

Move severity and score to constructor

Add else branch to hits callbacks

Alert definition update for flows_flood, syn_flood, syn_scan

Update field name

Engaged alert init

Adds score incs/decs for AS, VLAN, country, os and network

Restore network scripts

Restored other alert definitions for floods

Handle decreasing alert score

Removes include

Rename flows_flood to flow_flood for consistency

Restored alert_tcp_syn_flood_victim alert_tcp_syn_scan_victim definitions

Fixes for non-host engaged/release alerts

Cleanup LuaEngineFlow and LuaEngineHost classes

Fixes old calls to host lua during shutdown

Removes AlertCheckLuaEngine instance

Fixes purging of flows

Fixes alerts release upon shutdown causing wrong uses

Removes a debug flag

Fix getNumEngagedAlerts

Cleanup unnecessary host callbacks

Removes array of callback statuses inside host

Bitmap fixes

Refactors Bitmap into Bitmap128

Implements 16-bits bitmaps for host alerts

Adds class HostCallbacksStatus

Moves callback status p2p and DNS inside HostCallbacksStatus

Removes unused callbacks in typedefs

Minor cleanup

Adds trigger/release for DNS/p2p alerts

Reworks UI of hosts user scripts

Rename HostCallbackType to HostCallbackID, getType to getID, others
2021-04-03 09:53:15 +02:00
Luca Deri
a5348b8823 Require loop check 2021-03-26 09:19:43 +01:00
Simone Mainardi
07210032e1 Fixes user scripts system page 2021-03-22 12:49:14 +01:00
Simone Mainardi
f61ffc045b Merge branch 'c-user-scripts' into dev 2021-03-22 10:36:13 +01:00
Simone Mainardi
aea9138bfb Implements flow callbacks and alerts in C++ 2021-03-22 09:51:36 +01:00
Matteo Biscosi
e71dfaaa0b Removed debug prints 2021-03-19 10:42:01 +01:00
Matteo Biscosi
ab55947017 Fixes failing loadModule silenced
Fixes #5107
2021-03-19 10:40:40 +01:00
Matteo Biscosi
885cc595ed Fixes nil table error 2021-03-10 18:29:02 +01:00
Matteo Biscosi
d86c84aee4 Implements can not enable user scripts
Implements #5089
2021-03-09 16:19:57 +01:00
Alfredo Cardigliano
76e8728780 Add migration of configsets v2 to v3 (#5083) 2021-03-08 15:46:09 +01:00
Alfredo Cardigliano
a4969a4316 Fix user scripts configuration import (#5083) 2021-03-04 15:28:50 +01:00
Simone Mainardi
80ed4e5b07 Fixes alert filters not being picked up after changes 2021-03-01 18:49:08 +01:00
Simone Mainardi
716d907ff1 Configset initialization fixes 2021-03-01 18:19:38 +01:00
Alfredo Cardigliano
fa311e3ade Rework user script working sets (a single configset is supported now) 2021-03-01 15:37:45 +01:00
Simone Mainardi
76006d6250 Fixes IP reassignment code that is now per-interface
Implements #5038
2021-02-26 11:21:04 +01:00
Simone Mainardi
e82f318742 Adds exclusion filter for SNMP device alerts 2021-02-23 15:48:21 +01:00
Simone Mainardi
af90ee08c9 Removes a debug flag 2021-02-23 15:38:20 +01:00
Simone Mainardi
696bcb33e5 Implements alert exclusions for hosts, interfaces, local networks 2021-02-23 15:36:14 +01:00
Simone Mainardi
454f5c07ba Fixes deletetion of user script configs leaving stale pools 2021-02-22 18:52:42 +01:00
Simone Mainardi
3ee9e5d9ef Minor cleanup 2021-02-19 15:54:37 +01:00
Simone Mainardi
9433928dfc Handles templates (load/require) for individual plugins 2021-02-19 15:51:27 +01:00
Simone Mainardi
33d035b96c Improves use of classes for user script templates 2021-02-19 14:44:44 +01:00
Simone Mainardi
1dd93e7845 Initial work to add user script templates 2021-02-19 12:54:42 +01:00
Matteo Biscosi
92345e04d5 Removed unused code from exclusion list 2021-02-19 10:55:19 +01:00
Matteo Biscosi
7c194646fd Fixes info field not checked into exclusion list 2021-02-19 10:18:59 +01:00
Matteo Biscosi
8a016130e1 Removed if then else statements and replaced with general function 2021-02-18 19:45:35 +01:00
Matteo Biscosi
b997ebaf28 Fixes exclusion list error with converted parameters 2021-02-18 19:10:59 +01:00
Simone Mainardi
80ae202ad1 Initial work to implement user script templates 2021-02-18 18:59:45 +01:00
Matteo Biscosi
ee8ffaca7d Fixes filter button not disabled 2021-02-18 18:21:49 +01:00
Matteo Biscosi
7b80a28d94 Added vlan show, if needed, to hostinfo2lable function 2021-02-18 15:16:51 +01:00
Simone Mainardi
59380ecd39 Implements matching of filters on alerts stored in SQLite 2021-02-17 17:31:00 +01:00
Simone Mainardi
0d39732d1c Implements telemetry for alter filters 2021-02-17 12:08:40 +01:00
Matteo Biscosi
714d479d41 Fixes user script disabled after adding a new alert to exclude 2021-02-17 11:46:45 +01:00
Matteo Biscosi
f0f8e51169
Fixes user script config not updating 2021-02-16 19:19:55 +01:00
Simone Mainardi
87249b44b0 Fixes user script filters not preserved after restart 2021-02-16 18:36:55 +01:00
Matteo Biscosi
1d86817246 Fixes user script exclusion list not working 2021-02-16 17:55:01 +01:00
Matteo Biscosi
161ca6afc5 Removed unused exclusion alert field 2021-02-16 17:04:40 +01:00
Matteo Biscosi
e99e5a923d
Fixed error in user_scripts.lua 2021-02-16 16:40:48 +01:00
Matteo Biscosi
51956c4167 Removed merge errors in user_scripts.lua 2021-02-16 16:31:05 +01:00
Simone Mainardi
209a9be5e6 Implements info-based flow alert exclusion filters 2021-02-16 16:22:06 +01:00
Matteo Biscosi
12cd9069d1 Implements l7 category and dns request added to exclusion alerts
Implements #4942
2021-02-16 16:05:16 +01:00
Simone Mainardi
f4dff6f2e7 Implements risk-based filtering of flow alerts 2021-02-16 15:25:20 +01:00
Matteo Biscosi
370ed8a475 Fixes alert exclude button not showing 2021-02-16 11:43:08 +01:00
Alfredo Cardigliano
e557a38ba4 Fix nil access 2021-02-15 14:43:59 +01:00
Matteo Biscosi
dffb8cedc5 Fixed exclusion list purged after startup 2021-02-15 12:37:23 +01:00
Simone Mainardi
7e1a3ef51f Implements CIDR-matching of flow exclusion list rules 2021-02-12 17:24:26 +01:00
Simone Mainardi
6d651f0661 mplements layer-4 protocol as filter for flow user scripts 2021-02-12 16:25:45 +01:00
Simone Mainardi
c0ee292530 Implements l7_proto as filter for flow user scripts 2021-02-12 16:08:27 +01:00