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;
163 Flow *f, uint8_t
flags,
void *state,
void *txv,
170 if (ssl_state == NULL) {
178 if (
flags & STREAM_TOSERVER) {
185 SCLogDebug(
"TLS: Subject is [%s], looking for [%s]\n",
226 pcre2_match_data *match = NULL;
236 int res = pcre2_substring_get_bynumber(match, 1, (PCRE2_UCHAR8 **)&str_ptr, &pcre2_len);
238 SCLogError(
"pcre2_substring_get_bynumber failed");
253 pcre2_substring_free((PCRE2_UCHAR *)str_ptr);
258 if (tmp_str[0] ==
'"') {
259 tmp_str[strlen(tmp_str) - 1] =
'\0';
268 pcre2_match_data_free(match);
277 pcre2_match_data_free(match);
282 DetectTlsSubjectFree(
de_ctx, tls);
320 DetectTlsSubjectFree(
de_ctx, tls);
352 Flow *f, uint8_t
flags,
void *state,
void *txv,
359 if (ssl_state == NULL) {
367 if (
flags & STREAM_TOSERVER) {
374 SCLogDebug(
"TLS: IssuerDN is [%s], looking for [%s]\n",
415 pcre2_match_data *match = NULL;
425 int res = pcre2_substring_get_bynumber(match, 1, (PCRE2_UCHAR8 **)&str_ptr, &pcre2_len);
427 SCLogError(
"pcre2_substring_get_bynumber failed");
442 pcre2_substring_free((PCRE2_UCHAR *)str_ptr);
447 if (tmp_str[0] ==
'"')
449 tmp_str[strlen(tmp_str) - 1] =
'\0';
460 pcre2_match_data_free(match);
467 pcre2_match_data_free(match);
472 DetectTlsIssuerDNFree(
de_ctx, tls);
503 g_tls_cert_list_id) == NULL) {
510 DetectTlsIssuerDNFree(
de_ctx, tls);
608 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
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 *)
@ DETECT_AL_TLS_CERT_SUBJECT
#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)
@ DETECT_AL_TLS_CERT_ISSUER
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...
@ DETECT_AL_TLS_CERT_FINGERPRINT
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.
@ DETECT_AL_TLS_FINGERPRINT
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