pfelk icon indicating copy to clipboard operation
pfelk copied to clipboard

OPNsense v22.1 RFC 5424

Open a3ilson opened this issue 3 years ago • 35 comments

Describe the bug OPNsesne v22.1 added RFC 5424 support

Screenshots Screen Shot 2022-01-27 at 10 27 30 PM

Firewall System (please complete the following information):

  • OPNsense
  • Version 22.1

Operating System (please complete the following information):

  • Docker Installation

Elasticsearch, Logstash, Kibana (please complete the following information):

  • 7.16.3

  • [ ] Add GROK support for OPNsense RFC 5424

  • [x] Parses RFC 5424 logs ignoring the meta sequenceID integer

    • Ignore or add to GROK

a3ilson avatar Jan 28 '22 03:01 a3ilson

New GROK which adds the field event.sequence when RFC 5424 is ticked (OPNsense only)

<%{POSINT:[log][syslog][priority]}>?(%{INT:[log][syslog][version]}\s*)?(%{SYSLOGTIMESTAMP:[event][created]}|%{TIMESTAMP_ISO8601:[event][created]})\s(%{SYSLOGHOST:[host][name]}\s+)?(%{PROG:[process][name]}\:|%{PROG:[process][name]})(\s*)?(\[)?(%{POSINT:[process][pid]}(\]:)?)?\s*(\-\s*\-)?(-\s*)?\s*(\[meta sequenceId=\"%{INT:[event]sequence]}\"\]\s)?*%{GREEDYDATA:filter_message}

Works but breaks pfSense Logs

a3ilson avatar Feb 02 '22 23:02 a3ilson

Hi, I am using the new version of opnsense, and i get stuck that there are no firewall-logs in kibana. Already tried to setup pfelk few times but it didn't work. Could you explain that? I didn't check the RF 5424 box as descriped in the wiki. Months before ive got pfelk running with this setup, but now it didn't work. And I didn't receive a Firewall-Dashboard at installation, is that korrekt?

Thanks!

tweak19 avatar Mar 20 '22 14:03 tweak19

What method did you install it with?

Can you provide and output from the error-data script (/etc/pfelk/scripts/error-data.sh)

a3ilson avatar Mar 20 '22 16:03 a3ilson

Hi, I try to use the script installer and the manual method, both with the same ending scenario. Here the output from error-data script error.pfelk.log

tweak19 avatar Mar 20 '22 16:03 tweak19

Based on the log file, everything appears to be running. Let's try the following:

Cleanup the /etc/pfelk/conf.d/ to only the following files:

  • 01-inputs.pfelk
  • 05-apps.pfelk
  • 30-geoip.pfelk
  • 49-cleanup.pfelk
  • 50-outputs.pfelk

Next, restart logstash (systemctl restart logstash.service). Give it a few and let me know if that works. If not we'll check on some additional items (logstash roles/permissions).

a3ilson avatar Mar 20 '22 17:03 a3ilson

Done, but still nothing from pfelk-firewall... nginx, dhcp, work, but i can't get anything from the firewall...

tweak19 avatar Mar 20 '22 17:03 tweak19

awe...so nginx, dhcp, are receiving logs. Typically, the logs would be captured with grok failures or Logstash errors but neither of those appear to be the cause here.

Check the following within opnsense:

Screen Shot 2022-03-20 at 13 32 18

Which one's do you have ticked.

a3ilson avatar Mar 20 '22 17:03 a3ilson

I tried both, without anything selected as shown in the wiki and with the use-cases i need. Nothing would change anything to give me a "Firewall-Log"

tweak19 avatar Mar 20 '22 17:03 tweak19

The "filter (filterlog) " is the item required to obtain firewall messages.

a3ilson avatar Mar 20 '22 17:03 a3ilson

I've had issues with past OPNsense versions where I had to stop and restart syslog-ng or enable/disable remote logging.

a3ilson avatar Mar 20 '22 17:03 a3ilson

Next, login to Kibana and navigate to Stack Managment>>Index Management. What data streams are listed on your system.

a3ilson avatar Mar 20 '22 17:03 a3ilson

grafik

Datastreams looks good, but if i go to discover nothing applys

tweak19 avatar Mar 20 '22 17:03 tweak19

Do you have the option within discover?

a3ilson avatar Mar 20 '22 17:03 a3ilson

nope, thats what i am missing

tweak19 avatar Mar 20 '22 17:03 tweak19

gotcha

a3ilson avatar Mar 20 '22 17:03 a3ilson

Easy fix.... you'll need to manually import the missing saved objects:

https://github.com/pfelk/pfelk/blob/main/install/security.md#three-dashboards

a3ilson avatar Mar 20 '22 17:03 a3ilson

Didn't fix the issue, that i already tried.

tweak19 avatar Mar 20 '22 17:03 tweak19

Do these show up?

Screen Shot 2022-03-20 at 13 51 29

a3ilson avatar Mar 20 '22 17:03 a3ilson

No, thats empty, looks like there an issue?

tweak19 avatar Mar 20 '22 17:03 tweak19

found it, typo in the link for the firewall-dashboard https://raw.githubusercontent.com/pfelk/pfelk/main/etc/pfelk/dashboard/22.01-firewall.ndjson

tweak19 avatar Mar 20 '22 17:03 tweak19

Try the attached...if that works, I'll update the repo.

Be sure to remove the trailing .txt

export.ndjson.txt

a3ilson avatar Mar 20 '22 17:03 a3ilson

Where are you pulling that link? The listed here: https://github.com/pfelk/pfelk/blob/main/install/security.md is correct (step 3a)

a3ilson avatar Mar 20 '22 18:03 a3ilson

I corrected the script, looks the download path was wrong, but the install path looks correct.

tweak19 avatar Mar 20 '22 18:03 tweak19

https://raw.githubusercontent.com/pfelk/pfelk/main/etc/pfelk/dashboard/22.04-firewall.ndjson

a3ilson avatar Mar 20 '22 18:03 a3ilson

https://github.com/pfelk/pfelk/blob/main/etc/pfelk/scripts/pfelk-kibana-saved-objects.sh the script i used

tweak19 avatar Mar 20 '22 18:03 tweak19

Sorry about that and thanks/updated the script

a3ilson avatar Mar 20 '22 18:03 a3ilson

No way, thanks for your help! Just a short question, there are any dashboards for vpn planned?

tweak19 avatar Mar 20 '22 18:03 tweak19

what type of logs? OpenVPN is on the list but those logs are a bit messy but any help is appreciated.

a3ilson avatar Mar 20 '22 18:03 a3ilson

Thanks for your answer depenting on openvpn. Another question, is there still anything wrong with suricata and captive-dashboard? I didn't get any usefull inormation there.

tweak19 avatar Jul 28 '22 15:07 tweak19

What is the specific issue with the suricata/captive dashboards?

a3ilson avatar Aug 06 '22 19:08 a3ilson