Commit graph

11634 commits

Author SHA1 Message Date
Seth Hall
2bdc56dfcd Make it possible to pass command line options through to scripts.
The feature is documented with the zeek_script_args variable in
init-bare.zeek.
2020-10-08 15:46:28 -04:00
Jon Siwek
b3c5e9adbb Merge remote-tracking branch 'origin/topic/jsiwek/gh-1200'
* origin/topic/jsiwek/gh-1200:
  GH-1200: ignore a maybe-uninitialized warning
2020-10-08 12:07:58 -07:00
Vlad Grigorescu
c58cf69890 Add test for CaptureLoss::Too_Little_Traffic 2020-10-08 11:34:04 -05:00
Vlad Grigorescu
59620ed75d Add CaptureLoss::Too_Little_Traffic 2020-10-08 11:26:46 -05:00
Vlad Grigorescu
cb9d419fa4 Add CaptureLoss::initial_watch_interval for a quick read on cluster health after startup. 2020-10-08 09:41:29 -05:00
Vlad Grigorescu
bb3527c955 Documentation update, reference the threshold variable. [nomail] [skip ci] 2020-10-08 09:38:26 -05:00
Vlad Grigorescu
1b696490d0 Whitespace fixes only [nomail] [skip ci] 2020-10-08 09:36:18 -05:00
zeek-bot
d2f260c168 Update doc submodule [nomail] [skip ci] 2020-10-08 00:35:45 +00:00
Jon Siwek
164cac2563 GH-1200: ignore a maybe-uninitialized warning 2020-10-07 14:49:27 -07:00
Jon Siwek
6902b645ba Merge: Fix multipart MIME leak of sub-part found after closing-boundary 2020-10-07 10:46:51 -07:00
Robin Sommer
b0bf9f02c8 Merge remote-tracking branch 'origin/topic/christian/364-logfilter-hooks' into master
(Adding a NEWS entry.)

* origin/topic/christian/364-logfilter-hooks:
  Update testing/btest/scripts/base/frameworks/logging/hooks.zeek
  Btests for log filter policy hooks
  Btest baseline updates to reflect new logging policy hooks
  Migrate existing use of filter predicates to policy hooks
  Support for log filter policy hooks
2020-10-07 08:44:50 +00:00
zeek-bot
15495356c5 Update doc submodule [nomail] [skip ci] 2020-10-07 00:37:34 +00:00
Jon Siwek
f9f6140c15 Merge remote-tracking branch 'origin/topic/robin/gh-425-record-perf'
- Removed a now-unused-local-variable
- Added std::move() in AssignExpr::SetOp2()

* origin/topic/robin/gh-425-record-perf:
  Avoid unnecessary temporary value when coercing a record that's already the right type.
  Optimize record constructor expression.
  Unify type comparisions for records.
2020-10-06 12:25:39 -07:00
Jon Siwek
506d961b27 Merge branch 'logging-ascii-enable-shadow-logs' of https://github.com/awelzel/zeek into master
- Improved documentation/comment for the new option

* 'logging-ascii-enable-shadow-logs' of https://github.com/awelzel/zeek:
  logging/ascii: Support leftover log rotation in non-supervisor setups
2020-10-06 10:15:34 -07:00
Robin Sommer
553ce28500 Avoid unnecessary temporary value when coercing a record that's already the right type.
The combination of this commit with the previous one now lets the
examples in #425 all execute with the same performance.

Closes #425.
2020-10-05 10:49:03 +00:00
Robin Sommer
e9aa531b83 Optimize record constructor expression.
We remove the inheritance from UnaryExpression because we know the
type of the operand precisely and can skip a temporary when evaluating
the expression.

#425
2020-10-05 10:48:36 +00:00
Robin Sommer
d782c60f19 Unify type comparisions for records.
For records, same_type(r1, r2) would not check if the fields'
attributes match as well. That seems like an oversight, and some
callers of same_type() did indeed add that check on their end. This
commit moves the check into same_type() itself. That generally doesn't
seem make any differences except for a couple of places validating
code, which we update a bit. That in turn leans to slightly different
(better?) error messages for a couple of test cases.
2020-10-05 10:47:46 +00:00
Arne Welzel
1f5ab4878b logging/ascii: Support leftover log rotation in non-supervisor setups
We have a use case to rotate leftover log files in a non-supervisor
setup. There doesn't seem to be a strict requirement on supervisor
functionality. Allow enabling leftover log rotation through
LogAscii::enable_leftover_log_rotation and redef this for the
logger node in a supervisor setup individually.
2020-10-02 20:38:48 +02:00
Jon Siwek
a2577891e0 Merge remote-tracking branch 'origin/topic/jsiwek/gh-1180-include-external-headers'
* origin/topic/jsiwek/gh-1180-include-external-headers:
  Add external dependency include paths to `zeek-config --include_dir`
