Commit graph

514 commits

Author SHA1 Message Date
Simone Mainardi
547e320113 Fixes lua_pop in LuaEngine::run_loaded_script 2021-12-03 16:18:41 +01:00
Luca Deri
e905d09124 Mitigates load due to VM reload (#6091) 2021-11-23 09:55:13 +01:00
Simone Mainardi
2ff0cccdfa Fixes default observation point id selection 2021-11-18 16:16:52 +01:00
Luca Deri
03cc793958 Removed Lua warning for CONST_LUA_ERROR to avoid nasty warnings 2021-10-15 08:32:40 +02:00
Luca Deri
9bd28b1f54 Added code for tracking C functions that do not fill up the Lua state properly. In case of issues
detected, the misbehaving function is reported on the screen for easy patching. Fixed a couple
of functions that were not setting the return state properly.

Lua VMs are reset before reuse.

Minor code cleanup and rename (Vm -> VM).
2021-10-14 19:03:18 +02:00
Simone Mainardi
2e6068bdef Fixes selection and XSRF when changing the observation point 2021-09-23 16:05:55 +02:00
Alfredo Cardigliano
1f43ed6a6b Add URI information to POST data warning 2021-08-09 16:44:37 +02:00
Alfredo Cardigliano
5d6b69d493 Fix leak checking CSRF 2021-07-14 14:51:35 +02:00
Luca
112c931226 Observation point code cleanup (WIP) 2021-07-01 23:26:15 +02:00
Luca
336f1f3d9f Adding observationPoint support (WIP) 2021-06-30 20:03:37 +02:00
Luca
fa5271b4d7 Implemented observationPoint menu support 2021-06-29 21:18:51 +02:00
Simone Mainardi
8cfb7b608a Allows alert access to admins and non-admins w/o allowed networks
Implements #5324
2021-05-26 09:50:28 +02:00
Simone Mainardi
0855f627a0 Allows alert access to admins and non-admins w/o allowed networks
Addresses #5324
2021-05-25 18:14:17 +02:00
Simone Mainardi
09f9254aa7 Prevents non-admins to switch to system interface
Partially addresses #5324
2021-05-25 17:04:51 +02:00
Luca Deri
d81d8a3295 Fixes bug that precvented session key to work when multiple ntopng instances are started per host 2021-05-21 23:29:15 +02:00
Simone Mainardi
33495e0188 Fixes system interface selection mixed between Lua and C++ 2021-05-11 12:51:34 +02:00
Simone Mainardi
81f43876c6 Removes shutdown check performed in Netfilterinterface 2021-04-09 17:52:45 +02:00
Luca Deri
1a3713394b Compilation fix 2021-04-09 16:02:48 +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
Alfredo Cardigliano
e86fffcc58 Add message to restart ntopng after importing all conf. Improve max post data check. Remove unnecessary exported modules. 2021-03-08 11:14:44 +01:00
Luca Deri
ad9e629e36 Fixes #4961 2021-02-02 18:39:24 +01:00
Luca Deri
34e7f765ee Missing Server: header from HTTP requests 2021-01-25 15:10:21 +01:00
Luca Deri
a1178a0791 Updated (C) 2021-01-02 12:08:23 +01:00
Luca Deri
9c16489912 FreeBSD compilation fixes
Various warning fixes
2020-12-31 18:05:44 +01:00
Luca Deri
2ef29c7c5e Cleanup code removing .inc files 2020-11-25 22:05:06 +01:00
Luca Deri
7353b2d3cc Added Origin under _SERVER variable 2020-11-19 13:49:57 +01:00
Simone Mainardi
049bfdcf4a Implements bitmap-based limited privileges for non-admins
Implements #4489
2020-10-09 15:50:22 +02:00
Simone Mainardi
b5781eea2c Cleanup unused flow_acle lua context member 2020-09-30 18:44:39 +02:00
Alfredo Cardigliano
3be4b69ea8 Fix CSRF check in case of non-REST POST with JSON payload 2020-08-28 15:05:42 +02:00
Simone Mainardi
b31a209e73 Removes a debug print 2020-08-25 17:38:26 +02:00
Simone Mainardi
f4affe2c6c Fixes CSRF vulnerabilities when POSTing JSON
Fixes #4285
2020-08-25 16:47:20 +02:00
Luca Deri
643e78f8d5 Implements most of #4113
- Removed unused google assistant scripts
- Cleaned up existing REST calls using _POST["payload"]

The _GET["parameter"] element is still present and it will be removed soon
2020-07-06 18:06:40 +02:00
andpp
87d77d12d6 Fixing redirection issue after changing interface (#4022)
Simplifies interface switch send redirect code

Addresses https://github.com/ntop/ntopng/pull/4022
2020-06-08 10:31:16 +02:00
Simone Mainardi
fed5cc9577 Enforces CSRF checks only when a session is used
When direct username:password are submitted, there is no need to enforce
such checks as it cannot be a CSRF attack. Indeed, CSRF attacks rely
on a session.

Fixes #4014
2020-06-03 09:59:31 +02:00
Luca Deri
8c948de437 SNMP code reorganization 2020-05-25 23:50:36 +02:00
Simone Mainardi
0050f3b732 Prevents interface switch to default to ifid 0 upon failure 2020-05-20 11:31:41 +02:00
emanuele-f
4460a98afd Fix form submit when ntopng login is disabled 2020-05-18 16:00:19 +02:00
Luca Deri
ccf76ca54d Added "real" intefaceId validation
Initial work towards REST API
2020-05-17 20:47:46 +02:00
emanuele-f
6b4c507492 Move CSRF token from request to session
Now the CSRF token is bound to the user session.
This addresses the issues outlined in #3866 , in particular the CSRF expiration issues.
2020-05-06 13:04:12 +02:00
Luca Deri
f99e184e90 Split LuaEngine.cpp apart (further improvements are necessary) 2020-04-19 12:29:13 +02:00
Simone Mainardi
6ea50fb004 Implements the Elasticsearch alerts endpoint
Implements #3105

Initial work to add elastisearch alerts

Initial implementation of ES alerts

Implements version check

Implements flow alerts format

Changes Elasticsearch index name

Comments the Elasticsearch alert endpoint
2020-04-18 16:35:14 +02:00
emanuele-f
c6b43f1af3 Pass client timezone as a cookie to properly format time 2020-04-15 17:44:08 +02:00
emanuele-f
64ceaa5b89 Fix discarded first RRD point in gauges
The point was discarded because of a bad RRD start time during the RRD creation.
The start time is now computed as "insertion_timestamp - heartbeat".

Fixes #3751
2020-04-15 12:55:31 +02:00
emanuele-f
0ad1b65512 Add plugins support for httpdocs, HTML templates and Lua modules
Such resources can be placed into the following plugin subdirs:

- ./httpdocs: javascript, css and similar, see plugins_utils.getHttpdocsDir
- ./modules: Lua modules, see plugins_utils.loadModule
- ./templates: HTML templates, see plugins_utils.renderTemplate
2020-04-14 17:53:25 +02:00
Luca Deri
f7b1e7d689 Initial work for widget implementation 2020-04-13 14:24:50 +02:00
Luca Deri
edd8715b4a Added ntop.speedtest() API call 2020-04-11 10:47:07 +02:00
emanuele-f
3f5bd04e7a Fix possible lua stack corruptions
Basic rules to avoid corruptions:
  - CONST_LUA_OK must be followed by a lua_push* / lua_newtable
  - CONST_LUA_ERROR must *not* be followed by a lua_push* / lua_newtable

Detailed information can be found at https://www.lua.org/manual/5.2/manual.html#lua_CFunction
2020-04-09 11:26:06 +02:00
Luca Deri
770aae078a Cleanuo 2020-04-07 22:02:28 +02:00
emanuele-f
c66181c3ff Update the ntop_reg API 2020-04-06 12:57:19 +02:00
emanuele-f
f75b84ff33 Remove unused API markers 2020-04-03 18:29:07 +02:00