Commit graph

4620 commits

Author SHA1 Message Date
Benjamin Bannier
552c65a881 Merge remote-tracking branch 'origin/topic/bbannier/issue-3421' 2023-10-30 11:47:43 +01:00
Benjamin Bannier
49d7e638df Normalize version strings in test
Closes #3421.
2023-10-30 10:42:12 +01:00
Tim Wojtulewicz
fd84b793c6 Update external testing baseline hashes 2023-10-27 11:26:09 -07:00
Tim Wojtulewicz
091c849abe Merge remote-tracking branch 'security/topic/awelzel/200-pop-fuzzer-timeout'
* security/topic/awelzel/200-pop-fuzzer-timeout:
  ssl: Prevent unbounded ssl_history growth
  ssl: Cap number of alerts parsed from SSL record
2023-10-27 11:04:03 -07:00
Tim Wojtulewicz
d9534f687a Merge remote-tracking branch 'security/topic/awelzel/196-ftp-timeout-smaller-fix'
* security/topic/awelzel/196-ftp-timeout-smaller-fix:
  Update baselines
  ftp: Do not base seq on number of pending commands
2023-10-27 11:03:54 -07:00
Benjamin Bannier
2b44cea141 Require truncate for a test using it
It looks like older versions of macOS like Monterey do not ship with
`truncate`. Make a recently added test require it to suppress spurious
failures.
2023-10-26 16:23:37 +02:00
Benjamin Bannier
05e4d1cfde Bump outdated baseline
This fixes an outdated baseline added with
caaffd0324.
2023-10-26 15:59:04 +02:00
Benjamin Bannier
caaffd0324 Fix tests so they work both with GNU and BSD tools
The GNU and BSD versions of `touch` and `truncate` allow slightly
different arguments, change the tests so they work in both versions.
2023-10-26 15:33:14 +02:00
Arne Welzel
f0c2a7812a Merge remote-tracking branch 'origin/topic/awelzel/subdir-build-dir'
* origin/topic/awelzel/subdir-build-dir:
  subdir-btest: Allow setting build_dir
2023-10-25 17:01:48 +02:00
Arne Welzel
92565d4739 Supervisor: Handle EAGAIN error on stem pipe
util::safe_write() calls abort() in case of EAGAIN errors. This is
easily observed when starting clusters with 32 workers or more.

Add a custom write_message() function handling EAGAIN by retrying
after a small sleep. It's not clear a more complicated poll() would be
much better: The pipe might be ready for writing, but then our message
might not actually fit in, resulting in another EAGAIN error. And even
poll() would introduce blocking/sleeping code.

Take some precautions against the stem and the supervisor dead-locking
when both pipes are full by draining the other end on EAGAIN errors.

Closes #3043
2023-10-25 12:53:37 +02:00
Arne Welzel
560f8a4a84 ssl: Prevent unbounded ssl_history growth
The ssl_history field may grow unbounded (e.g., ssl_alert event). Prevent this
by capping using a configurable limit (default 100) and raise a weird once reached.
2023-10-25 09:35:45 +02:00
Arne Welzel
8f9d4a296b subdir-btest: Allow setting build_dir
We have that functionality in btest.cfg and it's actually nice to use
it for toggling between a debug/asan and release build.
2023-10-25 09:17:11 +02:00
Arne Welzel
a9b65cc6d9 Update baselines 2023-10-24 19:10:11 +02:00
Arne Welzel
ce4cbac1ef ftp: Do not base seq on number of pending commands
Previously, seq was computed as the result of |pending_commands|+1. This
opened the possibility to override queued commands, as well as logging
the same pending ftp reply multiple times.

For example, when commands 1, 2, 3 are pending, command 1 may be dequeued,
but the incoming command then receives seq 3 and overrides the already
pending command 3. The second scenario happens when ftp_reply() selected
command 3 as pending for logging, but is then followed by many ftp_request()
events. This resulted in command 3's response being logged for every
following ftp_request() over and over again.

Avoid both scenarios by tracking the command sequence as an absolute counter.
2023-10-24 19:10:07 +02:00
Arne Welzel
631b30f5bb btest/Files/mmdb: golang-ci suggested fixes
Thanks Benjamin for the hint.
2023-10-24 15:08:58 +02:00
Arne Welzel
54a08a74da base/frameworks/spicy: Do not load base/misc/version
Unsure what it's used for today and also results in the situation that on
some platforms we generate a reporter.log in bare mode, while on others
where spicy is disabled, we do not.