2020-10-02 10:50:14 -07:00
Jon Siwek
a87281a1d9 Merge remote-tracking branch 'origin/topic/jsiwek/improve-checksum'
* origin/topic/jsiwek/improve-checksum:
  Switch one's complement checksum implementation
2020-10-02 10:26:43 -07:00
Christian Kreibich
c662237499 Update testing/btest/scripts/base/frameworks/logging/hooks.zeek
Co-authored-by: Robin Sommer <robin@corelight.com>
2020-09-30 13:10:35 -07:00
Christian Kreibich
3d2c3284c7 Btests for log filter policy hooks 2020-09-30 13:10:35 -07:00
Christian Kreibich
2a49715fe6 Btest baseline updates to reflect new logging policy hooks 2020-09-30 13:10:07 -07:00
Christian Kreibich
7bd8351719 Migrate existing use of filter predicates to policy hooks 2020-09-30 12:45:20 -07:00
Christian Kreibich
1bd658da8f Support for log filter policy hooks
This adds a "policy" hook into the logging framework's streams and
filters to replace the existing log filter predicates. The hook
signature is as follows:

    hook(rec: any, id: Log::ID, filter: Log::Filter);

The logging manager invokes hooks on each log record. Hooks can veto
log records via a break, and modify them if necessary. Log filters
inherit the stream-level hook, but can override or remove the hook as
needed.

The distribution's existing log streams now come with pre-defined
hooks that users can add handlers to. Their name is standardized as
"log_policy" by convention, with additional suffixes when a module
provides multiple streams. The following adds a handler to the Conn
module's default log policy hook:

    hook Conn::log_policy(rec: Conn::Info, id: Log::ID, filter: Log::Filter)
            {
            if ( some_veto_reason(rec) )
                break;
            }

By default, this handler will get invoked for any log filter
associated with the Conn::LOG stream.

The existing predicates are deprecated for removal in 4.1 but continue
to work.
2020-09-30 12:32:45 -07:00
Jon Siwek
c8545c85d8 Improve broker/ssl_auth_failure.zeek test
There was a race that previously may cause it to not truly test
whether the connecting-process exited due to SSL authentication
failure or just because the listening-process wasn't available yet
(e.g. due to process scheduling variability).
2020-09-29 17:12:03 -07:00
Jon Siwek
98ae204fc0 Fix multipart MIME leak of sub-part found after closing-boundary
After detecting a closing-boundary for a given multipart MIME entity, it
enters into an "end of data" state, however any subsequent boundary
delimiter could still cause the allocation of a sub-entity object that
is never released due to cleanup logic being bypassed upon finding the
"end of data" state already reached.

This change prevents allocation/processing of sub-entities after the
"end of data" state is reached (e.g. from detecting a multipart
closing-boundary).  This new behavior still aligns with RFC 2046
expectations:

"There appears to be room for additional information prior to the first
boundary delimiter line and following the final boundary delimiter line.
These areas should generally be left blank, and implementations must
ignore anything that appears before the first boundary delimiter line or
after the last one."

Credit to OSS-Fuzz for discovery
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=26027
(Link to details becomes public 30 days after patch release)
2020-09-29 15:48:01 -07:00
Jon Siwek
da5501b671 Update submodule(s) [nomail] [skip ci] 2020-09-29 15:42:08 -07:00
zeek-bot
863116cf9f Update doc submodule [nomail] [skip ci] 2020-09-26 00:34:24 +00:00
Jon Siwek
b065b6ed61 Merge remote-tracking branch 'origin/topic/robin/filtered-trace'
* origin/topic/robin/filtered-trace:
  Tweak find-filtered-trace to not flag traces if they have non-TCP traffic.
2020-09-25 15:12:04 -07:00
Jon Siwek
c1492942bb Merge branch 'add-dce-rpc-payloads' of https://github.com/ynadji/zeek
- Changed the new stub events to correctly check for existence of
  their associated handler before generating an event

- Added a test case for the new stub event

* 'add-dce-rpc-payloads' of https://github.com/ynadji/zeek:
  Add stub payload to dce_rpc_request and dce_rpc_response
2020-09-25 14:39:30 -07:00
Jon Siwek
cc5066632b Update submodule(s) [nomail] [skip ci] 2020-09-25 13:18:43 -07:00
Yacin Nadji
fd58c724a5 Add stub payload to dce_rpc_request and dce_rpc_response 2020-09-25 11:40:06 -04:00
Robin Sommer
1f6fc4415f Tweak find-filtered-trace to not flag traces if they have non-TCP
traffic.

