suricata
|
If in the Suricata source directory, this plugin can be built by running make
.
This Makefile is not generated by automake so it can serve as an example for plugins created outside of the Suricata source tree.
Building a standalone plugin has the following dependencies:
make install-library
make install-headers
libsuricata-config
is in your path (installed with make install-library
)Modify the Makefile to use libsuricata-config
.
Before building this plugin you will need to build and install Suricata from the git master branch and install the development tools and headers:
make install-library
make install-headers
then make sure the newly installed tool libsuricata-config
can be found in your path, for example:
Then a simple make
should build this plugin.
Or if the Suricata installation is not in the path, a command like the following can be used:
To run the plugin, first add the path to the plugin you just compiled to your suricata.yaml
, for example:
Then add an output for the plugin:
In the example above we use the name specified in the plugin as the filetype
and specify that all dns
, tls
and http
log entries should be sent to the plugin.
This plugin demonstrates a Suricata JSON/EVE output plugin (file-type). The idea of a Suricata EVE output plugin is to provide a file like interface for the handling of rendered JSON logs. This is useful for custom destinations not builtin to Suricata or if the formatted JSON requires some post-processing.
Note: EVE output plugins are not that useful just for reformatting the JSON output as the plugin does need to handle writing to a file once the file type has been delegated to the plugin.
All Suricata plugins make themselves known to Suricata by using a function named SCPluginRegister
which is called after Suricata loads the plugin shared object file. This function must return a SCPlugin
struct which contains basic information about the plugin. For example:
After the plugin has been registered, the Init
callback will be called. This is where the plugin will set itself up as a specific type of plugin such as an EVE output, or a capture method.
This plugins registers itself as an EVE file type using the SCRegisterEveFileType
struct. To register as an EVE file type the following must be provided:
suricata.yaml
to enable this output.Please see the code in filetype.c
for more details about this functions.