Log Import Fails with any Scope Separator other than "."
RITA will fail to correctly parse Zeek logs made with any scope separator other than ".". While "." is the default, some network monitoring projects (Like RockNSM) set it to "_" to avoid parsing issues with software that treats "." as special. As far as Zeek is concerned you can set it to whatever you want. RITA hard codes field names with a separator of ".", e.g. "id.orig_h", "id.resp_p" etc., causing it to only work when the field separator is the default.
For DNS this causes a runtime error at the beginning of parsing:
panic: runtime error: slice bounds out of range [:16] with capacity 0
goroutine 71 [running]:
github.com/activecm/rita/util.IPv4ToBinary(...)
/go/src/github.com/activecm/rita/util/ip.go:126
github.com/activecm/rita/parser.(*FSImporter).parseFiles.func1(0xc0002185b0, 0xc000024510, 0xc0001566f0, 0xc0001566c0, 0xc000156630, 0xc0001562a0, 0xc0001562d0, 0xc000156330, 0xc00060a400, 0x60, ...)
/go/src/github.com/activecm/rita/parser/fsimporter.go:606 +0x56e3
created by github.com/activecm/rita/parser.(*FSImporter).parseFiles
/go/src/github.com/activecm/rita/parser/fsimporter.go:332 +0x2b0
For CONN/HTTP/SSL initial parsing fails without error but since no entries are added to the database you get the following errors at the end of parsing:
Parsing /logs/2021-03-20/ssl.22:00:00-23:00:00.log.gz -> 2021-03-20
[!] No Host data to analyze
[!!] No local network traffic found, please check InternalSubnets in your RITA config (/etc/rita/config.yaml)
[!] No Uconn data to analyze
[!!] No local network traffic found, please check InternalSubnets in your RITA config (/etc/rita/config.yaml)
Steps to reproduce:
*Install Zeek.
*Set redef Log::default_scope_sep = "_"; in your site scripts.
*Generate some logs.
*(Optional) Delete the DNS logs to avoid crashing and get the other error.
*Run rita import on the logs.
Confirmed with RITA v4.1.0 (Latest stable) and Zeek 3.0.1 but as far as I am aware the root cause affects all versions of RITA and Zeek/Bro.
The approach for resolving this that comes immediately to mind is to have Zeek field names be defined globally (Not hard coded across 4+ different files) and to allow the scope separator to be set in the configuration file or at runtime. It should also be possible to infer the scope separator from the log file. Either approach would let RITA work anywhere Zeek does but requires cleaning up the code a bit.