suricata
|
#include "suricata-common.h"
#include "action-globals.h"
#include "host.h"
#include "ippair.h"
#include "detect.h"
#include "detect-engine.h"
#include "detect-engine-address.h"
#include "detect-engine-threshold.h"
#include "detect-threshold.h"
#include "detect-parse.h"
#include "detect-engine-build.h"
#include "conf.h"
#include "util-threshold-config.h"
#include "util-unittest.h"
#include "util-unittest-helper.h"
#include "util-byte.h"
#include "util-time.h"
#include "util-debug.h"
#include "util-fmemopen.h"
#include "detect-engine-alert.h"
#include "packet.h"
Go to the source code of this file.
#define | DETECT_BASE_REGEX "^\\s*(event_filter|threshold|rate_filter|suppress)\\s*gen_id\\s*(\\d+)\\s*,\\s*sig_id\\s*(\\d+)\\s*(.*)\\s*$" |
#define | DETECT_THRESHOLD_REGEX |
#define | DETECT_RATE_REGEX |
#define | DETECT_SUPPRESS_REGEX "^,\\s*track\\s*(by_dst|by_src|by_either)\\s*,\\s*ip\\s*([\\[\\],\\$\\s\\da-zA-Z.:/_]+)*\\s*$" |
#define | THRESHOLD_CONF_DEF_CONF_FILEPATH CONFIG_DIR "/threshold.config" |
enum | ThresholdRuleType { THRESHOLD_TYPE_EVENT_FILTER , THRESHOLD_TYPE_THRESHOLD , THRESHOLD_TYPE_RATE , THRESHOLD_TYPE_SUPPRESS } |
typedef enum ThresholdRuleType | ThresholdRuleType |
void | SCThresholdConfGlobalInit (void) |
int | SCThresholdConfInitContext (DetectEngineCtx *de_ctx) |
Inits the context to be used by the Threshold Config parsing API. | |
int | SCThresholdConfParseFile (DetectEngineCtx *de_ctx, FILE *fp) |
Parses the Threshold Config file. | |
void | SCThresholdConfRegisterTests (void) |
This function registers unit tests for Classification Config API. | |
Implements Threshold support
Definition in file util-threshold-config.c.
#define DETECT_BASE_REGEX "^\\s*(event_filter|threshold|rate_filter|suppress)\\s*gen_id\\s*(\\d+)\\s*,\\s*sig_id\\s*(\\d+)\\s*(.*)\\s*$" |
Definition at line 67 of file util-threshold-config.c.
#define DETECT_RATE_REGEX |
Definition at line 75 of file util-threshold-config.c.
#define DETECT_SUPPRESS_REGEX "^,\\s*track\\s*(by_dst|by_src|by_either)\\s*,\\s*ip\\s*([\\[\\],\\$\\s\\da-zA-Z.:/_]+)*\\s*$" |
Definition at line 86 of file util-threshold-config.c.
#define DETECT_THRESHOLD_REGEX |
Definition at line 69 of file util-threshold-config.c.
#define THRESHOLD_CONF_DEF_CONF_FILEPATH CONFIG_DIR "/threshold.config" |
Definition at line 92 of file util-threshold-config.c.
typedef enum ThresholdRuleType ThresholdRuleType |
enum ThresholdRuleType |
Enumerator | |
---|---|
THRESHOLD_TYPE_EVENT_FILTER | |
THRESHOLD_TYPE_THRESHOLD | |
THRESHOLD_TYPE_RATE | |
THRESHOLD_TYPE_SUPPRESS |
Definition at line 54 of file util-threshold-config.c.
void SCThresholdConfGlobalInit | ( | void | ) |
Definition at line 102 of file util-threshold-config.c.
References DETECT_BASE_REGEX, DETECT_RATE_REGEX, DETECT_SUPPRESS_REGEX, DETECT_THRESHOLD_REGEX, DetectSetupPCRE2(), and FatalError.
Referenced by GlobalsInitPreConfig().
int SCThresholdConfInitContext | ( | DetectEngineCtx * | de_ctx | ) |
Inits the context to be used by the Threshold Config parsing API.
This function initializes the hash table to be used by the Detection Engine Context to hold the data from the threshold.config file, obtains the file desc to parse the threshold.config file, and inits the regex used to parse the lines from threshold.config file.
de_ctx | Pointer to the Detection Engine Context. |
0 | On success. |
-1 | On failure. |
Definition at line 169 of file util-threshold-config.c.
References de_ctx, RUNMODE_CONF_TEST, SCLogDebug, SCLogWarning, SCRunmodeGet(), and SCThresholdConfParseFile().
Referenced by SigLoadSignatures().
int SCThresholdConfParseFile | ( | DetectEngineCtx * | de_ctx, |
FILE * | fp | ||
) |
Parses the Threshold Config file.
de_ctx | Pointer to the Detection Engine Context. |
fd | Pointer to file descriptor. |
Definition at line 983 of file util-threshold-config.c.
References DetectEngineCtx_::config_prefix, de_ctx, RUNMODE_CONF_TEST, SCLogDebug, SCLogInfo, SCRunmodeGet(), and DetectEngineCtx_::tenant_id.
Referenced by SCThresholdConfInitContext().
void SCThresholdConfRegisterTests | ( | void | ) |
This function registers unit tests for Classification Config API.
Definition at line 2580 of file util-threshold-config.c.
References UtRegisterTest().