Go to the documentation of this file.
69 #define PARSE_REGEX "^([A-z0-9\\s\\-\\.=,\\*@]+|\"[A-z0-9\\s\\-\\.=,\\*@]+\")\\s*$"
70 #define PARSE_REGEX_FINGERPRINT "^([A-z0-9\\:\\*]+|\"[A-z0-9\\:\\* ]+\")\\s*$"
77 Flow *, uint8_t,
void *,
void *,
83 Flow *, uint8_t,
void *,
void *,
95 static int g_tls_cert_list_id = 0;
96 static int g_tls_cert_fingerprint_list_id = 0;
165 Flow *f, uint8_t
flags,
void *state,
void *txv,
172 if (ssl_state == NULL) {
180 if (
flags & STREAM_TOSERVER) {
187 SCLogDebug(
"TLS: Subject is [%s], looking for [%s]\n",
228 pcre2_match_data *match = NULL;
238 int res = pcre2_substring_get_bynumber(match, 1, (PCRE2_UCHAR8 **)&str_ptr, &pcre2_len);
240 SCLogError(
"pcre2_substring_get_bynumber failed");
255 pcre2_substring_free((PCRE2_UCHAR *)str_ptr);
260 if (tmp_str[0] ==
'"') {
261 tmp_str[strlen(tmp_str) - 1] =
'\0';
270 pcre2_match_data_free(match);
279 pcre2_match_data_free(match);
284 DetectTlsSubjectFree(
de_ctx, tls);
322 DetectTlsSubjectFree(
de_ctx, tls);
354 Flow *f, uint8_t
flags,
void *state,
void *txv,
361 if (ssl_state == NULL) {
369 if (
flags & STREAM_TOSERVER) {
376 SCLogDebug(
"TLS: IssuerDN is [%s], looking for [%s]\n",
417 pcre2_match_data *match = NULL;
427 int res = pcre2_substring_get_bynumber(match, 1, (PCRE2_UCHAR8 **)&str_ptr, &pcre2_len);
429 SCLogError(
"pcre2_substring_get_bynumber failed");
444 pcre2_substring_free((PCRE2_UCHAR *)str_ptr);
449 if (tmp_str[0] ==
'"')
451 tmp_str[strlen(tmp_str) - 1] =
'\0';
462 pcre2_match_data_free(match);
469 pcre2_match_data_free(match);
474 DetectTlsIssuerDNFree(
de_ctx, tls);
512 DetectTlsIssuerDNFree(
de_ctx, tls);
610 if (ssl_state == NULL) {
int DetectSignatureSetAppProto(Signature *s, AppProto alproto)
SSLv[2.0|3.[0|1|2|3]] state structure.
#define PARSE_REGEX
Regex for parsing "id" option, matching number or "number".
SigTableElmt * sigmatch_table
void(* Free)(DetectEngineCtx *, void *)
SSLStateConnp client_connp
SSLStateConnp server_connp
main detection engine ctx
@ DETECT_TLS_CERT_FINGERPRINT
int(* AppLayerTxMatch)(DetectEngineThreadCtx *, Flow *, uint8_t flags, void *alstate, void *txv, const Signature *, const SigMatchCtx *)
int DetectParsePcreExec(DetectParseRegex *parse_regex, pcre2_match_data **match, const char *str, int start_offset, int options)
#define SIG_FLAG_TOCLIENT
int(* Setup)(DetectEngineCtx *, Signature *, const char *)
#define SIGMATCH_QUOTES_MANDATORY
@ DETECT_SM_LIST_POSTMATCH
#define PARSE_REGEX_FINGERPRINT
#define SIG_FLAG_TOSERVER
int DetectContentSetup(DetectEngineCtx *de_ctx, Signature *s, const char *contentstr)
Function to setup a content pattern.
#define PKT_IS_TOSERVER(p)
void DetectSetupParseRegexes(const char *parse_str, DetectParseRegex *detect_parse)
#define DETECT_CONTENT_NEGATED
int DetectEngineContentModifierBufferSetup(DetectEngineCtx *de_ctx, Signature *s, const char *arg, int sm_type, int sm_list, AppProto alproto)
#define SIGMATCH_HANDLE_NEGATION
SignatureInitData * init_data
Data structures and function prototypes for keeping state for the detection engine.
int(* Match)(DetectEngineThreadCtx *, Packet *, const Signature *, const SigMatchCtx *)
Used to start a pointer to SigMatch context Should never be dereferenced without casting to something...
void DetectTlsRegister(void)
Registration function for keyword: tls.version.
int DetectBufferTypeRegister(const char *name)
uint8_t DetectEngineInspectGenericList(DetectEngineCtx *de_ctx, DetectEngineThreadCtx *det_ctx, const struct DetectEngineAppInspectionEngine_ *engine, const Signature *s, Flow *f, uint8_t flags, void *alstate, void *txv, uint64_t tx_id)
Do the content inspection & validation for a signature.
#define SCLogError(...)
Macro used to log ERROR messages.
void DetectAppLayerInspectEngineRegister(const char *name, AppProto alproto, uint32_t dir, int progress, InspectEngineFuncPtr Callback, InspectionBufferGetDataPtr GetData)
Registers an app inspection engine.
SigMatch * SigMatchAppendSMToList(DetectEngineCtx *de_ctx, Signature *s, uint16_t type, SigMatchCtx *ctx, const int list)
Append a SigMatch to the list type.
#define SIG_FLAG_TLSSTORE
@ DETECT_TLS_CERT_SUBJECT