Commit graph

3268 commits

Author SHA1 Message Date
Tim Wojtulewicz
b8287a3375 Fix issue with sumstats script and fix baselines that were crashing previously 2020-08-09 21:13:12 -07:00
Tim Wojtulewicz
7496cf14c7 Extend the timeouts on a few intel tests, update baselines 2020-08-09 21:13:12 -07:00
Tim Wojtulewicz
21872aef39 Updating test baselines for new dictionary code due to changes in ordering of fields in the dictionary 2020-08-09 21:13:10 -07:00
Justin Azoff
211789bbb3 Accept bracketed ipv6 addresses 2020-08-05 17:18:36 -04:00
Jon Siwek
363b167bd2 GH-1100: Fix reported body-length of HTTP messages w/ sub-entities
The body-lengths of sub-entities, like multipart messages, got counted
twice by mistake: once upon the end of the sub-entity and then again
upon the end of the top-level entity that contains all sub-entities.
The size of just the top-level entity is the correct one to use.
2020-08-04 14:21:03 -07:00
Johanna Amann
8e99d4b170 Merge remote-tracking branch 'origin/topic/jsiwek/gh-1080-error-on-enum-redefinition-conflict'
* origin/topic/jsiwek/gh-1080-error-on-enum-redefinition-conflict:
  Fix incorrect conflict detection of namespaced-enum-names
  Improve error message for an enum name conflicting with non-enum ID
  GH-1080: Treat enum name re-use across different enum types as an error
  GH-1080: Rename conflicting NetControl::DROP enum definitions

Fixes GH-1080
2020-08-04 20:25:40 +00:00
Seth Hall
7f4914c219 Fix config reader regular expression for MUSL.
It was not dealing with multiple spaces between the key and the value
with MUSL correctly. This change ensures that if a value exists, that it
begins and ends with a non-blank character.
2020-08-04 12:35:20 -04:00
Johanna Amann
22b401f52f Merge remote-tracking branch 'origin/topic/johanna/1095-just-get-rid-of-it'
* origin/topic/johanna/1095-just-get-rid-of-it:
  Re-add TYPE_COUNTER without function and deprecation marker.
  Completely remove all traces of the COUNTER type.
2020-08-03 10:44:43 -07:00
Jon Siwek
26ad26c101 Fix incorrect conflict detection of namespaced-enum-names
E.g. defining a `Foo::RED` enum name when a `GLOBAL::RED` identifier
already exists would previously be treated as an error, even though the
names don't truly conflict.
2020-07-31 16:44:49 -07:00
Jon Siwek
69c0cf1513 Improve error message for an enum name conflicting with non-enum ID 2020-07-31 16:24:26 -07:00
Jon Siwek
4a9567e04f GH-1080: Treat enum name re-use across different enum types as an error 2020-07-31 16:23:40 -07:00
Jon Siwek
613b27eec7 GH-1080: Rename conflicting NetControl::DROP enum definitions
``NetControl::DROP`` had 3 conflicting definitions that could potentially
be used incorrectly without any warnings or type-checking errors.
Such enum redefinition conflicts are now caught and treated as errors,
so the ``NetControl::DROP`` enums had to be renamed:

* The use as enum of type ``Log::ID`` is renamed to ``NetControl::DROP_LOG``

* The use as enum of type ``NetControl::CatchReleaseInfo`` is renamed to
  ``NetControl::DROP_REQUESTED``

* The use as enum of type ``NetControl::RuleType`` is unchanged and still
  named ``NetControl::DROP``
