Add btests for ip_proto policy files

This commit is contained in:
Tim Wojtulewicz 2024-11-13 16:11:04 -07:00
parent 2125a1f558
commit fbaf438a1d
3 changed files with 25 additions and 0 deletions

View file

@ -0,0 +1,2 @@
### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63.
unknown-ip-proto-500

View file

@ -0,0 +1,8 @@
# @TEST-DOC: Test the policy for removing the unknown IP protocol field and connections from conn.log
# @TEST-EXEC: zeek -r $TRACES/cisco-fabric-path.pcap %INPUT
# @TEST-EXEC: test $(head -1 conn.log | jq 'has("ip_proto")') = "false"
# @TEST-EXEC-FAIL: cat conn.log | jq .proto | sort | uniq | grep unknown_transport
@load policy/protocols/conn/disable-unknown-ip-proto-support
redef LogAscii::use_json = T;

View file

@ -0,0 +1,15 @@
# @TEST-DOC: Tests the ip-proto-name-logging policy file
# @TEST-EXEC: zeek -r $TRACES/cisco-fabric-path.pcap %INPUT > out
# @TEST-EXEC-FAIL: cat conn.log | jq 'has("ip_proto_name")' | grep "false"
# @TEST-EXEC: cat conn.log | jq .ip_proto_name | sort | uniq | grep private-encryption
# @TEST-EXEC: btest-diff out
@load policy/protocols/conn/ip-proto-name-logging
redef LogAscii::use_json = T;
event zeek_init() {
# Test printing out an unknown value from the protocol_names table
print IP::protocol_names[500];
}