If we want base/frameworks/version loaded by default, should put it into
init-bare.zeek and possibly remove the loading of the reporter framework
from it - Reporter::error() would still work and be visible on stderr,
just not create a reporter.log.
2023-10-24 13:15:21 +02:00
Arne Welzel
baf30288ca btest/core/mmdb: Basic lookup_autonomous_system / lookup_location tests 2023-10-24 13:15:18 +02:00
Arne Welzel
05922132b3 btest/files: Add mmdb testing databases and generator code 2023-10-24 11:11:02 +02:00
Arne Welzel
ebb8780d6a quic: Skip new test if have-quic is false 2023-10-20 20:57:19 +02:00
Arne Welzel
6604010a05 quic: Bump maximum history length, make configurable
From zeek/spicy-quic#15
2023-10-20 20:42:30 +02:00
Arne Welzel
ee827a0a63 Merge remote-tracking branch 'origin/topic/robin/gh-3383'
* origin/topic/robin/gh-3383:
  Fix missing version number in `spicyz`.
2023-10-19 16:26:05 +02:00
Arne Welzel
fb31ad0c6e ldap: Add spicy-events.zeek 2023-10-19 10:48:34 +02:00
Arne Welzel
2389f6f6c5 quic: Add spicy-events.zeek 2023-10-19 10:48:24 +02:00
Arne Welzel
536686f02d gre-over-udp: Update testing pcap with both endpoints
The first pcap only contained packets from the originator, not the responder.

What stands out here is that the Linux kernel doesn't seem to use a symmetric
flow hash for the tunneled connection, resulting in a total of four tunnel
connections for the two inner connections. Sigh.
2023-10-17 12:30:14 +02:00
Tim Wojtulewicz
6d9d4523bc Add registration for GRE-over-UDP 2023-10-16 11:42:24 -07:00
Tim Wojtulewicz
738c39379f Start of 6.2.0 development 2023-10-13 10:58:29 -07:00
Arne Welzel
007bcefd09 Merge remote-tracking branch 'origin/topic/awelzel/2326-import-quic'
* origin/topic/awelzel/2326-import-quic:
  ci/btest: Remove spicy-quic helper, disable Spicy on CentOS 7
  btest/core/ppp: Run test in bare mode
  btest/quic: Update other tests
  testing/quic: Fixups and simplification after Zeek integration
  quic: Integrate as default analyzer
  quic: Include Copyright lines to the analyzer's source code contributed by Fox-IT
  quic: Squashed follow-ups: quic.log, tests, various fixes, performance
  quic: Initial implementation
2023-10-11 18:05:14 +02:00
Arne Welzel
1774a25f00 ci/btest: Remove spicy-quic helper, disable Spicy on CentOS 7
The have-quic pattern wasn't great and it wouldn't scale.
2023-10-11 17:17:23 +02:00
Arne Welzel
01bf1d4764 Merge remote-tracking branch 'origin/topic/awelzel/update-zeekygen-docs-show-stderr'
* origin/topic/awelzel/update-zeekygen-docs-show-stderr:
  ci/update-zeekygen-docs.sh: Do output stderr by default
  zeekygen: Disable zeek_init() handlers causing error output
  zeekygen/example: Squelch unused function warning
2023-10-11 15:21:31 +02:00
Arne Welzel
94a8cf2a09 Merge remote-tracking branch 'origin/topic/awelzel/pcap-reading-configurable-buffer'
* origin/topic/awelzel/pcap-reading-configurable-buffer:
  iosource/pcap: Support configurable buffer size
  util/setvbuf: Respect buf argument
2023-10-11 15:20:17 +02:00
Arne Welzel
e51d7815f2 btest/core/ppp: Run test in bare mode 2023-10-11 15:13:23 +02:00
Arne Welzel
f814be4484 btest/quic: Update other tests 2023-10-11 15:13:18 +02:00
Arne Welzel
6fd68bc607 zeekygen/example: Squelch unused function warning 2023-10-11 14:28:33 +02:00
Arne Welzel
3f99aa7996 testing/quic: Fixups and simplification after Zeek integration 2023-10-11 14:10:22 +02:00
Arne Welzel
359f8d2ae6 quic: Squashed follow-ups: quic.log, tests, various fixes, performance 2023-10-11 14:10:22 +02:00
Joost
44d7c45723 quic: Initial implementation 2023-10-11 14:10:22 +02:00
Arne Welzel
ffc35d90ba Merge remote-tracking branch 'origin/topic/awelzel/ldap-follow-up'
* origin/topic/awelzel/ldap-follow-up:
  protocol/ldap: Add doc-id/doc-description to .evt file
  spicy/manager: Ensure Zeekygen knows identifier for registered types
