Skip to content

Commit 185c52b

Browse files
authored
Merge pull request #53 from CESNET/osquery_plugin
Osquery plugin
2 parents a4f4df1 + 16e678e commit 185c52b

File tree

7 files changed

+1282
-491
lines changed

7 files changed

+1282
-491
lines changed

Makefile.am

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,6 @@ ipfixprobe_output_src+=\
8080
fields.h
8181
endif
8282

83-
84-
8583
ipfixprobe_process_src=\
8684
process/http.cpp \
8785
process/http.hpp \
@@ -130,6 +128,7 @@ ipfixprobe_process_src+=\
130128
process/quic.hpp \
131129
process/quic.cpp
132130
endif
131+
133132
if WITH_FLEXPROBE
134133
ipfixprobe_process_src+=\
135134
process/flexprobe-data.h \
@@ -141,6 +140,12 @@ ipfixprobe_process_src+=\
141140
process/flexprobe-encryption-processing.h
142141
endif
143142

143+
if WITH_OSQUERY
144+
ipfixprobe_input_src+=\
145+
process/osquery.cpp\
146+
process/osquery.hpp
147+
endif
148+
144149
if WITH_DPDK
145150
ipfixprobe_input_src+=\
146151
input/dpdk.cpp \

README.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -414,6 +414,23 @@ Note: the following fields are UniRec arrays.
414414
ipfixprobe -p pstats:includezeros -r sample.pcap -i "f:output.trapcap"
415415
```
416416

417+
### OSQUERY
418+
List of unirec fields exported together with basic flow fields on interface by OSQUERY plugin.
419+
420+
| UniRec field | Type | Description |
421+
|:--------------------------:|:--------:|:---------------------------------------------------:|
422+
| PROGRAM_NAME | string | The name of the program that handles the connection |
423+
| USERNAME | string | The name of the user who starts the process |
424+
| OS_NAME | string | Distribution or product name |
425+
| OS_MAJOR | uint16 | Major release version |
426+
| OS_MINOR | uint16 | Minor release version |
427+
| OS_BUILD | string | Optional build-specific or variant string |
428+
| OS_PLATFORM | string | OS Platform or ID |
429+
| OS_PLATFORM_LIKE | string | Closely related platforms |
430+
| OS_ARCH | string | OS Architecture |
431+
| KERNEL_VERSION | string | Kernel version |
432+
| SYSTEM_HOSTNAME | string | Network hostname including domain |
433+
417434
### SSDP
418435
List of unirec fields exported together with basic flow fields on interface by SSDP plugin.
419436

configure.ac

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -293,6 +293,25 @@ RPM_REQUIRES+=" libtrap"
293293
RPM_BUILDREQ+=" libtrap-devel unirec"
294294
fi
295295

296+
AC_ARG_WITH([osquery],
297+
AC_HELP_STRING([--with-osquery],[Compile with osquery framework (osquery.io).]),
298+
[
299+
if test "$withval" = "yes"; then
300+
withosquery="yes"
301+
AC_CHECK_PROG(OSQUERY, osqueryi, yes)
302+
AS_IF([test x${OSQUERY} != xyes], [AC_MSG_ERROR([Please install osquery before configuring.])])
303+
else
304+
withosquery="no"
305+
fi
306+
], [withosquery="no"]
307+
)
308+
309+
AM_CONDITIONAL(WITH_OSQUERY, test x${withosquery} = xyes)
310+
311+
if [[ -z "$WITH_OSQUERY_TRUE" ]]; then
312+
AC_DEFINE([WITH_OSQUERY], [1], [Define to 1 if the osquery is available])
313+
fi
314+
296315

297316
AC_ARG_WITH([dpdk],
298317
AS_HELP_STRING([--with-dpdk],[Compile ipfixprobe with DPDK interface support.]),

include/ipfixprobe/ipfix-elements.hpp

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,6 @@ namespace ipxp {
231231
#define STATS_PCKT_TCPFLGS(F) F(0, 291, -1, nullptr) // BASIC LIST -- FIELD IS e8057id1015 (uint8*)
232232
#define STATS_PCKT_DIRECTIONS(F) F(0, 291, -1, nullptr) // BASIC LIST -- FIELD IS e8057id1016 (int8*)
233233

234-
235234
#define SBI_BRST_PACKETS(F) F(0, 291, -1, nullptr) // BASIC LIST -- FIELD IS e8057id1050 (uint16*)
236235
#define SBI_BRST_BYTES(F) F(0, 291, -1, nullptr) // BASIC LIST -- FIELD IS e8057id1051 (uint16*)
237236
#define SBI_BRST_TIME_START(F) F(0, 291, -1, nullptr) // BASIC LIST -- FIELD IS e8057id1052 (time*)
@@ -252,9 +251,21 @@ namespace ipxp {
252251

253252
#define QUIC_SNI(F) F(8057, 890, -1, nullptr)
254253

254+
#define OSQUERY_PROGRAM_NAME(F) F(8057, 852, -1, nullptr)
255+
#define OSQUERY_USERNAME(F) F(8057, 853, -1, nullptr)
256+
#define OSQUERY_OS_NAME(F) F(8057, 854, -1, nullptr)
257+
#define OSQUERY_OS_MAJOR(F) F(8057, 855, 2, nullptr)
258+
#define OSQUERY_OS_MINOR(F) F(8057, 856, 2, nullptr)
259+
#define OSQUERY_OS_BUILD(F) F(8057, 857, -1, nullptr)
260+
#define OSQUERY_OS_PLATFORM(F) F(8057, 858, -1, nullptr)
261+
#define OSQUERY_OS_PLATFORM_LIKE(F) F(8057, 859, -1, nullptr)
262+
#define OSQUERY_OS_ARCH(F) F(8057, 860, -1, nullptr)
263+
#define OSQUERY_KERNEL_VERSION(F) F(8057, 861, -1, nullptr)
264+
#define OSQUERY_SYSTEM_HOSTNAME(F) F(8057, 862, -1, nullptr)
265+
255266
#ifdef WITH_FLEXPROBE
256-
#define FX_FRAME_SIGNATURE(F) F(5715, 1010, 18, NULL)
257-
#define FX_TCP_TRACKING(F) F(5715, 1020, 1, NULL)
267+
#define FX_FRAME_SIGNATURE(F) F(5715, 1010, 18, nullptr)
268+
#define FX_TCP_TRACKING(F) F(5715, 1020, 1, nullptr)
258269
#endif
259270

260271
/**
@@ -467,6 +478,19 @@ namespace ipxp {
467478
#define IPFIX_QUIC_TEMPLATE(F) \
468479
F(QUIC_SNI)
469480

481+
#define IPFIX_OSQUERY_TEMPLATE(F) \
482+
F(OSQUERY_PROGRAM_NAME) \
483+
F(OSQUERY_USERNAME) \
484+
F(OSQUERY_OS_NAME) \
485+
F(OSQUERY_OS_MAJOR) \
486+
F(OSQUERY_OS_MINOR) \
487+
F(OSQUERY_OS_BUILD) \
488+
F(OSQUERY_OS_PLATFORM) \
489+
F(OSQUERY_OS_PLATFORM_LIKE) \
490+
F(OSQUERY_OS_ARCH) \
491+
F(OSQUERY_KERNEL_VERSION) \
492+
F(OSQUERY_SYSTEM_HOSTNAME)
493+
470494
#ifdef WITH_FLEXPROBE
471495
#define IPFIX_FLEXPROBE_DATA_TEMPLATE(F) F(FX_FRAME_SIGNATURE)
472496
#define IPFIX_FLEXPROBE_TCP_TEMPLATE(F) F(FX_TCP_TRACKING)
@@ -505,6 +529,7 @@ namespace ipxp {
505529
IPFIX_PHISTS_TEMPLATE(F) \
506530
IPFIX_WG_TEMPLATE(F) \
507531
IPFIX_QUIC_TEMPLATE(F) \
532+
IPFIX_OSQUERY_TEMPLATE(F) \
508533
IPFIX_FLEXPROBE_DATA_TEMPLATE(F) \
509534
IPFIX_FLEXPROBE_TCP_TEMPLATE(F) \
510535
IPFIX_FLEXPROBE_ENCR_TEMPLATE(F)

0 commit comments

Comments
 (0)