mirror of
https://github.com/zeek/zeek.git
synced 2025-10-12 03:28:19 +00:00

This change makes the community-id script that adds the community id to notice.log automatically load the main script if this was not already loaded. In the past, the script just did not perform any action if the main script was not loaded. This change also makes the notice script respect the seed/base64 settings that were set in the main script. Fixes GH-3242
25 lines
690 B
Text
25 lines
690 B
Text
# Source this script to add Community ID to notices.
|
|
# This script will automatically load the main community-id script.
|
|
|
|
@load base/protocols/conn
|
|
@load base/frameworks/notice
|
|
@load policy/protocols/conn/community-id-logging
|
|
|
|
module CommunityID::Notice;
|
|
|
|
export {
|
|
# Turn notice support on/off at runtime. When disabled,
|
|
# this still leaves the `community_id` string in the notice
|
|
# log, just unset.
|
|
option enabled: bool = T;
|
|
|
|
redef record Notice::Info += {
|
|
community_id: string &optional &log;
|
|
};
|
|
}
|
|
|
|
hook Notice::notice(n: Notice::Info)
|
|
{
|
|
if ( CommunityID::Notice::enabled && n?$conn )
|
|
n$community_id = community_id_v1(n$conn$id, CommunityID::seed, CommunityID::do_base64);
|
|
}
|