2020-07-31 16:11:35 -07:00
Johanna Amann
cd3400f957 Re-add TYPE_COUNTER without function and deprecation marker. 2020-07-31 14:53:49 -07:00
Tim Wojtulewicz
45b5a98420 Move EventMgr, EventHandler, and EventRegistry code to zeek namespace. Rename mgr to event_mgr. 2020-07-31 16:23:32 -04:00
Johanna Amann
417a6eb1e9 Completely remove all traces of the COUNTER type.
Relates to GH-1095
2020-07-30 12:11:05 -07:00
Johanna Amann
aa3d94a3cd Merge remote-tracking branch 'origin/topic/jsiwek/gh-1083-fix-input-set-events'
* origin/topic/jsiwek/gh-1083-fix-input-set-events:
  GH-1083: Fix Input Framework 'change' events for 'set' destinations

Fixes GH-1083
2020-07-28 19:59:48 +00:00
Jon Siwek
8a5490405d Update site/local.zeek compatibility test 2020-07-27 12:05:10 -07:00
Jon Siwek
823d4e6220 Merge remote-tracking branch 'origin/topic/vladg/gh-1084'
* origin/topic/vladg/gh-1084:
  Add btest for GH-1084
  Update baselines
  MySQL: Fix parsing logic bug. We were correctly NOT expecting an EOF, but because we were parsing the header and then not parsing the rest, we would get out of sync
2020-07-24 11:41:16 -07:00
Tim Wojtulewicz
3eab3e600e Merge remote-tracking branch 'ronwellman/parse_ecs'
* ronwellman/parse_ecs:
  Avoid typecast to int& in EDNS parsing.
  Validate option_len in EDNS packets.
  Adjust for zeek namespace.
  Implement EDNS Client Subnet Option
2020-07-24 09:26:06 -07:00
Vlad Grigorescu
f3c656ef17 Add btest for GH-1084 2020-07-24 09:28:11 -05:00
Jon Siwek
c765fd20fd GH-1083: Fix Input Framework 'change' events for 'set' destinations 2020-07-23 23:29:09 -07:00
Tim Wojtulewicz
ebc073ba92 Merge remote-tracking branch 'origin/topic/jsiwek/gh-1076-fix-random'
* origin/topic/jsiwek/gh-1076-fix-random:
  Deprecate bro_srandom(), replace with zeek::seed_random().
  Add zeek::max_random() & fix misuse of RAND_MAX w/ zeek::random_number()
  Deprecate bro_random(), replace with zeek::random_number()
  Deprecate bro_prng(), replace with zeek::prng()
  GH-1076: Fix bro_srandom() to replace 0 seeds with 1
  GH-1076: Fix bro_prng() implementation
  GH-1076: Fix use of getrandom()
2020-07-23 13:02:46 -07:00
Vlad Grigorescu
58800a4e93 Merge remote-tracking branch 'origin/master' into topic/vladg/gh-1084 2020-07-23 12:00:17 -05:00
Vlad Grigorescu
e9768ccb18 Update baselines 2020-07-23 11:59:30 -05:00
Tim Wojtulewicz
ac57377a94 Merge remote-tracking branch 'origin/topic/jsiwek/gh-1068-zeek-include-dir'
* origin/topic/jsiwek/gh-1068-zeek-include-dir:
  GH-1068: Add zeek symlink to allow "zeek/Foo.h" include style
2020-07-23 08:32:20 -07:00
Jon Siwek
d486af06b1 Add zeek::max_random() & fix misuse of RAND_MAX w/ zeek::random_number()
In deterministic mode, RAND_MAX is not related to the result of
zeek::random_number() (formerly bro_random()), but some logic was
using RAND_MAX as indication of the possible range of values.  The
new zeek::max_random() will give the correct upper-bound regardless
of whether deterministic-mode is used.
2020-07-22 14:01:33 -07:00
Jon Siwek
bde38893ce Deprecate bro_random(), replace with zeek::random_number()
Avoiding the use of zeek::random() due to potential for confusion
with random().
2020-07-22 14:01:33 -07:00
Jon Siwek
887b53b7f3 GH-1076: Fix bro_srandom() to replace 0 seeds with 1
The bro_prng() implementation cannot generate 0 as a result since it
causes every subsequent number from the PRNG to also be 0, so use the
number 1 instead of 0.
2020-07-22 14:01:33 -07:00
Jon Siwek
0f4eb9af02 GH-1076: Fix bro_prng() implementation
The intermediate result of the PRNG used unsigned storage, preventing
the ( result < 0 ) branch from ever being evaluated.  This could cause
return values to exceed the modulus as well as RAND_MAX.

