mirror of
https://github.com/zeek/zeek.git
synced 2025-10-08 09:38:19 +00:00
Merge branch 'master' into topic/jsiwek/autodoc-fixes
Conflicts: scripts/CMakeLists.txt scripts/base/frameworks/cluster/setup-connections.bro scripts/base/frameworks/communication/__load__.bro scripts/base/frameworks/metrics/conn-example.bro scripts/base/frameworks/metrics/http-example.bro scripts/site/local.bro
This commit is contained in:
commit
2a9ea6b8ba
96 changed files with 1809 additions and 722 deletions
|
@ -15,5 +15,6 @@ export {
|
|||
|
||||
event bro_init() &priority=-10
|
||||
{
|
||||
enable_communication();
|
||||
listen(listen_if_clear, listen_port_clear, F);
|
||||
}
|
||||
|
|
|
@ -16,5 +16,6 @@ export {
|
|||
|
||||
event bro_init() &priority=-10
|
||||
{
|
||||
enable_communication();
|
||||
listen(listen_if_ssl, listen_port_ssl, T);
|
||||
}
|
||||
|
|
20
scripts/policy/frameworks/metrics/conn-example.bro
Normal file
20
scripts/policy/frameworks/metrics/conn-example.bro
Normal file
|
@ -0,0 +1,20 @@
|
|||
|
||||
redef enum Metrics::ID += {
|
||||
CONNS_ORIGINATED,
|
||||
CONNS_RESPONDED
|
||||
};
|
||||
|
||||
event bro_init()
|
||||
{
|
||||
Metrics::add_filter(CONNS_ORIGINATED, [$aggregation_mask=24, $break_interval=1mins]);
|
||||
|
||||
# Site::local_nets must be defined in order for this to actually do anything.
|
||||
Metrics::add_filter(CONNS_RESPONDED, [$aggregation_table=Site::local_nets_table, $break_interval=1mins]);
|
||||
}
|
||||
|
||||
event connection_established(c: connection)
|
||||
{
|
||||
Metrics::add_data(CONNS_ORIGINATED, [$host=c$id$orig_h]);
|
||||
Metrics::add_data(CONNS_RESPONDED, [$host=c$id$resp_h]);
|
||||
}
|
||||
|
22
scripts/policy/frameworks/metrics/http-example.bro
Normal file
22
scripts/policy/frameworks/metrics/http-example.bro
Normal file
|
@ -0,0 +1,22 @@
|
|||
|
||||
|
||||
redef enum Metrics::ID += {
|
||||
HTTP_REQUESTS_BY_STATUS_CODE,
|
||||
HTTP_REQUESTS_BY_HOST_HEADER,
|
||||
};
|
||||
|
||||
event bro_init()
|
||||
{
|
||||
Metrics::add_filter(HTTP_REQUESTS_BY_HOST_HEADER, [$break_interval=5mins]);
|
||||
|
||||
# Site::local_nets must be defined in order for this to actually do anything.
|
||||
Metrics::add_filter(HTTP_REQUESTS_BY_STATUS_CODE, [$aggregation_table=Site::local_nets_table, $break_interval=5mins]);
|
||||
}
|
||||
|
||||
event HTTP::log_http(rec: HTTP::Info)
|
||||
{
|
||||
if ( rec?$host )
|
||||
Metrics::add_data(HTTP_REQUESTS_BY_HOST_HEADER, [$index=rec$host]);
|
||||
if ( rec?$status_code )
|
||||
Metrics::add_data(HTTP_REQUESTS_BY_STATUS_CODE, [$host=rec$id$orig_h, $index=fmt("%d", rec$status_code)]);
|
||||
}
|
22
scripts/policy/frameworks/metrics/ssl-example.bro
Normal file
22
scripts/policy/frameworks/metrics/ssl-example.bro
Normal file
|
@ -0,0 +1,22 @@
|
|||
|
||||
|
||||
redef enum Metrics::ID += {
|
||||
SSL_SERVERNAME,
|
||||
};
|
||||
|
||||
event bro_init()
|
||||
{
|
||||
Metrics::add_filter(SSL_SERVERNAME,
|
||||
[$name="no-google-ssl-servers",
|
||||
$pred(entry: Metrics::Entry) = {
|
||||
return (/google\.com$/ !in entry$index);
|
||||
},
|
||||
$break_interval=10secs
|
||||
]);
|
||||
}
|
||||
|
||||
event SSL::log_ssl(rec: SSL::Info)
|
||||
{
|
||||
if ( rec?$server_name )
|
||||
Metrics::add_data(SSL_SERVERNAME, [$index=rec$server_name]);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue