mirror of
https://github.com/zeek/zeek.git
synced 2025-10-16 21:48:21 +00:00
Fix an example in quickstart docs.
BIT-1226 #close
This commit is contained in:
parent
0b6e225758
commit
dbf58be0e5
8 changed files with 137 additions and 31 deletions
|
@ -0,0 +1,26 @@
|
|||
.. rst-class:: btest-cmd
|
||||
|
||||
.. code-block:: none
|
||||
:linenos:
|
||||
:emphasize-lines: 1,1
|
||||
|
||||
# bro -r tls/tls-expired-cert.trace conditional-notice.bro
|
||||
|
||||
.. rst-class:: btest-cmd
|
||||
|
||||
.. code-block:: none
|
||||
:linenos:
|
||||
:emphasize-lines: 1,1
|
||||
|
||||
# cat notice.log
|
||||
#separator \x09
|
||||
#set_separator ,
|
||||
#empty_field (empty)
|
||||
#unset_field -
|
||||
#path notice
|
||||
#open 2015-03-23-18-03-21
|
||||
#fields ts uid id.orig_h id.orig_p id.resp_h id.resp_p fuid file_mime_type file_desc proto note msg sub src dst p n peer_descr actions suppress_for dropped remote_location.country_code remote_location.region remote_location.city remote_location.latitude remote_location.longitude
|
||||
#types time string addr port addr port string string string enum enum string string addr addr port count string set[enum] interval bool string string string double double
|
||||
1394745603.293028 CXWv6p3arKYeMETxOg 192.168.4.149 60539 87.98.220.10 443 F1fX1R2cDOzbvg17ye - - tcp SSL::Certificate_Expired Certificate CN=www.spidh.org,OU=COMODO SSL,OU=Domain Control Validated expired at 2014-03-04-23:59:59.000000000 - 192.168.4.149 87.98.220.10 443 - bro Notice::ACTION_EMAIL,Notice::ACTION_LOG 86400.000000 F - - - - -
|
||||
#close 2015-03-23-18-03-21
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
# @TEST-EXEC: cat %INPUT >output && btest-diff output
|
||||
|
||||
conditional-notice.bro
|
||||
|
||||
@load protocols/ssl/expiring-certs
|
||||
|
||||
const watched_servers: set[addr] = {
|
||||
87.98.220.10,
|
||||
} &redef;
|
||||
|
||||
# Site::local_nets usually isn't something you need to modify if
|
||||
# BroControl automatically sets it up from networks.cfg. It's
|
||||
# shown here for completeness.
|
||||
redef Site::local_nets += {
|
||||
87.98.0.0/16,
|
||||
};
|
||||
|
||||
hook Notice::policy(n: Notice::Info)
|
||||
{
|
||||
if ( n$note != SSL::Certificate_Expired )
|
||||
return;
|
||||
|
||||
if ( n$id$resp_h !in watched_servers )
|
||||
return;
|
||||
|
||||
add n$actions[Notice::ACTION_EMAIL];
|
||||
}
|
||||
|
2
testing/btest/doc/sphinx/conditional-notice.btest
Normal file
2
testing/btest/doc/sphinx/conditional-notice.btest
Normal file
|
@ -0,0 +1,2 @@
|
|||
@TEST-EXEC: btest-rst-cmd bro -r ${TRACES}/tls/tls-expired-cert.trace ${DOC_ROOT}/quickstart/conditional-notice.bro
|
||||
@TEST-EXEC: btest-rst-cmd cat notice.log
|
|
@ -0,0 +1,28 @@
|
|||
# @TEST-EXEC: cat %INPUT >output && btest-diff output
|
||||
|
||||
conditional-notice.bro
|
||||
|
||||
@load protocols/ssl/expiring-certs
|
||||
|
||||
const watched_servers: set[addr] = {
|
||||
87.98.220.10,
|
||||
} &redef;
|
||||
|
||||
# Site::local_nets usually isn't something you need to modify if
|
||||
# BroControl automatically sets it up from networks.cfg. It's
|
||||
# shown here for completeness.
|
||||
redef Site::local_nets += {
|
||||
87.98.0.0/16,
|
||||
};
|
||||
|
||||
hook Notice::policy(n: Notice::Info)
|
||||
{
|
||||
if ( n$note != SSL::Certificate_Expired )
|
||||
return;
|
||||
|
||||
if ( n$id$resp_h !in watched_servers )
|
||||
return;
|
||||
|
||||
add n$actions[Notice::ACTION_EMAIL];
|
||||
}
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue