OK, further refinement:
I’ve been going over the documentation for notices and raising alerts and googling and I think I’ve got the right code syntax, but I still am not getting emailed alerts.
I configured the following line in /usr/local/bro/share/bro/base/frameworks/notice/main.bro
const mail_dest = “reswob10@gmail.com” &redef;
And here is my script:
module HTTP;
export {
redef enum Notice::Type += {
Generated if a site is detected using Basic Access Authentication
HTTP::Basic_Auth_Server
};
}
redef Notice::mail_dest = “reswob10@gmail.com”;
hook Notice::policy(n: Notice::Info) {
if (n$note == HTTP::Basic_Auth_Server)
print n$note;
add n$actions[Notice::ACTION_EMAIL];
}
event http_header(c: connection, is_orig: bool, name: string, value: string)
{
if (/AUTHORIZATION/ in name && /Basic/ in value)
{
local parts: string_array;
parts = split1(decode_base64(sub_bytes(value, 7, |value|)), /:/);
if (|parts| == 2)
NOTICE([$note=HTTP::Basic_Auth_Server,
$identifier=cat(c$id$resp_h, c$id$resp_p),
$suppress_for=1day,
$conn=c
]);
}
}
When I run the script against a local pcap with HTTP basic auth traffic, I get the printed line:
root@raspberrypi:/home/pi# bro -C -r http-bro.pcap http-auth-notice.bro
HTTP::Basic_Auth_Server
But I never get the emailed alert.
I AM getting hourly Connection Summary emails so I know bro can send email to my gmail address. Would the alerts be included inside those emails?
Could you please provide any tips/suggestions/corrections/rebukes for what I’m doing? Are there other configurations I missed? Is there a general log for bro that can show an error if it’s trying to send email but it can’t?
Thanks.