mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 14:48:21 +00:00
Add page and email_admin to hostnames extension
This commit is contained in:
parent
672504e265
commit
3bb4a35200
3 changed files with 33 additions and 4 deletions
|
@ -33,3 +33,8 @@ hook notice(n: Notice::Info) &priority=-5
|
||||||
email_notice_to(n, email, T);
|
email_notice_to(n, email, T);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# If hostnames.zeek was loaded first, add ourselves
|
||||||
|
@ifdef ( email_with_hostnames_types )
|
||||||
|
redef email_with_hostnames_types += { ACTION_EMAIL_ADMIN };
|
||||||
|
@endif
|
||||||
|
|
|
@ -11,7 +11,7 @@ export {
|
||||||
## variable.
|
## variable.
|
||||||
ACTION_PAGE
|
ACTION_PAGE
|
||||||
};
|
};
|
||||||
|
|
||||||
## Email address to send notices with the :zeek:enum:`Notice::ACTION_PAGE`
|
## Email address to send notices with the :zeek:enum:`Notice::ACTION_PAGE`
|
||||||
## action.
|
## action.
|
||||||
option mail_page_dest = "";
|
option mail_page_dest = "";
|
||||||
|
@ -22,3 +22,8 @@ hook notice(n: Notice::Info) &priority=-5
|
||||||
if ( ACTION_PAGE in n$actions )
|
if ( ACTION_PAGE in n$actions )
|
||||||
email_notice_to(n, mail_page_dest, F);
|
email_notice_to(n, mail_page_dest, F);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# If hostnames.zeek was loaded first, add ourselves
|
||||||
|
@ifdef ( email_with_hostnames_types )
|
||||||
|
redef email_with_hostnames_types += { ACTION_PAGE };
|
||||||
|
@endif
|
||||||
|
|
|
@ -1,12 +1,20 @@
|
||||||
##! Loading this script extends the :zeek:enum:`Notice::ACTION_EMAIL` action
|
##! Loading this script extends the emails that Zeek sends
|
||||||
##! by appending to the email the hostnames associated with
|
##! by appending to the email the hostnames associated with
|
||||||
##! :zeek:type:`Notice::Info`'s *src* and *dst* fields as determined by a
|
##! :zeek:type:`Notice::Info`'s *src* and *dst* fields as determined by a
|
||||||
##! DNS lookup.
|
##! DNS lookup. This is enabled for the :zeek:enum:`Notice::ACTION_EMAIL`
|
||||||
|
##! action by default, and :zeek:enum:`Notice::ACTION_EMAIL_ADMIN` and
|
||||||
|
##! :zeek:enum:`Notice::ACTION_PAGE` if their scripts are loaded.
|
||||||
|
|
||||||
@load base/frameworks/notice/main
|
@load base/frameworks/notice/main
|
||||||
|
|
||||||
module Notice;
|
module Notice;
|
||||||
|
|
||||||
|
export {
|
||||||
|
## The Notice action types whose e-mails will be extended with hostnames.
|
||||||
|
## :zeek:see:`Notice::Action`
|
||||||
|
option email_with_hostnames_types: set[Notice::Action] = {ACTION_EMAIL};
|
||||||
|
}
|
||||||
|
|
||||||
# We have to store references to the notices here because the when statement
|
# We have to store references to the notices here because the when statement
|
||||||
# clones the frame which doesn't give us access to modify values outside
|
# clones the frame which doesn't give us access to modify values outside
|
||||||
# of it's execution scope. (we get a clone of the notice instead of a
|
# of it's execution scope. (we get a clone of the notice instead of a
|
||||||
|
@ -19,7 +27,8 @@ hook notice(n: Notice::Info) &priority=10
|
||||||
return;
|
return;
|
||||||
|
|
||||||
# This should only be done for notices that are being sent to email.
|
# This should only be done for notices that are being sent to email.
|
||||||
if ( ACTION_EMAIL !in n$actions )
|
# We calculate the intersection, and don't do anything if it's empty.
|
||||||
|
if ( |n$actions & email_with_hostnames_types| == 0 )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
# I'm not recovering gracefully from the when statements because I want
|
# I'm not recovering gracefully from the when statements because I want
|
||||||
|
@ -50,3 +59,13 @@ hook notice(n: Notice::Info) &priority=10
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# If page.zeek was loaded first, add that action
|
||||||
|
@ifdef ( ACTION_PAGE )
|
||||||
|
redef email_with_hostnames_types += { ACTION_PAGE };
|
||||||
|
@endif
|
||||||
|
|
||||||
|
# If email_admin.zeek was loaded first, add that action
|
||||||
|
@ifdef ( ACTION_EMAIL_ADMIN )
|
||||||
|
redef email_with_hostnames_types += { ACTION_EMAIL_ADMIN };
|
||||||
|
@endif
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue