58static void DetectTlsFingerprintRegisterTests(
void);
62 Flow *f,
const uint8_t flow_flags,
63 void *txv,
const int list_id);
66static bool DetectTlsFingerprintValidateCallback(
68static int g_tls_cert_fingerprint_buffer_id = 0;
78 "sticky buffer to match the TLS cert fingerprint buffer";
80 "/rules/tls-keywords.html#tls-cert-fingerprint";
101 "TLS certificate fingerprint");
104 DetectTlsFingerprintSetupCallback);
107 DetectTlsFingerprintValidateCallback);
136 const uint8_t flow_flags,
void *txv,
const int list_id)
143 if (flow_flags & STREAM_TOSERVER) {
144 connp = &ssl_state->client_connp;
146 connp = &ssl_state->server_connp;
157 det_ctx, list_id, buffer, data, data_len, transforms);
163static bool DetectTlsFingerprintValidateCallback(
170 for (; sm != NULL; sm = sm->
next) {
176 if (cd->content_len != 59) {
177 *sigerror =
"Invalid length of the specified fingerprint. "
178 "This rule will therefore never match.";
183 bool have_delimiters =
false;
185 for (u = 0; u < cd->content_len; u++) {
186 if (cd->content[u] ==
':') {
187 have_delimiters =
true;
192 if (!have_delimiters) {
193 *sigerror =
"No colon delimiters ':' detected in content after "
194 "tls.cert_fingerprint. This rule will therefore "
201 *sigerror =
"tls.cert_fingerprint should not be used together "
202 "with nocase, since the rule is automatically "
203 "lowercased anyway which makes nocase redundant.";
218 for (; sm != NULL; sm = sm->
next) {
224 bool changed =
false;
226 for (u = 0; u < cd->content_len; u++) {
227 if (isupper(cd->content[u])) {
@ TLS_STATE_CLIENT_CERT_DONE
@ TLS_STATE_SERVER_CERT_DONE
#define DETECT_CONTENT_NOCASE
int SCDetectBufferSetActiveList(DetectEngineCtx *de_ctx, Signature *s, const int list)
void InspectionBufferSetupAndApplyTransforms(DetectEngineThreadCtx *det_ctx, const int list_id, InspectionBuffer *buffer, const uint8_t *data, const uint32_t data_len, const DetectEngineTransforms *transforms)
setup the buffer with our initial data
InspectionBuffer * InspectionBufferGet(DetectEngineThreadCtx *det_ctx, const int list_id)
void DetectAppLayerMpmRegister(const char *name, int direction, int priority, PrefilterRegisterFunc PrefilterRegister, InspectionBufferGetDataPtr GetData, AppProto alproto, int tx_min_progress)
register an app layer keyword for mpm
int PrefilterGenericMpmRegister(DetectEngineCtx *de_ctx, SigGroupHead *sgh, MpmCtx *mpm_ctx, const DetectBufferMpmRegistry *mpm_reg, int list_id)
@ DETECT_TLS_CERT_FINGERPRINT
void DetectBufferTypeSetDescriptionByName(const char *name, const char *desc)
void DetectBufferTypeRegisterSetupCallback(const char *name, void(*SetupCallback)(const DetectEngineCtx *, Signature *))
uint8_t DetectEngineInspectBufferGeneric(DetectEngineCtx *de_ctx, DetectEngineThreadCtx *det_ctx, const 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.
void DetectAppLayerInspectEngineRegister(const char *name, AppProto alproto, uint32_t dir, int progress, InspectEngineFuncPtr Callback, InspectionBufferGetDataPtr GetData)
Registers an app inspection engine.
void DetectBufferTypeRegisterValidateCallback(const char *name, bool(*ValidateCallback)(const Signature *, const char **sigerror, const DetectBufferType *))
int DetectBufferTypeGetByName(const char *name)
int SCDetectSignatureSetAppProto(Signature *s, AppProto alproto)
SigTableElmt * sigmatch_table
void DetectTlsFingerprintRegister(void)
Registration function for keyword: tls.cert_fingerprint.
#define SIG_FLAG_TOCLIENT
#define SIGMATCH_INFO_STICKY_BUFFER
#define SIG_FLAG_TOSERVER
main detection engine ctx
SpmGlobalThreadCtx * spm_global_thread_ctx
SSLv[2.0|3.[0|1|2|3]] state structure.
a single match condition for a signature
int(* Setup)(DetectEngineCtx *, Signature *, const char *)
void(* RegisterTests)(void)
SignatureInitDataBuffer * buffers
SignatureInitData * init_data
#define SCLogWarning(...)
Macro used to log WARNING messages.
SpmCtx * SpmInitCtx(const uint8_t *needle, uint16_t needle_len, int nocase, SpmGlobalThreadCtx *global_thread_ctx)
void SpmDestroyCtx(SpmCtx *ctx)