Darren,
Where would the BPF filter be added?
I initially tried adding this to the local.zeek file:
redef restrict_filters += {[“not-net”] = “not net 13.107.6.152/31 and not net 13.107.18.10/31 and not net 13.107.128.0/22 and not net 23.103.160.0/20 and not net 40.96.0.0/13 and not net 40.104.0.0/15 and not net 52.96.0.0/14 and not net 131.253.33.215/32 and not net 132.245.0.0/16 and not net 150.171.32.0/22 and not net 204.79.197.215/32 and not net 192.169.0.0/16 and not net 147.0.219.0/24”};
When I tailed the conn.log (tail -f -n 200 ./json_streaming_conn.log | grep -i 192.168) I was still seeing files from things on the 192.168.0.0 subnet.
If I add vlan to the filter, for whatever reason, zeek goes to 0% CPU and not all of the logs show up in the current log directory…almost like it’s not even running.
This message was in the notice.log:
{"_path":“notice”,"_write_ts":“2021-08-12T22:06:18.986074Z”,“ts”:“2021-08-12T22:06:18.986074Z”,“note”:“CaptureLoss::Too_Little_Traffic”,“msg”:“Only observed 0 TCP ACKs and was expecting at least 1.”,“peer_descr”:“worker-1-2”,“actions”:[“Notice::ACTION_LOG”],“suppress_for”:3600.0}
redef restrict_filters += {[“not-net”] = “vlan not net 13.107.6.152/31 and not net 13.107.18.10/31 and not net 13.107.128.0/22 and not net 23.103.160.0/20 and not net 40.96.0.0/13 and not net 40.104.0.0/15 and not net 52.96.0.0/14 and not net 131.253.33.215/32 and not net 132.245.0.0/16 and not net 150.171.32.0/22 and not net 204.79.197.215/32 and not net 10.50.0.0/16 and not net 10.51.0.0/16 and not net 147.0.219.0/24”};
Aashish,
When I copied your script and again do a tail on the conn.log with the LOG_FILTERS file in
“/opt/bro/etc/LOG_FILTERS” containing the IP 192.168.1.1, I still see the logs. I’m at a total loss. This is rather frustrating!
Example:
{"_path":“conn”,"_write_ts":“2021-08-12T21:51:49.553378Z”,“ts”:“2021-08-12T21:51:39.347321Z”,“uid”:“CnTyrN1N0x4nll4vG7”,“id.orig_h”:“xx.xx.xx.xx”,“id.orig_p”:38913,“id.resp_h”:“192.168.1.1”,“id.resp_p”:53,“proto”:“udp”,“service”:“dns”,“duration”:0.00020503997802734375,“orig_bytes”:61,“resp_bytes”:125,“conn_state”:“SF”,“local_orig”:true,“local_resp”:true,“missed_bytes”:0,“history”:“Dd”,“orig_pkts”:1,“orig_ip_bytes”:89,“resp_pkts”:1,“resp_ip_bytes”:153}
Just to make sure I didn’t screw something up, here is the script:
module LOG_FILTERS;
export {
global FILTER_FILE = “/opt/bro/etc/LOG_FILTERS” &redef ;
redef Config::config_files += { FILTER_FILE };
option filter_ips: set[addr] = set() ;
option filter_subnets: set[subnet] = set() ;
}
hook Conn::log_policy(rec: Conn::Info, id: Log::ID, filter: Log::Filter) {
if ( rec$id$resp_h in filter_ips )
break;
change to what you want to filter out - src or dst
if (rec$id$orig_h in filter_subnets)
break;
}