Project

General

Profile

Actions

Task #2693

open

tracking: libsuricata

Added by Victor Julien almost 6 years ago. Updated 4 months ago.

Status:
In Progress
Priority:
Normal
Assignee:
Target version:
Effort:
high
Difficulty:
high
Label:

Description

This request came up at Suricon2018, but has come up before. The idea is to turn much of Suricata into a library that can be reused in other tools.

The first step would be to define some of the use cases we'd like to initially support so that an API could be designed for that.

Goals for 8.0:
- Allow a library user to replicate the Suricata application by exposing all functions needed by the current SuricataMain, or refactoring to allow this.
- Given replication of Suricata, allow the library user to register custom capture modes and output callbacks
- Allow the user to bring their own threads

General library challenges given we've been an application for so long:
- Command line parsing should be opt-in
- Loading the configuration file should be opt-in
- Registering signal handlers should be opt-in, but the functionality they provide should be exposed to the library user can easily call them
- A library should never fatal exit outside of extreme conditions, instead error codes must be ripple back to where the library user can decide what to do
- Global state should be non-existent. One could imagine where a user might want to have a "handle" on multiple discrete Suricata instances.

Future goals:
- Remove global state
- Improve developer experience. I imagine an interface where you bootstrap a Suricata "engine" and feed your own packets into
- Refactor modules to make them more usable outside the scope of Suricata? What modules would make sense here? Capture methods, just to get packets. Flow, to defrag, or TCP re-assembly if you already have your own packets.

Scope:
- Initially, the should be limited to code that Suricata uses itself. That is, Suricata the application is a user of the library. If Suricata the application does not use a module, it should be looked at closely if it belongs in the library, mainly for scope, QA, and support reasons.


Subtasks 6 (4 open2 closed)

Task #4682: tracking: clean up globals and thread localsNewJason IshActions
Task #4683: detect: remove sigmatch_table in favor of a dynamic storage optionClosedPhilippe AntoineActions
Task #4684: libsuricata: define global context types for instance and per thread storageNewJason IshActions
Task #4698: Example program to bootstrap Suricata (an alternate main() for Suricata)ClosedJason IshActions
Task #6814: libsuricata: opt-in signal handlingAssignedJason IshActions
Task #6858: libsuricata: hook for flow expectation creationNewOISF DevActions

Related issues 16 (14 open2 closed)

Related to Suricata - Task #2685: SuriCon 2018 brainstormAssignedVictor JulienActions
Related to Suricata - Task #4097: Suricon 2020 brainstormAssignedVictor JulienActions
Related to Suricata - Task #4221: Build Suricata into a static and shared libraryClosedJason IshActions
Related to Suricata - Task #4429: libsuricata: Use cases with examplesNewJason IshActions
Related to Suricata - Task #4101: tracking: pluginsIn ProgressJason IshActions
Related to Suricata - Task #4704: unix-socket: separate functionality from the unix socket interfaceNewOISF DevActions
Related to Suricata - Task #4742: Make the auto-generated config.h not conflict with other config.h.AssignedJason IshActions
Related to Suricata - Task #5433: tracking: reduce number of public data structuresAssignedJason IshActions
Related to Suricata - Task #5488: Suricon 2022 brainstormAssignedVictor JulienActions
Related to Suricata - Task #2313: tracking: save & restore state when suricata restartsNewOISF DevActions
Related to Suricata - Bug #6754: libsuricata: restructure directory and files to allow for include files to be name spacedNewOISF DevActions
Related to Suricata - Task #6752: libsuricata: don't include autoconf.h from other includesNewOISF DevActions
Related to Suricata - Bug #6838: eve/filetypes: move from plugin api to eve apiClosedJason IshActions
Related to Suricata - Feature #7240: libsuricata: use provided threads and packetsIn ProgressJason IshActions
Related to Suricata - Feature #7319: flow: add user registerable flow initialization callbackIn ProgressJason IshActions
Related to Suricata - Feature #7320: flow: add user registerable flow update callbacksIn ProgressJason IshActions
Actions

Also available in: Atom PDF