-
Notifications
You must be signed in to change notification settings - Fork 24
/
filter_noise_x509.bro
executable file
·50 lines (43 loc) · 1.24 KB
/
filter_noise_x509.bro
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
# Contributor(s):
# Johanna Amann, Bro/ICSI - [email protected]
# Michal Purzynski [email protected]
#
module LogFilter;
redef record X509::Info += {
local_cert: bool &default=F;
};
event file_state_remove(f: fa_file) &priority=6
{
if ( ! f$info?$x509 )
return;
for ( i in f$info$tx_hosts )
{
if ( Site::is_local_addr(i) )
f$info$x509$local_cert = T;
}
}
function no_local_certs(rec: X509::Info): bool
{
return ! rec$local_cert;
}
event bro_init () &priority=-5
{
local f = Log::get_filter(X509::LOG, "default");
Log::remove_filter(X509::LOG, "default");
f$pred=no_local_certs;
Log::add_filter(X509::LOG, f);
}
#event bro_init()
#{
# Log::remove_default_filter(X509::LOG);
# Log::add_filter(X509::LOG, [$name = "X509-noise",
# $pred(rec: X509::Info) = {
# if ((rec$certificate?$cn) && (/mozilla\.(com|org|net)$/ in rec$certificate$cn))
# return F;
# }
# ]);
#}