One interesting effect of this is potential for the rand() BIF to
return values outside the requested maximum limit.

Another interesting effect of this is that a PacketFilter may start
randomly dropping packets even if it was not configured for
random-packet-drops.
2020-07-22 14:01:33 -07:00
Jon Siwek
dba764386b GH-1076: Fix use of getrandom()
The availability and use of getrandom() actually caused unrandom and
deterministic results in terms of Zeek's random number generation.
2020-07-22 14:01:33 -07:00
Robin Sommer
c3f4971eb2 Merge remote-tracking branch 'origin/topic/johanna/table-changes'
* origin/topic/johanna/table-changes: (26 commits)
  TableSync: try to make test more robust & add debug output
  Increase timeouts to see if FreeBSD will be happy with this.
  Try to make FreeBSD test happy with larger timeout.
  TableSync: refactor common functionality into function
  TableSync: don't raise &on_change, smaller fixes
  TableSync: rename auto_store -> table_store
  SyncTables: address feedback part 1 - naming (broker and zeek)
  BrokerStore <-> Zeek Tables: cleanup and bug workaround
  Zeek Table<->Brokerstore: cleanup, documentation, small fixes
  BrokerStore<->Zeek table: adopt to recent Zeek API changes
  BrokerStore<->Zeek Tables Fix a few small test failures.
  BrokerStore<->Zeek tables: allow setting storage location & tests
  BrokerStore<->Zeek tables: &backend works for in-memory stores.
  BrokerStore<->Zeek table - introdude &backend attribute
  BrokerStore<->Zeek tables: test for clones synchronizing to a master
  BrokerStore<->Zeek tables: load persistent tables on startup.
  Brokerstore<->Tables: attribute conflicts
  Zeek/Brokerstore updates: expiration
  Zeek/Brokerstore updates: add test that includes updates from clones
  Zeek/Brokerstore updates: first working end-to-end test
  ...
2020-07-21 15:39:39 +00:00
Jon Siwek
9642feeaf2 GH-1068: Add zeek symlink to allow "zeek/Foo.h" include style
Also changes `zeek-config --include_dir` to now output
`$prefix/include:$prefix/include/zeek` instead of only
`$prefix/include/zeek`
2020-07-20 17:54:09 -07:00
Johanna Amann
a505ed4bfe TableSync: try to make test more robust & add debug output 2020-07-17 18:59:52 -07:00
Johanna Amann
095491711e Increase timeouts to see if FreeBSD will be happy with this. 2020-07-17 17:14:44 -07:00
Johanna Amann
66f586c02c Update Mozilla CA & Google CT lists 2020-07-17 23:26:37 +00:00
Johanna Amann
42b566935e Try to make FreeBSD test happy with larger timeout. 2020-07-17 16:26:02 -07:00
Johanna Amann
5982b1e4b2 TableSync: refactor common functionality into function
This addresses feedback and puts the common update and insert
functionality into its own function.
2020-07-17 15:27:01 -07:00
Johanna Amann
36db9d8369 TableSync: don't raise &on_change, smaller fixes
This addresses PR feedback. The main component in this commit is to
disable &on_change notifications when &backend loads a table from sqlite
on startup.
2020-07-17 14:21:27 -07:00
Johanna Amann
930a5c8ebd TableSync: rename auto_store -> table_store 2020-07-17 11:40:59 -07:00
Johanna Amann
6d2aa84952 SyncTables: address feedback part 1 - naming (broker and zeek)
This commit fixes capitalization issues.
2020-07-17 10:56:28 -07:00
Robin Sommer
651831ad31 Merge remote-tracking branch 'origin/topic/jsiwek/gh-734-fix-lambda-escaping'
* origin/topic/jsiwek/gh-734-fix-lambda-escaping:
  GH-734: Improve handling of lambdas that escape enclosing frame
