Project

General

Profile

Actions

Task #8095

open

libsuricata: expose API for reloading rulesets

Added by Jason Ish 26 days ago. Updated 20 days ago.

Status:
Assigned
Priority:
Normal
Assignee:
Target version:
Effort:
Difficulty:
Label:

Description

An API "handle" should be exposed to trigger rule and tenant reloads.

A good test for this is to make Suricata use this API itself, for when reloads are triggered over the Unix socket.

Ideally done in a way suitable for backport to 8.0.


Related issues 4 (4 open0 closed)

Related to Suricata - Support #8082: Support: What APIs should be used for Suricata as a library in runmode=liveNewActions
Related to Suricata - Task #2693: tracking: libsuricataIn ProgressJason IshActions
Related to Suricata - Feature #6214: multi-tenant: suricatasc command with parity with non-tenant commands for rulesNewOISF DevActions
Blocks Suricata - Story #8098: 9.0.0: libsuricataAssignedVictor JulienActions
Actions #1

Updated by Jason Ish 26 days ago

  • Related to Support #8082: Support: What APIs should be used for Suricata as a library in runmode=live added
Actions #2

Updated by Jason Ish 26 days ago

  • Related to Task #2693: tracking: libsuricata added
Actions #3

Updated by Jason Ish 26 days ago

Actions #4

Updated by Jason Ish 26 days ago

  • Related to Feature #6214: multi-tenant: suricatasc command with parity with non-tenant commands for rules added
Actions #5

Updated by Jason Ish 20 days ago

  • Subject changed from lib: expose API for reloading rulesets to libsuricata: expose API for reloading rulesets
Actions #6

Updated by Victor Julien 20 days ago

I think in Suricata currently there is a mix of detect engine logic and threading when doing reloads:

- we reload the config, but populate the new values under a special namespace in the config api (kind of thread unsafe btw, as the conf api has no threading awareness)
- we setup a new DetectEngineCtx with the new config values
- we create a new DetectEngineThreadCtx for each worker thread
- we pointer swap the DetectEngineThreadCtx for each of the worker threads
- now we need to wait for each worker thread to actually complete using the old DetectEngineThreadCtx. In busy traffic this happens quickly, but on a (mostly) idle system worker threads may be blocked in their capture methods. So we break-loop these if needed.
- finally we free the old DetectEngineThreadCtx instances and the DetectEngineCtx

We should probably first untangle this for Suricata itself before we can have API's for it?

Actions #7

Updated by Victor Julien 20 days ago · Edited

Should we start with killing the config api hack and load a new config into a variable and pass that around in the Detect engine API? Could probably become a member of the DetectEngineCtx object.

edit: this should probably it's own ticket

Actions #8

Updated by Jason Ish 20 days ago · Edited

We should probably first untangle this for Suricata itself before we can have API's for it?

Should we start with killing the config api hack and load a new config into a variable and pass that around in the Detect engine API? Could probably become a member of the DetectEngineCtx object.

To start, I want function handles that can be called that accomplish the same functionality that is available from the Unix socket, in a format that can be backported to 8, as we have a need there as well.

Actions

Also available in: Atom PDF