Skip to content

How To: Suricata on pfSense

Andrew edited this page Jan 9, 2022 · 10 revisions

pfSense truncates suricata messages.

Reference RFC5424 and RFC3164

Step 1

In the Suricata configuration, change the EVE output from Syslog to File. This will start writing logs to a local file on your pfSense system, which we can then use Syslog-NG to read and forward on.

Step 2

Install syslog-NG from the pfSense package library

Step 3

Enable syslog-NG

On the General tab, tick the option to enable syslog-NG and save the configuration.

Go to the "Advanced tab" Syslog-NG is comprised of three components. An input, processor and output.

Step 4

The following example uses a wildcard pattern to find any files in sub-directories called eve.json. You can probably remove the program-override option if not needed for your scenario. This simply tags the "program" field in logstash with "suricata".

Step 4a

Add a new object using the "Add" button. Set the name to "Suricata", the Object Type as "Source" and populate with the code included below.

Object Type: Source

Object Name: Suricata

Object Parameters:

{
  wildcard-file(
    base-dir("/var/log/suricata")
    filename-pattern("eve.json")
    recursive(yes)
    follow-freq(1)
    program-override("suricata")
    flags(no-parse)
  );
};

The host-override parameter may be required if Syslog-NG doesn't send the host as the source IP. This overrides the host value for the events when coming into logstash.

Step 4b

Add another object, this time as an object type of "Log".

Object Type: Log

Object Name: Suricata

Object Parameters:

{
    source(Suricata);
    destination(Suricata);
};

Step 4c

Add the final object, this time as an object type of "Destination"

Object Type: Destination

Object Name: Suricata

Object Parameters:

{
   tcp("logstash.local"
   port(5140)
   failover( servers("192.168.0.10", "10.0.0.10") )
   );
};

The failover( servers("192.168.0.10", "10.0.0.10") ) parameter is only required where you have multiple logstash instances you want to send to. This doesn't duplicate logs, simply loadbalances endpoints.

Step 5 (Optional)

If you have previously installed syslog-NG, you'll need to untick the following checkbox depicted below:

Clone this wiki locally