2020-07-17 10:19:18 +00:00
Jon Siwek
85fbdaf429 GH-837: Add test cases for mismatched Broker SSL configs 2020-07-16 18:32:06 -07:00
Jon Siwek
eb826bd337 GH-734: Improve handling of lambdas that escape enclosing frame 2020-07-14 22:38:43 -07:00
Jon Siwek
7f2aae1721 GH-1062: fix integer conversion errors related to Tag subtypes 2020-07-14 15:55:28 -07:00
Johanna Amann
1888d6acae BrokerStore <-> Zeek Tables: cleanup and bug workaround 2020-07-13 17:23:35 -07:00
Johanna Amann
7c37226eaa Merge remote-tracking branch 'origin/master' into topic/johanna/table-changes 2020-07-13 17:11:55 -07:00
Johanna Amann
da2c968ba0 Merge remote-tracking branch 'origin/topic/jsiwek/gh-1024-broker-store-handle-type-checks'
* origin/topic/jsiwek/gh-1024-broker-store-handle-type-checks:
  Improve Broker store API's handling of invalid arguments
  Add builtin_exception() functions
  GH-1024: fix crash on passing wrong types to Broker store API

This was a bit of a bigger merge since Zeek changed inbetween the time
of the PR and me actually merging it.

I put the new functions into the zeek::detail namespace -- since it
seems unlikely that those will be used by something external.

I also renamed them to fit better with the naming scheme of the new
error functions.

Fixes GH-1024
2020-07-14 00:05:09 +00:00
Johanna Amann
2b2a40f49c Zeek Table<->Brokerstore: cleanup, documentation, small fixes
This commit adds script/c++ documentation and fixes a few loose ends.
It also adds tests for corner cases and massively improves error
messages.

This also actually introduces type-compatibility checking and introduces
a new attribute that lets a user override this if they really know what
they are doing. I am not quite sure if we should really let that stay in
- but it can be very convenient to have this functionality.

One test is continuing to fail - the expiry test is very flaky. This is,
I think, caused by delays of the broker store forwarding. I am unsure if
we can actually do anything about that.
2020-07-10 16:58:34 -07:00
Jon Siwek
6908d1b919 GH-1019: deprecate icmp_conn params for ICMP events
Previously, a single `icmp_conn` record was built per ICMP "connection"
and re-used for all events generated from it.  This may have been a
historical attempt at performance optimization, but:

  * By default, Zeek does not load any scripts that handle ICMP events.

  * The one script Zeek ships with that does handle ICMP events,
    "detect-traceroute", is already noted as being disabled due to
    potential performance problems of doing that kind of analysis.

  * Re-use of the original `icmp_conn` record tends to misreport
    TTL and length values since they come from original packet instead
    of the current one.

  * Even if we chose to still re-use `icmp_conn` records and just fill
    in a new TTL and length value each packet, a user script could have
    stored a reference to the record and not be expecting those values
    to be changed out from underneath them.

Now, a new `icmp_info` record is created/populated in all ICMP events
and should be used instead of `icmp_conn`.  It also removes the
orig_h/resp_h fields as those are redundant with what's already
available in the connection record.
2020-07-10 11:06:28 -07:00
Jon Siwek
20294d372c Fix wrong frame offsets for locals of alternate event/hook prototypes
Local frame offsets were being assigned based on number of the alternate
prototype's parameters, which may end up having less total parameters
than the canonical prototype, causing the local value to incorrectly
overwrite an event/hook argument value.
2020-07-10 10:59:12 -07:00