Closes #160.
2020-09-25 11:29:44 +00:00
Tim Wojtulewicz
ee5212c4a9 Fix namespace warning in fuzzer code 2020-09-24 20:44:30 -07:00
Tim Wojtulewicz
8d856df305 Merge remote-tracking branch 'origin/topic/jsiwek/packet-analyzer-docs'
* origin/topic/jsiwek/packet-analyzer-docs:
  Fix a Sphinx warning about misformatted packet analyzer comment
  Add Zeekygen documentation support for packet analyzers
2020-09-24 16:03:58 -07:00
Jon Siwek
f96e10da75 Add external dependency include paths to zeek-config --include_dir
Addresses https://github.com/zeek/zeek/issues/1180

This helps ensure successful compilation of a plugin that includes a
Zeek header which includes an external dependency header even if the
plugin itself doesn't necessarily depend on that external library.
2020-09-24 14:08:26 -07:00
Jon Siwek
837999d1a7 Update submodule(s) [nomail] [skip ci] 2020-09-24 10:46:52 -07:00
Tim Wojtulewicz
23bbe0ac38 Move packet_mgr to the zeek namespace 2020-09-24 09:56:55 -07:00
Jon Siwek
d070709c57 Switch one's complement checksum implementation
Borrows the `in_cksum` code from tcpdump, which borrowed from FreeBSD.
It handles unaligned data better and also unrolls the inner loop to
process 16 two-byte values at a time versus 2 one-byte values at a time
in the previous version.  Generally measured as ~1.5x faster in a
release build.  The new API should generally be more amenable to any
future optimization explorations since all relevant data blocks are
available within a single call rather than spread across multiple.
2020-09-24 09:41:15 -07:00
Jon Siwek
8feca7291b Merge remote-tracking branch 'origin/topic/jsiwek/gh-822-ubsan-ci'
* origin/topic/jsiwek/gh-822-ubsan-ci:
  Fix negative-value-left-shift undefined behavior in patricia trie
  Improve negation of ConstExpr
  Avoid signed integer overflow when combining SMB header PID bits
  Avoid unary negation of INT64_MIN in modp_litoa10
  Avoid double-to-int conversion overflows in modp_dtoa functions
  Fix divide-by-zero in Entropy analyzer
  Fix divide-by-zero in stats/profiling memory usage calculation
  Fix uninitialized field in POP3 fuzzer
  Add framework for running UndefinedBehaviorSanitizer in CI
2020-09-24 08:17:58 -07:00
Jon Siwek
168da19e9a Update submodule(s) [nomail] 2020-09-24 07:48:25 -07:00
Jon Siwek
cee10b5dc6 Fix a Sphinx warning about misformatted packet analyzer comment 2020-09-23 22:52:35 -07:00
Jon Siwek
0d58e97349 Add Zeekygen documentation support for packet analyzers 2020-09-23 22:50:52 -07:00
Jon Siwek
b0db3cc76f Update external test suite commit pointers 2020-09-23 21:26:46 -07:00
Tim Wojtulewicz
68e20def1e Merge remote-tracking branch 'j-gras/llpoc'
* j-gras/llpoc: (43 commits)
  Update NEWS
  Fix build on FreeBSD, which was missing full definition of sockaddr for ARP
  Update hashes for external testing repos
  Fix handling of session analysis.
  Fix Sessions::DoNextPacket to ignore ARP packets and not report weirds for them
  Packet analysis cleanup.
  Minor cleanup
  Simplify packet analyzer config.
  Make default packet analyzer definition explicit.
  Add explicit root analyzer for packet analysis.
  Extend packet analysis test.
  Simplify MPLS analysis.
  Improve packet analysis data flow.
  Improve packet analyzer API.
  Rename DefaultAnalyzer to IP.
  Move ARP analysis into packet analyzer.
  Small cleanup of packet analysis.
  Fix some build issues from the rebase
  Remove encap_hdr_size (replaced by skip analyzer).
  Add skip analyzer test and update baselines.
  ...
2020-09-23 11:32:57 -07:00
Tim Wojtulewicz
a9d5d083a2 Update NEWS 2020-09-23 11:31:42 -07:00
Tim Wojtulewicz
c21504deed Fix build on FreeBSD, which was missing full definition of sockaddr for ARP 2020-09-23 11:14:01 -07:00
Tim Wojtulewicz
bfe31f1c58 Update hashes for external testing repos 2020-09-23 11:13:59 -07:00
Jan Grashoefer
1658b8dc84 Fix handling of session analysis.
This reverts commit 0e51be18ac59d7a176f18780f1f8df85561449b9.
2020-09-23 11:13:29 -07:00