suricata
detect-krb5-cname.c
Go to the documentation of this file.
1 /* Copyright (C) 2018-2022 Open Information Security Foundation
2  *
3  * You can copy, redistribute or modify this Program under the terms of
4  * the GNU General Public License version 2 as published by the Free
5  * Software Foundation.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * version 2 along with this program; if not, write to the Free Software
14  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
15  * 02110-1301, USA.
16  */
17 
18 /**
19  * \file
20  *
21  * \author Pierre Chifflier <chifflier@wzdftpd.net>
22  */
23 
24 #include "suricata-common.h"
25 #include "util-unittest.h"
26 
27 #include "detect-parse.h"
28 #include "detect-engine.h"
29 #include "detect-engine-buffer.h"
30 #include "detect-engine-mpm.h"
31 #include "detect-engine-state.h"
34 
35 #include "detect-krb5-cname.h"
36 
37 #include "rust.h"
38 #include "util-profiling.h"
39 
40 static int g_krb5_cname_buffer_id = 0;
41 
42 static int DetectKrb5CNameSetup(DetectEngineCtx *de_ctx, Signature *s, const char *arg)
43 {
44  if (SCDetectBufferSetActiveList(de_ctx, s, g_krb5_cname_buffer_id) < 0)
45  return -1;
46 
48  return -1;
49 
50  return 0;
51 }
52 
54 {
55  sigmatch_table[DETECT_KRB5_CNAME].name = "krb5.cname";
56  sigmatch_table[DETECT_KRB5_CNAME].alias = "krb5_cname";
57  sigmatch_table[DETECT_KRB5_CNAME].url = "/rules/kerberos-keywords.html#krb5-cname";
58  sigmatch_table[DETECT_KRB5_CNAME].Setup = DetectKrb5CNameSetup;
60  sigmatch_table[DETECT_KRB5_CNAME].desc = "sticky buffer to match on Kerberos 5 client name";
61 
63  "krb5_cname", ALPROTO_KRB5, SIG_FLAG_TOCLIENT, 1, SCKrb5TxGetCname, 2);
64 
66  "Kerberos 5 ticket client name");
67 
68  g_krb5_cname_buffer_id = DetectBufferTypeGetByName("krb5_cname");
69 
71 }
SigTableElmt_::url
const char * url
Definition: detect.h:1431
DetectSignatureSetAppProto
int DetectSignatureSetAppProto(Signature *s, AppProto alproto)
Definition: detect-parse.c:2313
detect-engine.h
SIGMATCH_INFO_STICKY_BUFFER
#define SIGMATCH_INFO_STICKY_BUFFER
Definition: detect.h:1645
SigTableElmt_::desc
const char * desc
Definition: detect.h:1430
sigmatch_table
SigTableElmt * sigmatch_table
Definition: detect-parse.c:155
SigTableElmt_::name
const char * name
Definition: detect.h:1428
SigTableElmt_::flags
uint16_t flags
Definition: detect.h:1422
DetectEngineCtx_
main detection engine ctx
Definition: detect.h:931
DetectBufferTypeSupportsMultiInstance
void DetectBufferTypeSupportsMultiInstance(const char *name)
Definition: detect-engine.c:1107
rust.h
SCDetectBufferSetActiveList
int SCDetectBufferSetActiveList(DetectEngineCtx *de_ctx, Signature *s, const int list)
Definition: detect-engine-buffer.c:29
SIG_FLAG_TOCLIENT
#define SIG_FLAG_TOCLIENT
Definition: detect.h:271
SigTableElmt_::Setup
int(* Setup)(DetectEngineCtx *, Signature *, const char *)
Definition: detect.h:1413
detect-engine-prefilter.h
util-unittest.h
DetectBufferTypeGetByName
int DetectBufferTypeGetByName(const char *name)
Definition: detect-engine.c:1157
ALPROTO_KRB5
@ ALPROTO_KRB5
Definition: app-layer-protos.h:56
de_ctx
DetectEngineCtx * de_ctx
Definition: fuzz_siginit.c:18
detect-engine-mpm.h
util-profiling.h
detect-engine-state.h
Data structures and function prototypes for keeping state for the detection engine.
detect-krb5-cname.h
detect-engine-content-inspection.h
SigTableElmt_::alias
const char * alias
Definition: detect.h:1429
DetectKrb5CNameRegister
void DetectKrb5CNameRegister(void)
Definition: detect-krb5-cname.c:53
suricata-common.h
detect-engine-buffer.h
detect-parse.h
Signature_
Signature container.
Definition: detect.h:670
SIGMATCH_NOOPT
#define SIGMATCH_NOOPT
Definition: detect.h:1620
DetectBufferTypeSetDescriptionByName
void DetectBufferTypeSetDescriptionByName(const char *name, const char *desc)
Definition: detect-engine.c:1254
DetectAppLayerMultiRegister
void DetectAppLayerMultiRegister(const char *name, AppProto alproto, uint32_t dir, int progress, InspectionMultiBufferGetDataPtr GetData, int priority)
Definition: detect-engine.c:2153
DETECT_KRB5_CNAME
@ DETECT_KRB5_CNAME
Definition: detect-engine-register.h:272