2023-10-11 14:09:32 +02:00
Arne Welzel
101c6696b9 spicy/manager: Ensure Zeekygen knows identifier for registered types
Without this, Zeekygen won't generate documentation about exported
enum types as it can not resolve the identifier. Also, only register a
type as item with the Spicy plugin if there's no _module_info currently
active.
2023-10-11 13:31:20 +02:00
Arne Welzel
72df1a0216 Merge remote-tracking branch 'origin/topic/bbannier/issue-3234'
* origin/topic/bbannier/issue-3234:
  Introduce dedicated `LDAP::Info`
  Remove redundant storing of protocol in LDAP logs
  Use LDAP `RemovalHook` instead of implementing `connection_state_remove`
  Tidy up LDAP code by using local references
  Pluralize container names in LDAP types
  Move LDAP script constants to their own file
  Name `LDAP::Message` and `LDAP::Search` `*Info`
  Make ports for LDAP analyzers fully configurable
  Require have-spicy for tests which log spicy-ldap information
  Fix LDAP analyzer setup for when Spicy analyzers are disabled
  Bump zeek-testing-private
  Integrate spicy-ldap test suite
  Move spicy-ldap into Zeek protocol analyzer tree
  Explicitly use all of spicy-ldap's modules
  Explicitly list `asn1.spicy` as spicy-ldap source
  Remove uses of `zeek` module in spicy-ldap
  Fix typos in spicy-ldap
  Remove project configuration files in spicy-ldap
  Integrate spicy-ldap into build
  Import zeek/spicy-ldap@57b5eff988
2023-10-10 20:07:03 +02:00
Benjamin Bannier
346d2c49a9 Introduce dedicated LDAP::Info 2023-10-10 18:49:25 +02:00
Benjamin Bannier
301d8722bf Remove redundant storing of protocol in LDAP logs 2023-10-10 18:49:25 +02:00
Benjamin Bannier
3a60a60619 Pluralize container names in LDAP types 2023-10-10 18:49:25 +02:00
Benjamin Bannier
0c126f3c6b Move LDAP script constants to their own file 2023-10-10 18:28:13 +02:00
Benjamin Bannier
c43bc52e18 Name LDAP::Message and LDAP::Search *Info 2023-10-10 18:28:13 +02:00
Benjamin Bannier
9b02b93889 Make ports for LDAP analyzers fully configurable
This moves the ports the LDAP analyzers should be triggered on from the
EVT file to the Zeek module. This gives users full control over which
ports the analyzers are registered for while previously they could only
register them for additional ports (there is no Zeek script equivalent
of `Manager::UnregisterAnalyzerForPort`).

The analyzers could still be triggered via DPD, but this is intentional.
To fully disable analyzers users can use e.g.,

```zeek
event zeek_init()
    {
    Analyzer::disable_analyzer(Analyzer::ANALYZER_LDAP_TCP);
    }
```
2023-10-10 18:28:13 +02:00
Arne Welzel
7fac5837c3 iosource/pcap: Support configurable buffer size
On Linux with a default ext4 or tmpfs filesystem, the default buffer size for
reading a pcap is chosen as 4k (strace/gdb validated). When reading large pcaps
containing raw data transfers, the syscall overhead for read becomes visible
in profiles. Support configurability of the buffer size and default to 128kb.

When processing a ~830M PCAP (16 UDP connections, each transferring ~50MB) in
bare mode, this change improves runtime from 1.39 sec to 1.29 sec. Increasing
the buffer further didn't provide a noticeable boost.
2023-10-10 15:08:51 +02:00
Benjamin Bannier
c0daacfbd1 Require have-spicy for tests which log spicy-ldap information 2023-10-10 09:21:57 +02:00
Benjamin Bannier
53d4052d68 Fix LDAP analyzer setup for when Spicy analyzers are disabled 2023-10-10 09:21:57 +02:00
Benjamin Bannier
20ae1129ea Bump zeek-testing-private 2023-10-10 09:21:57 +02:00
Benjamin Bannier
d7db52dff6 Integrate spicy-ldap test suite 2023-10-10 09:21:57 +02:00