Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wiki article and example YAML/scripts for custom Zeek/Suricata/NetFlow #72

Merged
merged 37 commits into from
Jun 9, 2021
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
ea2b64c
Initial version
philrz Apr 29, 2021
61b4ab5
Link to article
philrz May 5, 2021
6c64878
Add space
philrz May 5, 2021
8379e3a
PR feedback: Fix wording
philrz May 5, 2021
526c9a7
PR feedback: Single type definition for 'port' in Suricata shaper
philrz May 6, 2021
8d3154f
PR feedback: Exec zeek in the Zeek wrapper
philrz May 6, 2021
11a4e58
PR feedback: Remove cat and exec last command
philrz May 6, 2021
816e771
PR feedback: Use -e to exit early if Suricata returns nonzero
philrz May 6, 2021
a7c6b9d
Point to 'latest' Suricata docs
philrz May 6, 2021
bc151b7
PR feedback: Simplify sentence about dedup
philrz May 6, 2021
e16ad14
Add Debug section
philrz May 6, 2021
22792df
Reduce redundant wording
philrz May 6, 2021
12480e7
Match article text to script text
philrz May 6, 2021
749da10
Use apt -y
philrz May 6, 2021
8a7de12
Bash header
philrz May 6, 2021
41ac5bb
test
philrz May 10, 2021
8377db7
Revert "test"
philrz May 10, 2021
aaeb210
Merge branch 'main' into custom-yaml-article
philrz May 18, 2021
23f2c75
Rename article so it can pass link checker
philrz May 18, 2021
dc96a59
Updates for Zed language changes and zed/2670 fix
philrz May 18, 2021
9412f23
More updates to reflect langauge changes and enhancements
philrz May 18, 2021
59cdb24
Fix paths in wrapper scripts
philrz May 18, 2021
e39ea54
More path fixes
philrz May 18, 2021
7adab90
More path fixes & screenshot
philrz May 18, 2021
9b194a7
More path fixes
philrz May 18, 2021
2f6569e
nfdump fixes
philrz May 18, 2021
623ff52
Use absolute paths for workdir
philrz May 18, 2021
ab1beff
Final polish
philrz Jun 8, 2021
efa84ce
Adjust to new way of creating pools with zed api
philrz Jun 8, 2021
1555a68
Reference brim/950
philrz Jun 8, 2021
d1a3ca5
Fix path to Zeek binary
philrz Jun 8, 2021
e5fa400
Fix Suricata path
philrz Jun 8, 2021
2f1da43
Include LD_LIBRARY_PATH in nfdump wrapper
philrz Jun 8, 2021
20224df
Improve wording
philrz Jun 8, 2021
c45bdc4
Adjust wording
philrz Jun 8, 2021
00df747
Adjust wording
philrz Jun 8, 2021
6dbb4f7
Refernece zed/2398
philrz Jun 8, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
433 changes: 433 additions & 0 deletions docs/Custom-brimcap-load-Config.md

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions docs/Home.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,7 @@ your effective use of Brimcap.
## Support Resources

- [[Troubleshooting]]

## User Documentation

- [Custom `brimcap load` Config](Custom-brimcap-load-Config)
4 changes: 4 additions & 0 deletions docs/_Sidebar.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
**Support Resources**

- [[Troubleshooting]]

**User Documentation**

- [Custom `brimcap load` Config](Custom-brimcap-load-Config)
Binary file added docs/media/Custom-Zeek-Suricata-Pool.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/media/NetFlow-Pool.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 9 additions & 0 deletions examples/nfdump-wrapper.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/bash
TMPFILE=$(mktemp)
cat - > "$TMPFILE"
nfpcapd -r "$TMPFILE" -l .
rm "$TMPFILE"
for file in nfcapd.*
do
nfdump -r $file -o csv | head -n -3 | zq -i csv -f ndjson - > ${file}.ndjson
done
60 changes: 60 additions & 0 deletions examples/nfdump.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
analyzers:
- cmd: nfdump-wrapper.sh
# The globs being set to "*.ndjson" is a workaround for the fact that our
# current JSON reader won't accept much data and we can't tell
# brimcap load to expect CSV input, so we're postprocessing in the
# nfdump-wrapper.sh script with zq to turn the CSV back into NDJSON.
globs: ["*.ndjson"]
shaper: |
type netflow = {
ts: time,
te: time,
td: duration,
sa: ip,
da: ip,
sp: uint16,
dp: uint16,
pr: string,
flg: string,
fwd: bytes,
stos: bytes,
ipkt: uint64,
ibyt: uint64,
opkt: uint64,
obyt: uint64,
\in: uint64,
out: uint64,
sas: uint64,
das: uint64,
smk: uint8,
dmk: uint8,
dtos: bytes,
dir: uint8,
nh: ip,
nhb: ip,
svln: uint16,
dvln: uint16,
ismc: string,
odmc: string,
idmc: string,
osmc: string,
mpls1: string,
mpls2: string,
mpls3: string,
mpls4: string,
mpls5: string,
mpls6: string,
mpls7: string,
mpls8: string,
mpls9: string,
mpls10: string,
cl: float64,
sl: float64,
al: float64,
ra: ip,
eng: string,
exid: bytes,
tr: time
}
// The leading "put tr=time(tr)" is a workaround to zed/2670
put tr=time(tr) | put . = shape(netflow)
3 changes: 3 additions & 0 deletions examples/suricata-wrapper.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash
suricata -r /dev/stdin
cat eve.json | jq -c . > deduped-eve.json
52 changes: 52 additions & 0 deletions examples/zeek-suricata.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
analyzers:
- cmd: zeek-wrapper.sh
- cmd: suricata-wrapper.sh
globs: ["deduped*.json"]
shaper: |
type alert = {
timestamp: time,
event_type: bstring,
src_ip: ip,
src_port: port=(uint16),
dest_ip: ip,
dest_port: port=(uint16),
vlan: [uint16],
proto: bstring,
app_proto: bstring,
alert: {
severity: uint16,
signature: bstring,
category: bstring,
action: bstring,
signature_id: uint64,
gid: uint64,
rev: uint64,
metadata: {
signature_severity: [bstring],
former_category: [bstring],
attack_target: [bstring],
deployment: [bstring],
affected_product: [bstring],
created_at: [bstring],
performance_impact: [bstring],
updated_at: [bstring],
malware_family: [bstring],
tag: [bstring]
}
},
flow_id: uint64,
pcap_cnt: uint64,
tx_id: uint64,
icmp_code: uint64,
icmp_type: uint64,
tunnel: {
src_ip: ip,
src_port: port=(uint16),
dest_ip: ip,
dest_port: port=(uint16),
proto: bstring,
depth: uint64
},
community_id: bstring
}
filter event_type=alert | put . = shape(alert) | rename ts=timestamp
2 changes: 2 additions & 0 deletions examples/zeek-wrapper.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/bash
zeek -C -r - --exec "event zeek_init() { Log::disable_stream(PacketFilter::LOG); Log::disable_stream(LoadedScripts::LOG); }" local