Compare commits

...

2946 commits

Author SHA1 Message Date
Arne Welzel
4de7a2b947 Merge remote-tracking branch 'origin/topic/awelzel/4845-get-current-packet-header-fragmented-syn'
Some checks are pending
pre-commit / pre-commit (push) Waiting to run
* origin/topic/awelzel/4845-get-current-packet-header-fragmented-syn:
  iosource/Packet: Allow ToRawPktHdrVal() for reassembled packets
2025-10-02 14:12:22 +02:00
Arne Welzel
ca58c5e6b4 iosource/Packet: Allow ToRawPktHdrVal() for reassembled packets
Closes #4845
2025-10-02 14:10:09 +02:00
Arne Welzel
4e9b40f290 Merge remote-tracking branch 'origin/topic/awelzel/conn-class-layout-packing'
* origin/topic/awelzel/conn-class-layout-packing:
  Conn: Improve packing, drop bitfields and boolenize
  Conn: Lazily initialize weird_state when needed
2025-10-02 09:15:33 +02:00
Arne Welzel
d1051df887 Conn: Improve packing, drop bitfields and boolenize
There's a few holes in Conn, particularly now that TransportProto has
become a uint8_t. Pack things a bit more neatly.
2025-10-02 09:13:03 +02:00
Arne Welzel
d5045e08e3 Conn: Lazily initialize weird_state when needed
A std::unordered_map takes 56 bytes on my system. Switch to a unique_ptr
an initialize weird_state lazily. That saves ~48 bytes per connection.
Particularly for scan or non-weird traffic, this should allow some
memory savings.
2025-10-02 09:13:03 +02:00
Tim Wojtulewicz
8b4707a284 Merge remote-tracking branch 'origin/topic/vern/id-redecl'
Some checks failed
pre-commit / pre-commit (push) Has been cancelled
* origin/topic/vern/id-redecl:
  fixes for re-declaring type identifiers in inconsistent ways - addresses GH-2686
2025-09-30 20:46:38 +00:00
Tim Wojtulewicz
99fa163db2 Merge remote-tracking branch 'origin/topic/vern/standalone-BiF-access'
* origin/topic/vern/standalone-BiF-access:
  Fix for standalone initializations that require BiFs, and streamlining of standalone BiF-tracking
2025-09-30 20:45:28 +00:00
Tim Wojtulewicz
63291eca75 Merge remote-tracking branch 'origin/topic/vern/opt-skip-file-fix'
* origin/topic/vern/opt-skip-file-fix:
  fixed bug in logic for including/excluding files for script optimization
2025-09-30 20:12:24 +00:00
Tim Wojtulewicz
85b4cec76e Merge remote-tracking branch 'origin/topic/timw/remove-checks-for-very-old-openssl-versions'
* origin/topic/timw/remove-checks-for-very-old-openssl-versions:
  Remove checks for OpenSSL 1.x versions
  Remove some additional LibreSSL checks
2025-09-30 19:12:16 +00:00
Vern Paxson
6471a7bf7b Fix for standalone initializations that require BiFs, and streamlining of standalone BiF-tracking 2025-09-30 11:11:50 -07:00
Vern Paxson
fada719620 fixed bug in logic for including/excluding files for script optimization 2025-09-30 10:40:01 -07:00
Tim Wojtulewicz
a27cc89335 Remove checks for OpenSSL 1.x versions 2025-09-29 10:23:28 -07:00
Tim Wojtulewicz
686f100f0d Remove some additional LibreSSL checks 2025-09-29 10:23:28 -07:00
Arne Welzel
6af1459f5e Merge remote-tracking branch 'origin/topic/awelzel/4849-supervisor-signal-handle-tsan'
Some checks are pending
pre-commit / pre-commit (push) Waiting to run
* origin/topic/awelzel/4849-supervisor-signal-handle-tsan:
  Supervisor: Make last_signal atomic to squelch data race
2025-09-29 18:04:49 +02:00
Tim Wojtulewicz
3c16ee9667 Update docs submodule [nomail] 2025-09-29 08:21:10 -07:00
Arne Welzel
31d7df915e Supervisor: Make last_signal atomic to squelch data race
When the stem process terminates and SIGCHLD is sent to the supervisor,
the signal might be handled by the main thread or any other threads that
aren't blocking SIGCHLD explicitly. Convert last_signal to a std::atomic<int>
such that non-main threads can safely set last_signal without triggering
data race as reported by TSAN. This doesn't make it less racy to work
last_signal, but it appears we only use it for debug printing anyhow and
another option might have been to just remove last_signal altogether.

Follow-up for #4849
2025-09-29 14:50:20 +02:00
Arne Welzel
3abc1116a1 Merge remote-tracking branch 'origin/topic/awelzel/zeromq-fix-block-subscribe-before-init'
Some checks are pending
pre-commit / pre-commit (push) Waiting to run
* origin/topic/awelzel/zeromq-fix-block-subscribe-before-init:
  cluster/zeromq: Fix Cluster::subscribe() block if not initialized
2025-09-29 13:08:32 +02:00
Vern Paxson
941ecee692 fixes for re-declaring type identifiers in inconsistent ways - addresses GH-2686 2025-09-27 22:23:57 -07:00
Tim Wojtulewicz
0700427bac Merge remote-tracking branch 'origin/topic/vern/standalone-fixes2'
Some checks failed
pre-commit / pre-commit (push) Has been cancelled
* origin/topic/vern/standalone-fixes2:
  Fixes for -O gen-standalone-C++ for tracking BiFs, lambdas, attribute types, and independent globals
2025-09-26 14:19:49 -07:00
Tim Wojtulewicz
483d9a3a93 Merge remote-tracking branch 'klemensn/openbsd-libressl'
Some checks are pending
pre-commit / pre-commit (push) Waiting to run
* klemensn/openbsd-libressl:
  OpaqueVal, OCSP, X509: drop outdated LibreSSL guards to fix OpenBSD build
2025-09-26 11:21:17 -07:00
Tim Wojtulewicz
83f05dde34 Merge remote-tracking branch 'origin/topic/timw/merge-3rdparty-repo-into-main'
Some checks are pending
pre-commit / pre-commit (push) Waiting to run
* origin/topic/timw/merge-3rdparty-repo-into-main: (30 commits)
  Ignore src/3rdparty for pre-commit
  src/3rdparty: Port doctest fix for including <ciso646> from upstream
  src/3rdparty: Update doctest to v2.4.12
  src/3rdparty: Move jthread/stop_token out of std namespace to prevent collisions
  src/3rdparty: Fix clang-tidy bugprone-casting-through-void warning
  src/3rdparty: Add jthread and stop_token headers
  src/3rdparty: Update SQLite to 3.47.1
  src/3rdparty: Upgrade sqlite3 to 3.45.0
  src/3rdparty: modp: Disable deprecation warning for sprintf
  src/3rdparty: Update SQLite to 3.41.2
  src/3rdparty: Handle zeek-inet-ntop snprintf() return value correctly
  src/3rdparty: Rework inet-ntop change to build on Windows
  src/3rdparty: Use snprintf in zeek_inet_ntop.c to silence macOS compiler warnings
  src/3rdparty: Use snprintf in patricia.cc to silence macOS compiler warnings
  src/3rdparty: Update ConvertUTF Unicode license as per request from LLVM upstream
  src/3rdparty: Update doctest to 2.4.9 and sqlite to 3.39.4
  src/3rdparty: Fix rampant off-by-one error in last change
  src/3rdparty: numeric conversion functions now return the number of characters added
  src/3rdparty: Fix GCC 12.2 warning in access to patricia_t members
  src/3rdparty: Rebase patricia.{h,c} on upstream version
  ...
2025-09-26 02:57:42 +00:00
Tim Wojtulewicz
7627022f92 Ignore src/3rdparty for pre-commit 2025-09-25 18:39:07 -07:00
Tim Wojtulewicz
663fc2931c src/3rdparty: Port doctest fix for including <ciso646> from upstream
This has been failing on our weekly builds for a bit. It's fixed upstream
but there's no idea when they'll release a new version that includes it.

This cherry-picks 5eb20178ba
2025-09-25 18:39:07 -07:00
Tim Wojtulewicz
08b018cc61 src/3rdparty: Update doctest to v2.4.12 2025-09-25 18:39:07 -07:00
Tim Wojtulewicz
21fc299131 src/3rdparty: Move jthread/stop_token out of std namespace to prevent collisions 2025-09-25 18:39:07 -07:00
Tim Wojtulewicz
3046be57da src/3rdparty: Fix clang-tidy bugprone-casting-through-void warning 2025-09-25 18:39:07 -07:00
Tim Wojtulewicz
b2746226d5 src/3rdparty: Add jthread and stop_token headers 2025-09-25 18:39:07 -07:00
Christian Kreibich
d6d0fe0ff0 src/3rdparty: Update SQLite to 3.47.1 2025-09-25 18:39:03 -07:00
Tim Wojtulewicz
1cb75ffff3 src/3rdparty: Upgrade sqlite3 to 3.45.0 2025-09-25 18:39:03 -07:00
Tim Wojtulewicz
6a060588c2 src/3rdparty: modp: Disable deprecation warning for sprintf 2025-09-25 18:39:03 -07:00
Johanna Amann
dfd32b3b37 src/3rdparty: Update SQLite to 3.41.2 2025-09-25 18:39:03 -07:00
Tim Wojtulewicz
ee0c73f8f6 src/3rdparty: Handle zeek-inet-ntop snprintf() return value correctly 2025-09-25 18:39:03 -07:00
Tim Wojtulewicz
6936364b3c src/3rdparty: Rework inet-ntop change to build on Windows 2025-09-25 18:39:03 -07:00
Tim Wojtulewicz
b8248d07e9 src/3rdparty: Use snprintf in zeek_inet_ntop.c to silence macOS compiler warnings 2025-09-25 18:39:03 -07:00
Tim Wojtulewicz
a2abb40af6 src/3rdparty: Use snprintf in patricia.cc to silence macOS compiler warnings 2025-09-25 18:39:03 -07:00
Christian Kreibich
2d9eb155d5 src/3rdparty: Update ConvertUTF Unicode license as per request from LLVM upstream
This replicates the following commit in our copy of ConvertUTF:
20451cb06b
2025-09-25 18:39:03 -07:00
Tim Wojtulewicz
942450c293 src/3rdparty: Update doctest to 2.4.9 and sqlite to 3.39.4 2025-09-25 18:39:03 -07:00
Vern Paxson
ce75863344 src/3rdparty: Fix rampant off-by-one error in last change 2025-09-25 18:39:03 -07:00
Vern Paxson
790e920d66 src/3rdparty: numeric conversion functions now return the number of characters added 2025-09-25 18:39:03 -07:00
Christian Kreibich
3e4512bc80 src/3rdparty: Fix GCC 12.2 warning in access to patricia_t members
Access to members of the larger prefix_t, while safe, throws warnings
when the compiler knows it previously allocated the smaller prefix4_t.

Adapted from 11ae12079ca716f8cfac42cccfd905dad45da18f in the upstream repo.
2025-09-25 18:39:03 -07:00
Tim Wojtulewicz
01c31e9917 src/3rdparty: Rebase patricia.{h,c} on upstream version
This updates to a clang-formatted version that was merged recently.
2025-09-25 18:39:03 -07:00
Tim Wojtulewicz
c4d015369b src/3rdparty: Deprecate bro_inet_ntop.{c,h} 2025-09-25 18:39:03 -07:00
Johanna Amann
fa88e30796 src/3rdparty: Update SQLite to 3.38.4 2025-09-25 18:39:03 -07:00
Tim Wojtulewicz
ea7e91857a src/3rdparty: Update doctest to v2.4.8 2025-09-25 18:39:03 -07:00
Tim Wojtulewicz
c1598a33c4 src/3rdparty: Add missing externs in bsd-getopt-long.h 2025-09-25 18:39:03 -07:00
Benjamin Bannier
982d3b56a1 src/3rdparty: Add 3rdparty files from Zeek's src/ 2025-09-25 18:39:03 -07:00
Robin Sommer
f0cfaaaa78 src/3rdparty: Update doctest to 2.4.6.
Our old version didn't support compilation on Apple's M1 yet.
2025-09-25 18:39:03 -07:00
Johanna Amann
2dbd912088 src/3rdparty: Update SQLite to 3.36.0 2025-09-25 18:38:55 -07:00
Dominik Charousset
eb3aeb75ab src/3rdparty: Add doctest header 2025-09-25 18:38:24 -07:00
Bernhard Amann
3c65c3ecb0 src/3rdparty: Update sqlite to 3.28.0 2025-09-25 18:38:24 -07:00
Tim Wojtulewicz
086416706d Remove zeek-3rdparty submodule 2025-09-25 18:37:24 -07:00
Arne Welzel
01666df3d7 cluster/zeromq: Fix Cluster::subscribe() block if not initialized
If Cluster::init() hasn't been invoked yet, Cluster::subscribe() with the
ZeroMQ backend would block because the main_inproc socket didn't
yet have a connection from the child thread. Prevent this by connecting
the main and child socket pair at construction time.

This will queue the subscriptions and start processing them once the
child thread has started.
2025-09-25 18:58:35 +02:00
Arne Welzel
d2cda5a68c Merge remote-tracking branch 'origin/topic/awelzel/zeromq-handle-eintr'
Some checks are pending
pre-commit / pre-commit (push) Waiting to run
* origin/topic/awelzel/zeromq-handle-eintr:
  cluster/zeromq: Improve EINTR handling
2025-09-25 13:53:04 +02:00
Arne Welzel
a318463c1c cluster/zeromq: Improve EINTR handling
When using ZeroMQ also within the Supervisor process, zmq::poll() and
recv() were observed to return EINTR, handle these.
2025-09-25 13:52:12 +02:00
Vern Paxson
550c7eb0a7 Fixes for -O gen-standalone-C++ for tracking BiFs, lambdas, attribute types, and independent globals 2025-09-24 17:34:35 -07:00
Tim Wojtulewicz
69b7bcc323 Merge remote-tracking branch 'origin/topic/vern/no-opt'
Some checks failed
pre-commit / pre-commit (push) Has been cancelled
* origin/topic/vern/no-opt:
  BTests & baselines for testing selective skipping of script optimization
  added &no_ZAM_opt/&no_CPP_opt attributes and --no-opt-files/--no-opt-funcs for controlling skipping script optimization
2025-09-23 09:06:02 -07:00
Vern Paxson
dc7f4dca1c BTests & baselines for testing selective skipping of script optimization 2025-09-23 09:05:40 -07:00
Vern Paxson
441baaf2c1 added &no_ZAM_opt/&no_CPP_opt attributes and --no-opt-files/--no-opt-funcs for controlling skipping script optimization 2025-09-23 09:05:40 -07:00
Arne Welzel
2bde66c9d6 Merge remote-tracking branch 'origin/topic/awelzel/4842-decompose-uri-ipv6'
* origin/topic/awelzel/4842-decompose-uri-ipv6:
  utils/decompose_uri: Support URIs containing IPv6 addresses
2025-09-23 13:08:14 +02:00
Arne Welzel
b3b0c3db7d utils/decompose_uri: Support URIs containing IPv6 addresses
An URI containing a bracketed or non-bracketed IPv6 address of the form
http://[::1]:42 was previously split on the first colon for port extraction,
causing a subsequent to_count() call to fail. Harden this to check for a
digits in the last :[0-9]+ component.

Fixes #4842
2025-09-23 13:04:29 +02:00
Klemens Nanni
54634ae241
OpaqueVal, OCSP, X509: drop outdated LibreSSL guards to fix OpenBSD
build

Whatever is used with recent OpenSSL is also available with latest LibreSSL
on OpenBSD 7.8-beta as of today.

Some of these hunks have been in the net/bro port for years, others I
recently added whilst gradually updating from 6.0.5 to 8.0.1.
2025-09-23 01:51:49 +03:00
Tim Wojtulewicz
416d997263 Merge remote-tracking branch 'origin/topic/timw/restore-settype-methods'
Some checks are pending
pre-commit / pre-commit (push) Waiting to run
* origin/topic/timw/restore-settype-methods:
  Restore the SetType constructor and destructor
2025-09-22 07:46:06 -07:00
Tim Wojtulewicz
c741e8f489 Merge remote-tracking branch 'origin/topic/timw/update-libkqueue'
* origin/topic/timw/update-libkqueue:
  Bump libkqueue to latest upstream master
2025-09-22 07:34:03 -07:00
Tim Wojtulewicz
5f8a89ea40 Bump libkqueue to latest upstream master 2025-09-22 07:33:13 -07:00
Tim Wojtulewicz
210737f36e Restore the SetType constructor and destructor 2025-09-21 17:13:14 +00:00
zeek-bot
d6c7a479e2 Update doc submodule [nomail] [skip ci] 2025-09-20 00:13:40 +00:00
Tim Wojtulewicz
9fb0f5e76d Fix clang-tidy finding in recent script_opt changes 2025-09-17 16:34:26 -07:00
Tim Wojtulewicz
ef9ffda2ef Merge remote-tracking branch 'origin/topic/vern/standalone-event-groups'
* origin/topic/vern/standalone-event-groups:
  tracking of event groups for compilation to standalone-C++
2025-09-17 14:28:44 -07:00
Vern Paxson
973cc00c42 tracking of event groups for compilation to standalone-C++ 2025-09-17 14:28:13 -07:00
Tim Wojtulewicz
1567fe8c09 Merge remote-tracking branch 'origin/topic/vern/remove-SetType'
* origin/topic/vern/remove-SetType:
  Deprecate SetType, as it can be replaced by TableType
2025-09-17 14:26:42 -07:00
Vern Paxson
b442c25389 Deprecate SetType, as it can be replaced by TableType 2025-09-17 14:09:58 -07:00
Tim Wojtulewicz
938073dfed Merge remote-tracking branch 'origin/topic/timw/4742-skip-storage-thread'
* origin/topic/timw/4742-skip-storage-thread:
  Avoid starting up storage expiration thread with zero backends
  Remove a couple of obsolete TODOs in storage manager
2025-09-17 08:44:55 -07:00
Tim Wojtulewicz
067c257480 Merge remote-tracking branch 'origin/topic/timw/windows-zeromq-support'
* origin/topic/timw/windows-zeromq-support:
  Reword comment about when ZeroMQ is required for the build
  CI: Add label for enabling the Windows build in PRs
  Enable building ZeroMQ support on Windows
2025-09-16 13:31:48 -07:00
Tim Wojtulewicz
723b64d81f Reword comment about when ZeroMQ is required for the build 2025-09-16 13:30:14 -07:00
Tim Wojtulewicz
37cc4999b3 CI: Add label for enabling the Windows build in PRs 2025-09-16 13:30:14 -07:00
Tim Wojtulewicz
4705537002 Enable building ZeroMQ support on Windows 2025-09-16 13:30:14 -07:00
Tim Wojtulewicz
5cc5f2a275 Merge remote-tracking branch 'origin/topic/timw/4285-sqlite-threadsafe-check'
* origin/topic/timw/4285-sqlite-threadsafe-check:
  Force SQLite to be in thread-safe mode during CMake
2025-09-16 12:42:04 -07:00
Tim Wojtulewicz
dd14e380a1 Force SQLite to be in thread-safe mode during CMake
This allows us to remove the need to check for thread-safe mode in the
various SQLite plugins. See https://www.sqlite.org/compile.html#threadsafe
for why `1` is a good choice here.
2025-09-16 12:19:09 -07:00
Tim Wojtulewicz
bd60c6fc15 Merge remote-tracking branch 'origin/topic/vern/gen-C++-global-characteristics'
* origin/topic/vern/gen-C++-global-characteristics:
  full tracking of the characteristics of globals when compiling scripts to C++
2025-09-16 11:31:13 -07:00
Tim Wojtulewicz
71eca7c9e6 Merge remote-tracking branch 'origin/topic/vern/standalone-CPP-global-attrs'
* origin/topic/vern/standalone-CPP-global-attrs:
  fix for associating attributes with globals for -O gen-standalone-C++
2025-09-16 11:02:44 -07:00
Tim Wojtulewicz
aebeae8f8a Merge remote-tracking branch 'origin/topic/vern/standalone-id-tracking-fix'
* origin/topic/vern/standalone-id-tracking-fix:
  fix for tracking identifiers and aggregates when compiling to standalone-C++
2025-09-16 10:53:11 -07:00
Tim Wojtulewicz
00ba3483bb Merge remote-tracking branch 'origin/topic/vern/gen-CPP-precedence-fix'
* origin/topic/vern/gen-CPP-precedence-fix:
  fix for '?' operator precedence when compiling scripts to C++
2025-09-16 10:52:53 -07:00
Vern Paxson
0e5042e451 fix for associating attributes with globals for -O gen-standalone-C++ 2025-09-15 14:28:07 -07:00
Vern Paxson
bfc6508dff full tracking of the characteristics of globals when compiling scripts to C++ 2025-09-15 14:21:32 -07:00
Vern Paxson
6a9175da7d fix for '?' operator precedence when compiling scripts to C++ 2025-09-15 14:18:16 -07:00
Tim Wojtulewicz
50581bfd3c Avoid starting up storage expiration thread with zero backends 2025-09-15 14:18:03 -07:00
Tim Wojtulewicz
8bc849d425 Remove a couple of obsolete TODOs in storage manager 2025-09-15 14:17:41 -07:00
Vern Paxson
18d435ac12 fix for tracking identifiers and aggregates when compiling to standalone-C++ 2025-09-15 13:57:35 -07:00
Tim Wojtulewicz
b25a844210 Merge remote-tracking branch 'origin/topic/vern/standalone-skip-fatal'
* origin/topic/vern/standalone-skip-fatal:
  for -O gen-standalone-C++, make the presence of uncompilable functions fatal unless -O allow-cond is used
2025-09-12 09:24:58 -07:00
Tim Wojtulewicz
489681e0c3 Merge remote-tracking branch 'origin/topic/timw/bump-zeekctl'
* origin/topic/timw/bump-zeekctl:
  Bump zeekctl for new trace-summary/pysubnettree versions
2025-09-12 09:24:26 -07:00
Tim Wojtulewicz
3750fb11f4 Bump zeekctl for new trace-summary/pysubnettree versions 2025-09-12 09:23:55 -07:00
Vern Paxson
e5210160ea for -O gen-standalone-C++, make the presence of uncompilable functions fatal unless -O allow-cond is used 2025-09-11 13:30:40 -06:00
Tim Wojtulewicz
e1c8cbe25a Merge remote-tracking branch 'origin/topic/timw/dns-analyzer-type-consistency'
* origin/topic/timw/dns-analyzer-type-consistency:
  Clean up initialization of DNS_Interpreter
  Switch types used in DNS analyzer to be more consistent
2025-09-11 10:57:29 -07:00
Tim Wojtulewicz
f056df1301 Clean up initialization of DNS_Interpreter 2025-09-11 10:56:57 -07:00
Tim Wojtulewicz
501160c976 Switch types used in DNS analyzer to be more consistent 2025-09-11 10:56:57 -07:00
Tim Wojtulewicz
c6cf1ee3ae Merge remote-tracking branch 'origin/topic/awelzel/btest-suspend-processing-websocket'
* origin/topic/awelzel/btest-suspend-processing-websocket:
  btest/core/suspend_processing: Add WebSocket example
2025-09-08 11:19:45 -07:00
Arne Welzel
9e7537044f btest/core/suspend_processing: Add WebSocket example
Add a test/example forwarding all new_connection() events produced during
`zeek -r wikipedia.trace` as my_new_connection() to a WebSocket client.

This is mostly to demonstrate and verify usage of suspend_processing(),
websocket_client_added(), resume_processing(), Pcap::file_done(),
websocket_client_lost() and terminate() together.
2025-09-08 11:11:13 -07:00
Tim Wojtulewicz
dd881d9cde Merge remote-tracking branch 'origin/topic/etyp/bump-spicy-coverity'
* origin/topic/etyp/bump-spicy-coverity:
  Bump Spicy for Coverity fixes
2025-09-08 11:02:47 -07:00
Tim Wojtulewicz
76492302ad Merge remote-tracking branch 'origin/topic/timw/port-doctest-version-include-change-from-upstream'
* origin/topic/timw/port-doctest-version-include-change-from-upstream:
  Update src/3rdparty submodule for doctest v2.4.12 and include fix
2025-09-08 11:02:16 -07:00
Tim Wojtulewicz
168ff0b8a2 Update src/3rdparty submodule for doctest v2.4.12 and include fix 2025-09-08 10:52:06 -07:00
Evan Typanski
16a43f04bd Bump Spicy for Coverity fixes 2025-09-08 11:35:58 -04:00
Tim Wojtulewicz
37836d1bb4 Merge remote-tracking branch 'origin/topic/timw/ci-centos-stream-10'
* origin/topic/timw/ci-centos-stream-10:
  CI: Fix warning about ENV usage in CI dockerfiles
  CI: Add centos stream 10 build
2025-09-06 04:26:51 +00:00
Tim Wojtulewicz
7305a79440 CI: Fix warning about ENV usage in CI dockerfiles
This also bumps the dates on the DOCKERFILE_VERSION values
2025-09-06 04:26:03 +00:00
Tim Wojtulewicz
9bee00de9c CI: Add centos stream 10 build 2025-09-06 04:26:03 +00:00
Christian Kreibich
a58323c367 Merge branch 'topic/christian/fix-cluster-testing-get-instances-c2a'
* topic/christian/fix-cluster-testing-get-instances-c2a:
  Bump zeek-client to pull in more resilient controller I/O
2025-09-05 19:52:57 -07:00
Christian Kreibich
49ef0abd3b Bump zeek-client to pull in more resilient controller I/O 2025-09-05 16:26:57 -07:00
Tim Wojtulewicz
b7790641ba Merge remote-tracking branch 'origin/topic/bbannier/bump-spicy'
* origin/topic/bbannier/bump-spicy:
  Bump auxil/spicy to latest development snapshot
2025-09-05 12:56:33 -07:00
Benjamin Bannier
8fd8309b28 Bump auxil/spicy to latest development snapshot 2025-09-05 17:48:42 +02:00
Tim Wojtulewicz
35ad76c96b Merge remote-tracking branch 'origin/topic/timw/testing-upstream-libkqueue'
* origin/topic/timw/testing-upstream-libkqueue:
  libkqueue: Switch to using HEAD from upstream master
2025-09-04 16:22:04 -07:00
Tim Wojtulewicz
d1f34ae546 libkqueue: Switch to using HEAD from upstream master
The upstream recently merge Christian's fixes for the fd_map allocations
so that patch doesn't need to be in our fork anymore. I also tested removing
the patch about timers from our fork, and it seems to only matter for Linux
kernels earlier than 5.3. All of our supported platforms are newer than
that.
2025-09-04 16:20:18 -07:00
Tim Wojtulewicz
0dadf2af04 Merge remote-tracking branch 'origin/topic/bbannier/bump-spicy'
* origin/topic/bbannier/bump-spicy:
  Bump auxil/spicy to latest development snapshot
2025-09-04 09:04:39 -07:00
Benjamin Bannier
a48b4caabc Bump auxil/spicy to latest development snapshot 2025-09-04 17:01:46 +02:00
zeek-bot
dc7b331450 Update doc submodule [nomail] [skip ci] 2025-09-04 00:28:10 +00:00
Tim Wojtulewicz
4d338ccd7d Fix clang-tidy warning from recent SVCB merge 2025-09-03 16:50:07 -07:00
Tim Wojtulewicz
cff4edd732 NEWS: Add note about DNS SVCB changes 2025-09-03 15:38:47 -07:00
Tim Wojtulewicz
7142b9efde Merge remote-tracking branch 'klemensya/svcparams'
* klemensya/svcparams:
  Parse SVCB/HTTPS SvcParams list
2025-09-03 15:36:03 -07:00
Tim Wojtulewicz
26ea7cc655 Clang-tidy fixes for recent IDPtr changes 2025-09-03 15:34:29 -07:00
Tim Wojtulewicz
e3b22cd21f Merge remote-tracking branch 'origin/topic/vern/emphasize-IDPtrs'
* origin/topic/vern/emphasize-IDPtrs:
  fixup! fixup! shift much of the internal use of ID* identifier pointers over to IDPtr objects
  fixup! shift much of the internal use of ID* identifier pointers over to IDPtr objects
  fixup! shift much of the internal use of ID* identifier pointers over to IDPtr objects
  fixup! shift much of the internal use of ID* identifier pointers over to IDPtr objects
  annotate a number of BTests as unsuited for -O gen-C++ testing due to multiple Zeek runs
  BTest baseline updates for -O gen-C++ - all minor tweaks
  BTest updates for script optimization tracking of BiFs
  regression test for former ASAN issue with script optimization of lambdas
  shift much of the internal use of ID* identifier pointers over to IDPtr objects
  maintenance update for script optimization's knowledge of BiFs
  logger fix for interoperability with -O gen-C++ code
2025-09-03 15:33:43 -07:00
Evan Typanski
42f7a2d88c Merge remote-tracking branch 'origin/topic/vern/field-assign-parsing'
* origin/topic/vern/field-assign-parsing:
  tightened up parsing of $field=X record constructor expressions
2025-09-03 16:21:24 -04:00
Vern Paxson
3ff3eee398 fixup! fixup! shift much of the internal use of ID* identifier pointers over to IDPtr objects 2025-09-03 12:42:58 -07:00
Vern Paxson
a6f9d69c91 fixup! shift much of the internal use of ID* identifier pointers over to IDPtr objects 2025-09-03 11:20:29 -07:00
Vern Paxson
7397dc6568 fixup! shift much of the internal use of ID* identifier pointers over to IDPtr objects 2025-09-03 11:19:38 -07:00
Vern Paxson
34831aa7d3 fixup! shift much of the internal use of ID* identifier pointers over to IDPtr objects 2025-09-03 11:19:38 -07:00
Vern Paxson
b6b8484819 annotate a number of BTests as unsuited for -O gen-C++ testing due to multiple Zeek runs 2025-09-03 11:19:38 -07:00
Vern Paxson
77bb32ff78 BTest baseline updates for -O gen-C++ - all minor tweaks 2025-09-03 11:19:38 -07:00
Vern Paxson
1b4bc72802 BTest updates for script optimization tracking of BiFs 2025-09-03 11:19:38 -07:00
Vern Paxson
e9971e31d5 regression test for former ASAN issue with script optimization of lambdas 2025-09-03 11:19:38 -07:00
Vern Paxson
693aa244f9 shift much of the internal use of ID* identifier pointers over to IDPtr objects 2025-09-03 11:19:31 -07:00
Vern Paxson
1c7c1b62f6 maintenance update for script optimization's knowledge of BiFs 2025-09-03 11:14:22 -07:00
Vern Paxson
fb344a20ea logger fix for interoperability with -O gen-C++ code 2025-09-03 11:14:22 -07:00
Benjamin Bannier
07dd2a1c6f Merge branch 'topic/bbannier/test-bittorrent-unnessary-sigs' 2025-09-03 14:51:16 +02:00
Klemens Nanni
397f7e5c0e Parse SVCB/HTTPS SvcParams list
Add full support for RFC 9460's SvcParams list.

Amend the existing `dns_svcb_rr` record by a vector of new
`dns_svcb_param` records containing aptly typed SvcParamKey and
SvcParamValue pairs.  Example output:

```
@load base/protocols/dns
event dns_HTTPS( c: connection , msg: dns_msg , ans: dns_answer , https: dns_svcb_rr ) {
	for (_, param in https$svc_params)
		print to_json(param);  # filter uninitialised values
}
```

```
$ dig https cloudflare-ech.com +short | tr [:space:] \\n
1
.
alpn="h3,h2"
ipv4hint=104.18.10.118,104.18.11.118
ech=AEX+DQBBHgAgACBGL2e9TiFwjK/w1Zg9AmRm7mgXHz3PjffP0mTFNMxmDQAEAAEAAQASY2xvdWRmbGFyZS1lY2guY29tAAA=
ipv6hint=2606:4700::6812:a76,2606:4700::6812:b76
```

```
{"key":1,"alpn":["h3","h2"]}
{"key":4,"hint":["104.18.10.118","104.18.11.118"]}
{"key":5,"ech":"AEX+DQBBHgAgACBGL2e9TiFwjK/w1Zg9AmRm7mgXHz3PjffP0mTFNMxmDQAEAAEAAQASY2xvdWRmbGFyZS1lY2guY29tAAA="}
{"key":6,"hint":["2606:4700::6812:a76","2606:4700::6812:b76"]}
```

Values with malformed data or belonging to invalid/reserved keys
are passed raw bytes in network order for script-level inspection.

Follow up to "Initial Support to DNS SVCB/HTTPS RR"
https://github.com/zeek/zeek/pull/1808
2025-09-03 09:53:55 +03:00
Tim Wojtulewicz
5d93254400 Merge remote-tracking branch 'origin/topic/timw/remove-unneeded-binpac-includes'
* origin/topic/timw/remove-unneeded-binpac-includes:
  Remove some unnecessary #includes from binpac source files
2025-09-02 16:00:27 -07:00
Tim Wojtulewicz
adb28453a7 Remove some unnecessary #includes from binpac source files 2025-09-02 11:52:52 -07:00
Tim Wojtulewicz
deeca84332 Merge remote-tracking branch 'origin/topic/timw/readability-container-contains'
* origin/topic/timw/readability-container-contains:
  Fix a few more random clang-tidy findings
  Use std::numbers::pi instead of hard-coded value
  Use std::scoped_lock instead of std::lock_guard
  Use .contains() instead of .find() or .count()
2025-09-02 11:49:29 -07:00
Tim Wojtulewicz
3c7885abdf Fix a few more random clang-tidy findings 2025-09-02 16:51:34 +00:00
Tim Wojtulewicz
aa3940f16d Use std::numbers::pi instead of hard-coded value 2025-09-02 16:51:23 +00:00
Tim Wojtulewicz
66aefc6a54 Use std::scoped_lock instead of std::lock_guard 2025-09-02 16:42:52 +00:00
Tim Wojtulewicz
b592b6c998 Use .contains() instead of .find() or .count() 2025-09-02 16:42:52 +00:00
Benjamin Bannier
4c9cbeb43f Remove unnecessary peer signature from test scripts.base.protocols.bittorrent.tracker 2025-09-02 10:53:38 +02:00
Vern Paxson
36862a18d6 tightened up parsing of $field=X record constructor expressions 2025-08-31 15:14:26 -07:00
zeek-bot
d63e3f9706 Update doc submodule [nomail] [skip ci] 2025-08-31 00:17:01 +00:00
Christian Kreibich
f38ac30418 Merge branch 'topic/christian/management-framework-tls'
* topic/christian/management-framework-tls:
  Bump zeek-testing-cluster to pull in WebSocket TLS updates
  Bump zeek-client to pull in TLS config updates
  Management framework: add TLS options for controller's websocket server
2025-08-29 21:53:37 -07:00
Christian Kreibich
236d3a1ced Bump zeek-testing-cluster to pull in WebSocket TLS updates 2025-08-29 17:20:15 -07:00
Christian Kreibich
779f7064ad Bump zeek-client to pull in TLS config updates 2025-08-29 17:20:10 -07:00
Tim Wojtulewicz
d20550f553 Merge remote-tracking branch 'origin/topic/timw/switch-spicy-zeek-builds-to-ubuntu-24'
* origin/topic/timw/switch-spicy-zeek-builds-to-ubuntu-24:
  Move benchmarking to Ubnutu 24 task, add to normal PR builds
  Reorder ubuntu builds so 22.04 comes last
  Rename Ubuntu-based tasks to have the full version name
  Switch Zeek Spicy builds to Ubuntu 24
2025-08-29 15:08:38 -07:00
Arne Welzel
b014e8e56e Management framework: add TLS options for controller's websocket server 2025-08-29 12:44:07 -07:00
Tim Wojtulewicz
b156bcf6dd Move benchmarking to Ubnutu 24 task, add to normal PR builds
We already have a "regular Linux" build for PRs, but I'm adding this one
in so that we have benchmark coverage on PRs as well.
2025-08-29 10:39:49 -07:00
Tim Wojtulewicz
ea076dc14a Reorder ubuntu builds so 22.04 comes last 2025-08-28 15:37:16 -07:00
Tim Wojtulewicz
6e2ca35fb0 Rename Ubuntu-based tasks to have the full version name 2025-08-28 15:37:16 -07:00
Tim Wojtulewicz
692c6a2f10 Switch Zeek Spicy builds to Ubuntu 24 2025-08-28 15:37:16 -07:00
Tim Wojtulewicz
273abf3d08 Merge remote-tracking branch 'origin/topic/timw/tools-clang-tidy'
* origin/topic/timw/tools-clang-tidy:
  gen-zam: Move source files up a directory
  bifcl: Fix clang-tidy warnings
  bifcl: Run clang-format on c++ code embedded in builtin-func.{l,y}
  binpac: Fix a large number of clang-tidy warnings
  binpac: Replace delete_list macro uses
  binpac: Run clang-format on c++ code embedded in pac_parse.{ll,yy}
2025-08-28 15:20:32 -07:00
Tim Wojtulewicz
2acfa27c2a Merge remote-tracking branch 'origin/topic/timw/link-prometheus-via-broker-instead-of-directly'
* origin/topic/timw/link-prometheus-via-broker-instead-of-directly:
  Link Prometheus symbols via Broker instead of directly
2025-08-28 13:06:44 -07:00
Tim Wojtulewicz
cf8f3547f4 Link Prometheus symbols via Broker instead of directly 2025-08-28 13:05:40 -07:00
Tim Wojtulewicz
7499234d42 gen-zam: Move source files up a directory 2025-08-28 12:14:09 -07:00
Tim Wojtulewicz
d3ac12da68 bifcl: Fix clang-tidy warnings 2025-08-28 12:14:09 -07:00
Tim Wojtulewicz
22d82edc74 bifcl: Run clang-format on c++ code embedded in builtin-func.{l,y} 2025-08-28 12:14:09 -07:00
Tim Wojtulewicz
31b65f70da binpac: Fix a large number of clang-tidy warnings 2025-08-28 12:14:09 -07:00
Tim Wojtulewicz
4dc546f8c8 binpac: Replace delete_list macro uses 2025-08-28 12:14:09 -07:00
Tim Wojtulewicz
64b3265eb8 binpac: Run clang-format on c++ code embedded in pac_parse.{ll,yy} 2025-08-28 12:14:09 -07:00
zeek-bot
ea0ffd3ec1 Update doc submodule [nomail] [skip ci] 2025-08-28 00:16:01 +00:00
Arne Welzel
4f84192c3a Merge remote-tracking branch 'origin/topic/timw/ci-restore-ubuntu22-build'
* origin/topic/timw/ci-restore-ubuntu22-build:
  CI: Restore build steps for ubuntu22 task
2025-08-27 09:28:13 +02:00
Arne Welzel
702518e288 Merge remote-tracking branch 'origin/topic/timw/ruff-check-pre-commit-alias'
* origin/topic/timw/ruff-check-pre-commit-alias:
  Fix ruff check legacy alias for pre-commit
2025-08-27 09:27:41 +02:00
Tim Wojtulewicz
bb1001fb01 CI: Restore build steps for ubuntu22 task
This got accidentally deleted during the reorganization of the CI tasks
2025-08-26 17:30:36 -07:00
Tim Wojtulewicz
cfa73bd512 Merge remote-tracking branch 'origin/topic/timw/reduce-ci-load'
* origin/topic/timw/reduce-ci-load:
  CI: Rework layout of when each task runs
2025-08-26 14:40:05 -07:00
Tim Wojtulewicz
a0bdab5cf6 CI: Rework layout of when each task runs 2025-08-26 12:53:16 -07:00
Tim Wojtulewicz
39cd0332cd Fix ruff check legacy alias for pre-commit 2025-08-26 12:47:03 -07:00
Tim Wojtulewicz
d7db612b0f Merge remote-tracking branch 'origin/topic/bbannier/issue-3266'
* origin/topic/bbannier/issue-3266:
  Fix installation of symlink with `DESTDIR`
2025-08-26 08:59:34 -07:00
Tim Wojtulewicz
9e9c193f2a Update zeekctl submodule for docs fixes [nomail] [skip ci] 2025-08-26 08:59:11 -07:00
Tim Wojtulewicz
84c3619ef6 Merge remote-tracking branch 'origin/topic/awelzel/zeekctl-88-add-metrics-addr-and-document'
* origin/topic/awelzel/zeekctl-88-add-metrics-addr-and-document:
  Bump zeekctl
2025-08-25 12:29:44 -07:00
Arne Welzel
33f5825d38 Bump zeekctl 2025-08-25 15:14:27 +02:00
Arne Welzel
3e89e6b328 Merge remote-tracking branch 'origin/topic/awelzel/cluster-event-metadata-fixes-for-8.0'
* origin/topic/awelzel/cluster-event-metadata-fixes-for-8.0:
  cluster/Backend: Fallback to current network time when current event has not timestamp
  cluster/serializer/broker: Do not send empty metadata vectors around
2025-08-22 10:13:30 +02:00
Christian Kreibich
2929f1eb17 Merge branch 'topic/christian/news-typos'
* topic/christian/news-typos:
  Minor fixes to a few NEWS entries.
2025-08-21 17:10:17 -07:00
Christian Kreibich
ade7b0a9a2 Minor fixes to a few NEWS entries. 2025-08-21 15:16:41 -07:00
Arne Welzel
ce7ba36b3c Merge remote-tracking branch 'origin/topic/awelzel/bye-twitter'
* origin/topic/awelzel/bye-twitter:
  README.md: Add Mastodon and Bluesky links
  README: Drop "Follow us on Twitter"
2025-08-21 17:06:29 +02:00
Arne Welzel
ab960026d8 README.md: Add Mastodon and Bluesky links 2025-08-21 16:58:27 +02:00
Arne Welzel
836f4f4310 README: Drop "Follow us on Twitter" 2025-08-21 16:44:15 +02:00
Benjamin Bannier
15604811cb Fix installation of symlink with DESTDIR
We install test data which we also make available under an alternative
path for backwards compatibility. The installation of this symlink did
not take `DESTDIR` installs like used by Zeek's packaging into account
which caused installations from packages to behave different from
installs from source.

This patch fixes the symlink to respect a possible `DESTDIR`.

Closes #3266.
2025-08-21 10:56:28 +02:00
zeek-bot
3947b402a0 Update doc submodule [nomail] [skip ci] 2025-08-21 00:26:50 +00:00
Arne Welzel
9a7678f15a cluster/Backend: Fallback to current network time when current event has not timestamp
When a WebSocket client sends an event to Zeek without explicit network
timestamp metadata, Zeek would use -1.0 as a timestamp for any events
published while handling this event. Instead, it seems far more sensible
to use the current network time in that scenario.
2025-08-20 19:56:50 +02:00
Arne Welzel
01fe022e07 cluster/serializer/broker: Do not send empty metadata vectors around
Event when there's no metadata attached to an event, we'd still use the
constructor passing an empty metadata vector, resulting in an on-the-wire
representation with an empty trailing vector.

Particularly visible when just snooping events via websocat. There also
seems to be some bug with the timestamp -1 handling.
2025-08-20 19:55:38 +02:00
Tim Wojtulewicz
c9c5959d49 Merge remote-tracking branch 'origin/topic/timw/move-submodules-to-main-repo-take-2'
* origin/topic/timw/move-submodules-to-main-repo-take-2: (343 commits)
  Add NEWS entries for submodule moves
  Remove configure --with-gen-zam argument and the CMake summaries
  af_packet: Remove submodule, adapt CMake/code for Zeek build
  af_packet: pre-commit fixes
  af_packet: Fix initialization
  af_packet: Ensure all of the member fields get initialized
  af_packet: Require CMake 3.15 to match Zeek's requirement
  af_packet: Note that Zeek ships with a built-in version.
  af_packet: Use cstdint instead of stdint.h
  af_packet: Use override for overriding parent methods
  af_packet: Use 'pragma once' instead of include guards
  af_packet: AF_Packet: Fix wrong vlan when PCP or DEI bits are set in tp_vlan_tci
  af_packet: AF_Packet: Check interface for upness
  af_packet: AF_Packet: Use negative socket_fd for error indication
  af_packet: AF_Packet: Remove usages of inline
  af_packet: Add guarded zeek/zeek-version.h include.
  af_packet: RX_Ring: Add include for string
  af_packet: Increase version number.
  af_packet: Add info if TP_STATUS_CSUM_VALID is not defined.
  af_packet: Define TP_STATUS_CSUM_VALID when not defined
  ...
2025-08-20 08:53:55 -07:00
Tim Wojtulewicz
469bd8d562 Add NEWS entries for submodule moves 2025-08-20 08:52:26 -07:00
Tim Wojtulewicz
95ea468db1 Remove configure --with-gen-zam argument and the CMake summaries 2025-08-20 08:52:26 -07:00
Tim Wojtulewicz
6002f63a37 af_packet: Remove submodule, adapt CMake/code for Zeek build 2025-08-20 08:52:26 -07:00
Tim Wojtulewicz
62e27ee6f7 af_packet: pre-commit fixes 2025-08-20 08:52:26 -07:00
Tim Wojtulewicz
709f876947 af_packet: Fix initialization 2025-08-20 08:52:26 -07:00
Tim Wojtulewicz
f92bffcfd9 af_packet: Ensure all of the member fields get initialized 2025-08-20 08:52:26 -07:00
Tim Wojtulewicz
1f7c2f42bc af_packet: Require CMake 3.15 to match Zeek's requirement 2025-08-20 08:52:26 -07:00
Jan Grashoefer
a4cd5dd452 af_packet: Note that Zeek ships with a built-in version.
Closes #64.
2025-08-20 08:52:26 -07:00
Tim Wojtulewicz
c55fad5094 af_packet: Use cstdint instead of stdint.h 2025-08-20 08:52:26 -07:00
Tim Wojtulewicz
ba15e3e3b2 af_packet: Use override for overriding parent methods 2025-08-20 08:52:26 -07:00
Tim Wojtulewicz
69cae88bb0 af_packet: Use 'pragma once' instead of include guards 2025-08-20 08:52:26 -07:00
Arne Welzel
aefa52821c af_packet: AF_Packet: Fix wrong vlan when PCP or DEI bits are set in tp_vlan_tci
A user reported vlan ids > 4095 being logged by Zeek [1]. For populating
packet->vlan, mask away Priority Code Point (PCP) and Drop Eligible
Indicator (DEI) bits from the tp_vlan_tci field, else we're not setting
the correct value on the packet.

Fixes #60

[1] https://community.zeek.org/t/zeek-reporting-vlan-ids-above-4095-bug-found/7000
2025-08-20 08:52:26 -07:00
Arne Welzel
c3a13304cb af_packet: AF_Packet: Check interface for upness
When using af_packet with an interface that was not up, the following
non-informative error was reported:

    $ /opt/zeek-5.2/bin/zeek -i af_packet::replay
    fatal error: problem with interface af_packet::replay (Invalid argument)

With this change, the error now includes information about the
interface being down:

    $ ZEEK_PLUGIN_PATH=$(pwd)/build zeek -Ci af_packet::replay
    fatal error: problem with interface af_packet::replay (interface is down)

Fixes #51
2025-08-20 08:52:26 -07:00
Arne Welzel
df4beb6054 af_packet: AF_Packet: Use negative socket_fd for error indication
Technically, socket() can return 0, so shouldn't use it as an
indication of a non existent / closed socket.

I'm not 100% sure about the Close() contract here: If something
goes haywire with a packet source Zeek calls FatalError without
calling Close() nor properly destructing the PktSrc. Oh yikes.
2025-08-20 08:52:26 -07:00
Arne Welzel
17d60e4ab9 af_packet: AF_Packet: Remove usages of inline
...not sure why they are marked inline.
2025-08-20 08:52:26 -07:00
Arne Welzel
d9d7b76c5d af_packet: Add guarded zeek/zeek-version.h include.
With zeek/zeek#2802, zeek-config.h will not provide ZEEK_VERSION_NUMBER
when a plugin is compiled as a builtin/static plugin into Zeek. This is
done to avoid tree-wide ccache busting when just the version changes.
2025-08-20 08:52:26 -07:00
Arne Welzel
67d3b0697f af_packet: RX_Ring: Add include for string
When compiling with clang and libc++ like done when using Google's
hongfuzz in the oss-fuzz setup, the following errors are produced:

    Step #3 - "compile-honggfuzz-address-x86_64": /src/zeek/auxil/zeek-af_packet-plugin/src/RX_Ring.cc:19:9: error: no matching conversion for functional-style cast from 'const char[15]' to 'RX_RingException'
    Step #3 - "compile-honggfuzz-address-x86_64":                 throw RX_RingException("invalid socket");
    Step #3 - "compile-honggfuzz-address-x86_64":                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    Step #3 - "compile-honggfuzz-address-x86_64": /src/zeek/auxil/zeek-af_packet-plugin/src/RX_Ring.h:14:7: note: candidate constructor (the implicit copy constructor) not viable: no known conversion from 'const char[15]' to 'const RX_RingException' for 1st argument
    Step #3 - "compile-honggfuzz-address-x86_64": class RX_RingException : public std::runtime_error {
    Step #3 - "compile-honggfuzz-address-x86_64":       ^
    Step #3 - "compile-honggfuzz-address-x86_64": /src/zeek/auxil/zeek-af_packet-plugin/src/RX_Ring.h:14:7: note: candidate constructor (the implicit move constructor) not viable: no known conversion from 'const char[15]' to 'RX_RingException' for 1st argument
    Step #3 - "compile-honggfuzz-address-x86_64": /src/zeek/auxil/zeek-af_packet-plugin/src/RX_Ring.h:16:2: note: candidate constructor not viable: no known conversion from 'const char[15]' to 'const std::string' (aka 'const basic_string<char, char_traits<char>, allocator<char>>') for 1st argument
    Step #3 - "compile-honggfuzz-address-x86_64":         RX_RingException(const std::string& what_arg) : std::runtime_error(what_arg) {}
    Step #3 - "compile-honggfuzz-address-x86_64":

The problem can be reproduced outside of hongfuzz by compiling this
plugin with with clang/libc++:

    export CXX=clang++-14
    export CXXFLAGS=-stdlib=libc++
    ./configure
    make

Include <string> in RX_Ring.h to ensure the required const char * to
std::string conversion are available to any users of RX_RingException.
2025-08-20 08:52:26 -07:00
Jan Grashoefer
165d60236c af_packet: Increase version number. 2025-08-20 08:52:26 -07:00
Jan Grashoefer
61a3538106 af_packet: Add info if TP_STATUS_CSUM_VALID is not defined. 2025-08-20 08:52:26 -07:00
Arne Welzel
e0d7dba113 af_packet: Define TP_STATUS_CSUM_VALID when not defined
On some older Linux distributions (CentOS 7), the if_packet.h header does
not yet include TP_STATUS_CSUM_VALID (introduced in March 2015). Simply
define it if it's not there.
2025-08-20 08:52:26 -07:00
Jan Grashoefer
7d0841ae31 af_packet: Improve the README. 2025-08-20 08:52:26 -07:00
Arne Welzel
90d61cae72 af_packet: Make block_size and block_timeout configurable
This lowers the default timeout from 100msec to 10msec and increases the default
block_size from 16KB to 32KB. Both are aligned with what Suricata uses as defaults.

The block_size is likely too conservative for high-performance, tuning
guides recommend starting with 1MB block size.

Fixes #37.
2025-08-20 08:52:26 -07:00
Jan Grashoefer
8d2979e935 af_packet: Cleanup checksum offloading support. 2025-08-20 08:52:26 -07:00
Tim Wojtulewicz
cd297e13dd af_packet: Support checksum offloading (requires Zeek 5.1). 2025-08-20 08:52:26 -07:00
Arne Welzel
ffbb2823da af_packet: Remove compile_options() again
This seems to trickle through to base Zeek code when done like that.

https://cirrus-ci.com/task/4788073346105344?logs=build#L2298
2025-08-20 08:52:26 -07:00
Arne Welzel
6ad8e3ed24 af_packet: Add -Wunused and -Werror
This would've found the enable_defrag issue and also points out another
unused variable.
2025-08-20 08:52:26 -07:00
Arne Welzel
41331e5605 af_packet: Fix enable_defrag
Seems enable_defrag was never actually passed down to the relevant functions.
Remove the default parameters to ensure we properly pass it down.
2025-08-20 08:52:26 -07:00
Arne Welzel
62b28177ee af_packet: Remove linux/version.h include
Not sure why this is needed. On my system it defines LINUX_VERSION_CODE
and KERNEL_VERSION and neither is used within the plugin.
2025-08-20 08:52:26 -07:00
Arne Welzel
1dc6718621 af_packet: Remove FindKernelHeaders, not needed
There's been some wondering why kernel headers are required to compile
this plugin as it's not providing a kernel module or otherwise provides
functionality related to kernel APIs. AF_PACKET sockets are provided
through user-space APIs.

There may have been historical reasons, but let's move forward and
remove the dependency.

Fixes #29 #24
2025-08-20 08:52:26 -07:00
Jan Grashoefer
46f364c3dd af_packet: Increase version number. 2025-08-20 08:52:26 -07:00
Jan Grashoefer
630d1edff9 af_packet: Make link type configurable. 2025-08-20 08:52:26 -07:00
Jan Grashoefer
7be67782c2 af_packet: Increase version number. 2025-08-20 08:52:25 -07:00
Michael Dopheide
e2f40fc5b1 af_packet: Create README file which zeek's ConfigurePackaging.cmake requires 2025-08-20 08:52:25 -07:00
Jan Grashoefer
716916a97d af_packet: Increase version number. 2025-08-20 08:52:25 -07:00
Jan Grashoefer
448e69471c af_packet: Convert README formatting to Markdown. 2025-08-20 08:52:25 -07:00
Jan Grashoefer
1fe008945e af_packet: Hacked VLAN support. 2025-08-20 08:52:25 -07:00
Jan Grashoefer
b38894a329 af_packet: Increase version number. 2025-08-20 08:52:25 -07:00
Christian Kreibich
96384be689 af_packet: Avoid Zeek script double-loading problems
The plugin mechanism automatically picks up the scripts folder for
plugin-related Zeek scripts. When a package's zkg.meta also declares the scripts
folder the location for package-level scripts, the scripts get installed
redundantly in two places. Zeek cannot recognize them as duplicates, triggering
various errors relating to double-defined symbols.

This moves the package-level scripts to a subdirectory with a placeholder. The
placeholder avoids the zkg install-time warning, whose original fix in e3aea1
introduced this problem.
2025-08-20 08:52:25 -07:00
Jan Grashoefer
74f9d11776 af_packet: Fix Zeek version dependency. 2025-08-20 08:52:25 -07:00
Jan Grashoefer
e945e2c8bb af_packet: Increase version number. 2025-08-20 08:52:25 -07:00
Jan Grashoefer
45b3dbf267 af_packet: Slightly reorder README. 2025-08-20 08:52:25 -07:00
Johanna Amann
e4aa85d2a6 af_packet: Add FANOUT_CBPF and FANOUT_EBPF 2025-08-20 08:52:25 -07:00
Michael Dopheide
79842b25c1 af_packet: Namespace changes adding zeek:: as well as zeek/ prefix for include files. 2025-08-20 08:52:25 -07:00
Vlad Grigorescu
e3c5865684 af_packet: GetFanoutMode: Fix case statement (missing breaks).
Without this, you can't actually set the fanout mode to anything but HASH.
2025-08-20 08:52:25 -07:00
Jan Grashoefer
62356c38dd af_packet: Fixed test baseline to include defrag option. 2025-08-20 08:52:25 -07:00
Jan Grashoefer
130f7f7272 af_packet: Increase version number. 2025-08-20 08:52:25 -07:00
Jan Grashoefer
4deb8f6402 af_packet: Add support for defragmentation of IP packets. 2025-08-20 08:52:25 -07:00
Jan Grashoefer
57dd239917 af_packet: Increase version number. 2025-08-20 08:52:25 -07:00
Jan Grashoefer
8aa35fed6f af_packet: Add upgrade note to README. 2025-08-20 08:52:25 -07:00
Tim Wojtulewicz
8d0bc4a804 af_packet: Add some missing includes due to changes in Zeek 3.1 2025-08-20 08:52:25 -07:00
Tim Wojtulewicz
a7195a7a75 af_packet: File naming and build system changes to support deprecation changes in Zeek 3.0 2025-08-20 08:52:25 -07:00
Jan Grashoefer
1f1627ad73 af_packet: Increased version number. 2025-08-20 08:52:25 -07:00
Jan Grashoefer
5e3ae6227b af_packet: Updated README. 2025-08-20 08:52:25 -07:00
Jan Grashoefer
eb3dc4b563 af_packet: Include info files for distribution. 2025-08-20 08:52:25 -07:00
Jan Grashoefer
9cc01769b4 af_packet: Minor improvements to fix compiler warnings. 2025-08-20 08:52:25 -07:00
Jan Grashoefer
b6e52b262c af_packet: Increased version number. 2025-08-20 08:52:25 -07:00
Jan Grashoefer
4eaa201821 af_packet: Updated README regarding --with-latest-kernel. 2025-08-20 08:52:25 -07:00
Jan Grashoefer
3adaef434b af_packet: Added buffer_size option to broctl plugin.
The buffer size can now be set in node.cfg using the
af_packet_buffer_size key.
2025-08-20 08:52:25 -07:00
Jan Grashoefer
a89379c353 af_packet: Added bro-pkg instructions to the README. 2025-08-20 08:52:25 -07:00
Jan Grashoefer
1a107bd838 af_packet: Increased version number. 2025-08-20 08:52:25 -07:00
Jan Grashoefer
1dfb115e35 af_packet: Fixed broctl example. 2025-08-20 08:52:25 -07:00
Jan Grashoefer
478265b4f2 af_packet: Fixed compatibility for kernel versions < 3.14. 2025-08-20 08:52:25 -07:00
Jan Grashoefer
742b0820bc af_packet: Imported version 1.1 of the plugin. 2025-08-20 08:52:25 -07:00
Tim Wojtulewicz
32522307d9 gen-zam: Fix clang-tidy and pre-commit warnings 2025-08-20 08:52:25 -07:00
Tim Wojtulewicz
a2f4f2adc3 gen-zam: Remove submodule, adapt CMake configuration for Zeek build 2025-08-20 08:52:25 -07:00
Tim Wojtulewicz
526238299d gen-zam: Fix a pile of Coverity findings 2025-08-20 08:52:25 -07:00
Tim Wojtulewicz
3845fced55 gen-zam: Require C++20 for builds 2025-08-20 08:52:25 -07:00
Tim Wojtulewicz
f6f84184ed gen-zam: Add clang-format pre-commit hook 2025-08-20 08:52:25 -07:00
Tim Wojtulewicz
d5cc0d5135 gen-zam: Add cmake-format pre-commit hook 2025-08-20 08:52:25 -07:00
Tim Wojtulewicz
027c075fb0 gen-zam: Use const references instead of copying type values 2025-08-20 08:52:25 -07:00
Tim Wojtulewicz
97492b4d70 gen-zam: Reserve space for args vector before pushing back items 2025-08-20 08:52:25 -07:00
Tim Wojtulewicz
75bba1a8f5 gen-zam: Fix clang-tidy bugprone-macro-parentheses/cppcoreguidelines-macro-usage warnings in headers 2025-08-20 08:52:25 -07:00
Tim Wojtulewicz
0acd4bf04e gen-zam: Fix clang-tidy bugprone-branch-clone warnings in headers 2025-08-20 08:52:25 -07:00
Vern Paxson
53591cf205 gen-zam: generate descriptions of macros, akin to those already generated for operations 2025-08-20 08:52:25 -07:00
Tim Wojtulewicz
12bb2a04eb gen-zam: Require CMake 3.15, in line with other Zeek projects 2025-08-20 08:52:25 -07:00
Vern Paxson
a20e268f13 gen-zam: more robust dispatch that allows for eval/eval-mixed overlap 2025-08-20 08:52:25 -07:00
Vern Paxson
736eb99054 gen-zam: extensive changes corresponding to those described in GH-3872 2025-08-20 08:52:25 -07:00
Vern Paxson
4ae4548ceb gen-zam: gen-zam extended to read from multiple files on the command-line 2025-08-20 08:52:25 -07:00
Vern Paxson
aee70af743 gen-zam: fix for generating relational operations with first operand being a constant 2025-08-20 08:52:25 -07:00
Vern Paxson
f9385ef88d gen-zam: hooks for supporting ZAM profiling 2025-08-20 08:52:25 -07:00
Vern Paxson
4e07a9681d gen-zam: fixes for generating ZAM operations relating to indirect calls 2025-08-20 08:52:25 -07:00
Vern Paxson
6f8c54d69a gen-zam: support for ZAM instructions using IntrusivePtr for call expression ASTs 2025-08-20 08:52:25 -07:00
Vern Paxson
6f648e36d1 gen-zam: fix to make generated function calls compatible with "when" lambdas 2025-08-20 08:52:25 -07:00
Tim Wojtulewicz
b04c03ee89 gen-zam: Fix some warnings from newer compilers about unqualified std::move calls 2025-08-20 08:52:25 -07:00
Vern Paxson
1e73b02977 gen-zam: better error reporting when ZAM code does a function call 2025-08-20 08:52:25 -07:00
Tomer Lev
3b3f6bbe4d gen-zam: Fix a bug caused by different behaviour of std::regex_replace under MSVC.
Under MSVC regex objects are multiline by default and there is no apparant way of changing this behaviour. Under clang/gcc regex is singleline unless std::regeX_constants::multiline is specificied.
This behaviour is assumed in Gen-ZAM.cc when auto-generating header files.

Example: https://godbolt.org/z/aP59x3EhT
2025-08-20 08:52:25 -07:00
Tim Wojtulewicz
6ad6fd165b gen-zam: clang-tidy: Avoid copying string objects if possible 2025-08-20 08:52:25 -07:00
Tim Wojtulewicz
27d674edc0 gen-zam: clang-tidy: Avoid bugprone narrowing conversions 2025-08-20 08:52:25 -07:00
Tim Wojtulewicz
bacd56258c gen-zam: Fix a couple of coverity issues
1491335: AUTO_CAUSES_COPY due to a for loop using auto& instead of const auto&
1491338: AUTO_CAUSES_COPY due to a for loop using auto& instead of const auto&
2025-08-20 08:52:25 -07:00
Vern Paxson
789b06b1ea gen-zam: fix memory management for vector-of-strings operations 2025-08-20 08:52:25 -07:00
Tim Wojtulewicz
f330505e83 gen-zam: Deprecate bro_int_t and bro_uint_t 2025-08-20 08:52:25 -07:00
Johanna Amann
902577b7ce gen-zam: Fix compile error on GCC-12/Ubuntu 22.04 2025-08-20 08:52:25 -07:00
Christian Kreibich
4a7cf8c26e gen-zam: Remove unnecessary include from CMakeLists.txt 2025-08-20 08:52:25 -07:00
Christian Kreibich
b51430c04e gen-zam: Trivial source tweaks to make it build 2025-08-20 08:52:25 -07:00
Christian Kreibich
5ea34f20b8 gen-zam: Establish the usual environment for cmake-driven builds 2025-08-20 08:52:25 -07:00
Christian Kreibich
c1f240295f gen-zam: Move Gen-ZAM sources to src subdirectory 2025-08-20 08:52:25 -07:00
Tim Wojtulewicz
c618bb7a56 bifcl: Remove submodule, adapt CMake configuration for Zeek build 2025-08-20 08:52:25 -07:00
Tim Wojtulewicz
f6d9696bf1 bifcl: Require C++20 for builds 2025-08-20 08:52:25 -07:00
Tim Wojtulewicz
d8d8772342 bifcl: Add NOLINT for clang-tidy performance-enum-size to generated headers 2025-08-20 08:52:25 -07:00
Tim Wojtulewicz
c63a220579 bifcl: Add missing include of cinttypes 2025-08-20 08:52:25 -07:00
Tim Wojtulewicz
867d91b535 bifcl: Some other minor cleanup 2025-08-20 08:52:25 -07:00
Tim Wojtulewicz
23a5e46b8e bifcl: Minor cleanup of include files 2025-08-20 08:52:25 -07:00
Tim Wojtulewicz
7026938082 bifcl: Pass boolean false to BuiltinFunc constructor instead of zero
This fixes a modernize-use-bool-literals clang-tidy warning in the
generated code.
2025-08-20 08:52:25 -07:00
Tim Wojtulewicz
c30aa7a903 bifcl: Don't do 'using namespace std' in headers, plus a little cleanup 2025-08-20 08:52:25 -07:00
Tim Wojtulewicz
75a8814cee bifcl: Switch more namespacing in generated code to nested style 2025-08-20 08:52:25 -07:00
Tim Wojtulewicz
234726dac7 bifcl: Reformat CMakeLists via pre-commit 2025-08-20 08:52:25 -07:00
Tim Wojtulewicz
2f97833acd bifcl: Switch namespacing in generated code to C++-17-style nested namespaces 2025-08-20 08:52:25 -07:00
Tim Wojtulewicz
d2edc334ad bifcl: Add #pragma once to generated headers 2025-08-20 08:52:25 -07:00
Tim Wojtulewicz
dac04be859 bifcl: Make BIFs just return ValPtr directly instead of BifReturnVal 2025-08-20 08:52:25 -07:00
Tim Wojtulewicz
f2cd4ae3e6 bifcl: Reformat Bifcl in Spicy style 2025-08-20 08:52:25 -07:00
Tim Wojtulewicz
8e5b722145 bifcl: Remove usage of FindRequiredPackage 2025-08-20 08:52:25 -07:00
Tim Wojtulewicz
af0c68c183 bifcl: Add /J flag on Windows to force unsigned char 2025-08-20 08:52:25 -07:00
Tim Wojtulewicz
3004675015 bifcl: Force -std=c++17 mode for cmake targets, remove use of RequireCXX17.cmake 2025-08-20 08:52:25 -07:00
Tim Wojtulewicz
af2a1b67bc bifcl: Require CMake 3.15.0 to build, similar to the recent changes to zeek and broker 2025-08-20 08:52:25 -07:00
Tim Wojtulewicz
7275016bcb bifcl: Remove vendored CMake files from repo 2025-08-20 08:52:25 -07:00
Arne Welzel
e7cce57f2b bifcl: Render runtime type checks for var_args bifs
Currently, Zeek disables any static type checking for var_arg bifs.
However, the generated preamble for var_args bifs assume that
typed positional arguments are correctly typed and blindly calls
the type converters on them. This easily triggers abort()s at runtime
currently when a script mistakenly uses the wrong types for var_arg
bifs. For example, calling publish_rr() with a port instead of a string
causes a hard-abort with Zeek 5.0.8.

    $ zeek -e 'Cluster::publish_rr(Cluster::Pool(), 80/tcp)'
    fatal error in <no location>: Val::CONVERTER (port/string) (80/tcp)
    Aborted (core dumped)

Extend bifcl so that for var_arg functions and the types that bifcl understands,
we render a runtime type check and explicit early return to avoid the abort().
For any/other types, the implementer of the bif continuous to be responsible
for type checking.

This isn't solving the var_args situation generally, but avoids some
ad-hoc fixes trickling in current bif implementations.

Some references:

https://github.com/zeek/zeek/issues/1523
https://github.com/zeek/zeek/issues/2425
https://github.com/zeek/zeek/issues/2935
https://github.com/zeek/zeek/pull/2950
2025-08-20 08:52:25 -07:00
Arne Welzel
efb32d31fc bifcl: builtin-func.l: Allow more than just one additional component
I'm not sure why this was restricted to only two components,
the following appears functional in Zeek scripts.

    module A::B::C;

    export {
      type MyRecord: record {
        a: string;
      };
    }

Closes #25.
2025-08-20 08:52:25 -07:00
Tim Wojtulewicz
8e295df115 bifcl: Other minor cleanups 2025-08-20 08:52:25 -07:00
Tim Wojtulewicz
8662b29ac6 bifcl: Use bools for boolean comparisons 2025-08-20 08:52:25 -07:00
Tim Wojtulewicz
224a42e1f0 bifcl: Use nullptrs for pointer initializations 2025-08-20 08:52:25 -07:00
Tim Wojtulewicz
4ed4f3e1b8 bifcl: Include stdint.h early to prevent redefinition of int type macros 2025-08-20 08:52:25 -07:00
Tim Wojtulewicz
0c4676e835 bifcl: Remove argument from BIFCL_LSAN_DISABLE macro to fix warning on Windows 2025-08-20 08:52:25 -07:00
Tomer Lev
4352f0c0bb bifcl: Only adding subdir if running standalone 2025-08-20 08:52:25 -07:00
Tomer Lev
c6042154b9 bifcl: Adding support for libunistd. Also adding pragma guard for the right arch 2025-08-20 08:52:25 -07:00
Tim Wojtulewicz
3a18b2144c bifcl: Add clang-format and run it on everything 2025-08-20 08:52:25 -07:00
Elad Solomon
552be424c4 bifcl: Adapted bifcl to compile with MSVC for Windows environment. 2025-08-20 08:52:25 -07:00
Tim Wojtulewicz
f69f9e06e1 bifcl: Use full path to filename in #line directives in generated code
This fixes the DWARF information gets output by the compiler, and allows debuggers
to use the full path name to display contextual information when a session stops
inside of BIF code.
2025-08-20 08:52:25 -07:00
Benjamin Bannier
09d3268740 bifcl: Keep zeekygen comments close to their definitions
The Yacc grammar treats comments like other whitespace and when seeing
the first definition in a file would previously emit all whitespace
before emitting the `export` section containing the definition. This
lead to the first definition being separated from their zeekygen
documention (separated by `export {`).

With this patch we start the export section before emitting whitespace.
While this might now pull more "whitespace" into the exported part, it
avoids breaking the association between zeekygen comments and
definitions.

Closes #15.
2025-08-20 08:52:25 -07:00
Tim Wojtulewicz
e080c5c6b2 bifcl: Remove remaining uses of Bro naming 2025-08-20 08:52:25 -07:00
Tim Wojtulewicz
669875a9b7 bifcl: Deprecate bro_int_t and bro_uint_t 2025-08-20 08:52:25 -07:00
Vern Paxson
2f3f7e9ce2 bifcl: trimmed & regularized some minor variable naming 2025-08-20 08:52:25 -07:00
Tim Wojtulewicz
02fe78a03f bifcl: Allow analyzer to be passed as nullptr for enqueue methods
This allows the methods to be used in contexts where the analyzer ID
is not available or when the ID doesn't matter, such as in packet
analyzers.
2025-08-20 08:52:25 -07:00
Seth Hall
d0ed713108 bifcl: Updates for building Zeek as a subproject 2025-08-20 08:52:25 -07:00
Tim Wojtulewicz
ea625959c1 bifcl: Rename Session::ConnVal() to Session::GetVal() 2025-08-20 08:52:25 -07:00
Jon Siwek
ae56d45a1f bifcl: Prevent use of LeakSanitizer on FreeBSD 2025-08-20 08:52:25 -07:00
Jon Siwek
34c4f678cf bifcl: Add missing zeek/ to generated header includes
Related to https://github.com/zeek/zeek/pull/1377
2025-08-20 08:52:25 -07:00
Tim Wojtulewicz
279d5f3fad bifcl: Remove v4.1 deprecation warnings 2025-08-20 08:52:25 -07:00
Vern Paxson
72fa791294 bifcl: support for new FileVal class 2025-08-20 08:52:24 -07:00
Jon Siwek
23a4b7e7c1 bifcl: Update minimum required CMake to 3.5 2025-08-20 08:52:24 -07:00
Jon Siwek
fbc98f4dd5 bifcl: Postpone initialization of constants for subdir BIFs 2025-08-20 08:52:24 -07:00
Tim Wojtulewicz
406f68f7fa bifcl: Rename bro-bif.h to zeek-bif.h 2025-08-20 08:52:24 -07:00
Tim Wojtulewicz
56d9813042 bifcl: Move __RegisterBif from zeek::detail::plugin to zeek::plugin::detail 2025-08-20 08:52:24 -07:00
Tim Wojtulewicz
74d21a40e4 bifcl: SOURCE_LOCAL is part of the zeek::util::detail namespace now 2025-08-20 08:52:24 -07:00
Tim Wojtulewicz
c5189596da bifcl: Move Connection to zeek namespace 2025-08-20 08:52:24 -07:00
Tim Wojtulewicz
5c94ea02c5 bifcl: Move BifReturnVal to zeek::detail namespace 2025-08-20 08:52:24 -07:00
Tim Wojtulewicz
cffecc5033 bifcl: Move event code to zeek namespace, rename mgr to event_mgr 2025-08-20 08:52:24 -07:00
Tim Wojtulewicz
2090786ac5 bifcl: Move BroFile to zeek namespace, rename to File 2025-08-20 08:52:24 -07:00
Tim Wojtulewicz
caf565c539 bifcl: Move base analyzer classes to zeek namespace 2025-08-20 08:52:24 -07:00
Jon Siwek
fe0b3dd13f bifcl: Ensure strncpy null-termination 2025-08-20 08:52:24 -07:00
Jon Siwek
a5a7f08c37 bifcl: Fix stringop-truncation compiler warning 2025-08-20 08:52:24 -07:00
Tim Wojtulewicz
b203311bad bifcl: Add zeek:: namespace to val_mgr usage 2025-08-20 08:52:24 -07:00
Tim Wojtulewicz
6204542b5a bifcl: Review cleanup 2025-08-20 08:52:24 -07:00
Tim Wojtulewicz
ff7b41ff12 bifcl: Move BuiltinFunc to zeek namespace 2025-08-20 08:52:24 -07:00
Tim Wojtulewicz
13dac12521 bifcl: Move Frame to the zeek::detail namespace 2025-08-20 08:52:24 -07:00
Tim Wojtulewicz
0597535149 bifcl: Move all Val classes to the zeek namespaces 2025-08-20 08:52:24 -07:00
Tim Wojtulewicz
79bbe9a7bf bifcl: Move IntrusivePtr to the zeek namespace 2025-08-20 08:52:24 -07:00
Tim Wojtulewicz
73fb715657 bifcl: Update namespace for *Type classes 2025-08-20 08:52:24 -07:00
Tim Wojtulewicz
6813ddaaa9 bifcl: Update namespace for plugin::Plugin and plugin::BifItem classes 2025-08-20 08:52:24 -07:00
Tim Wojtulewicz
9f317f02a4 bifcl: Update namespace for __RegisterBif function 2025-08-20 08:52:24 -07:00
Jon Siwek
011f66cb2d bifcl: Use new TimeVal/DoubleVal subclass ctors 2025-08-20 08:52:24 -07:00
Tim Wojtulewicz
4686ba3824 bifcl: Include Func.h in files during build 2025-08-20 08:52:24 -07:00
Jon Siwek
99fa631ddd bifcl: Change constructor for BroFile args 2025-08-20 08:52:24 -07:00
Jon Siwek
23b4af393f bifcl: Switch zeek:🆔:lookup to zeek:🆔:find 2025-08-20 08:52:24 -07:00
Jon Siwek
2ef1aacd36 bifcl: Use zeek::BifEvent:: for enqueue_ functions instead of BifEvent::
The old BifEvent::generate_ functions were already deprecated
2025-08-20 08:52:24 -07:00
Jon Siwek
4c2fb01981 bifcl: Deprecate BifFunc:: declarations, replace with zeek::BifFunc::
Also changes name of function slightly, example: bro_fmt -> fmt_bif.
2025-08-20 08:52:24 -07:00
Jon Siwek
d72884064a bifcl: Deprecate names in BifConst, replace with zeek::BifConst
Some Val* types are also replaced with IntrusivePtr
2025-08-20 08:52:24 -07:00
Jon Siwek
620680d878 bifcl: Deprecate all BroType* in BifType:: namespace
Replaced with equivalently named IntrusivePtr in zeek::BifType::
2025-08-20 08:52:24 -07:00
Jon Siwek
36dec9dbb5 bifcl: Change internal_handler() usage 2025-08-20 08:52:24 -07:00
Jon Siwek
59e86c6ea0 bifcl: Renaming/scoping of lookup functions 2025-08-20 08:52:24 -07:00
Jon Siwek
53d6f6665e bifcl: Replace deprecated use of internal_const_val() 2025-08-20 08:52:24 -07:00
Jon Siwek
719b8082ca bifcl: Update deprecated use of internal_type() 2025-08-20 08:52:24 -07:00
Jon Siwek
b29ecfd822 bifcl: Deprecate BifEvent::generate_*, add BifEvent::enqueue_* 2025-08-20 08:52:24 -07:00
Jon Siwek
0f5c621bd7 bifcl: Update deprecated Connection::BuildConnVal usage 2025-08-20 08:52:24 -07:00
Jon Siwek
7958f7854c bifcl: Return nullptr instead of 0 in BIF error conditions 2025-08-20 08:52:24 -07:00
Jon Siwek
c2841cb1b2 bifcl: Update deprecated ValManager::Get usages 2025-08-20 08:52:24 -07:00
Jon Siwek
9a3ac5de98 bifcl: Change BIFs to return a wrapper object
That allows implicit conversion from either Val* or IntrusivePtr<T>
2025-08-20 08:52:24 -07:00
Jon Siwek
df5249e7dd bifcl: Remove use of Variable-Length-Arrays
Related to https://github.com/zeek/zeek/issues/895
2025-08-20 08:52:24 -07:00
Jon Siwek
e5c62c01a4 bifcl: Support multiple/alternate event prototype definitions 2025-08-20 08:52:24 -07:00
Jon Siwek
b6b094b43a bifcl: Don't pass a TimerMgr to EventMgr::Enqueue() 2025-08-20 08:52:24 -07:00
Jon Siwek
de453419d7 bifcl: Use EventMgr::Enqueue() instead of QueueEventFast() 2025-08-20 08:52:24 -07:00
Jon Siwek
163a86fc4e bifcl: Move BIF function arguments from val_list to vector of IntrusivePtr 2025-08-20 08:52:24 -07:00
Jon Siwek
7009f1dda6 bifcl: Fix header include guards 2025-08-20 08:52:24 -07:00
Jon Siwek
c60bd14d56 bifcl: Disable LeakSanitizer
Related to https://github.com/zeek/zeek/issues/699
2025-08-20 08:52:24 -07:00
Jon Siwek
81b23aff92 bifcl: Move CMake project() after cmake_minimum_required() 2025-08-20 08:52:24 -07:00
Jon Siwek
a86b98bb9e bifcl: Move headers into include/ subdir
This avoids potential problems with libc++ 8+ on case-insensitive file
systems due to inclusion of a new header called <version> which will end
up conflicting with the VERSION file if the search path includes the
project root.
2025-08-20 08:52:24 -07:00
Daniel Thayer
3ce42f2f35 bifcl: Rename Bro to Zeek 2025-08-20 08:52:24 -07:00
Jon Siwek
3b8932ff01 bifcl: Update codegen to use faster val_list and event queue API 2025-08-20 08:52:24 -07:00
Daniel Thayer
a95808bc6b bifcl: Change file extension of auto-generated script files
Changed ".bro" file extension to ".zeek".
2025-08-20 08:52:24 -07:00
Robin Sommer
c3f6c8a4a0 bifcl: Fix compiler warning. 2025-08-20 08:52:24 -07:00
Jon Siwek
3a4f38a04b bifcl: Port bifcl code from Bro 2025-08-20 08:52:24 -07:00
Jon Siwek
73e8f2c79d bifcl: First commit 2025-08-20 08:52:24 -07:00
Tim Wojtulewicz
137e8bddc9 Run pre-commit on merged binpac code 2025-08-20 08:52:24 -07:00
Tim Wojtulewicz
8a7c6df278 Fix clang-tidy findings in the binpac lib code 2025-08-20 08:52:24 -07:00
Tim Wojtulewicz
6bddc06f8d Add copyright headers to all of the binpac source files 2025-08-20 08:52:24 -07:00
Tim Wojtulewicz
0377486637 binpac: Remove submodule, adapt CMake configuration for Zeek build 2025-08-20 08:52:24 -07:00
Tim Wojtulewicz
79733d9390 binpac: Restore README file without version number 2025-08-20 08:52:24 -07:00
Tim Wojtulewicz
a25b5b65ff binpac: Fix coverity unchecked return warning 2025-08-20 08:52:24 -07:00
Tim Wojtulewicz
d13cdd6427 binpac: Use std::move for a string value 2025-08-20 08:52:24 -07:00
Tim Wojtulewicz
710e2eaced binpac: Make sure pac_expr fields are initialized 2025-08-20 08:52:24 -07:00
Tim Wojtulewicz
b9b4fcb78b binpac: Require C++20 for builds 2025-08-20 08:52:24 -07:00
Tim Wojtulewicz
bb382fc0c0 binpac: Fix clang-tidy readability-isolate-declaration finding in generated code 2025-08-20 08:52:24 -07:00
Tim Wojtulewicz
ef962376bc binpac: Add 'override' to virtual methods in generated code 2025-08-20 08:52:24 -07:00
Tim Wojtulewicz
28cc9ca3ec binpac: Add NOLINT for clang-tidy performance-enum-size to generated headers 2025-08-20 08:52:24 -07:00
Tim Wojtulewicz
09936133a6 binpac: Reorder the fields in pac_type.h for better packing 2025-08-20 08:52:24 -07:00
Tim Wojtulewicz
45d07641e4 binpac: Make 'nullptr' a keyword, allow values to be set to it and compared against it
This helps fix 'modernize-use-nullptr' findings in generated code.
2025-08-20 08:52:24 -07:00
Tim Wojtulewicz
3cf68302a2 binpac: Make 'bool' a discrete type and handle it differently when generating code
This fixes clang-tidy modernize-use-bool-literals findings in the generated code
2025-08-20 08:52:24 -07:00
Tim Wojtulewicz
54a0e01805 binpac: Wrap generated switch statements in NOLINTs for bugprone-branch-clone
Binpac generates a lot of switch statements with repeated blocks in
them (typically empty blocks). Running clang-tidy on the generated code
with bugprone-branch-clone generates a lot of warnings. Instead of
doing a ton of analysis in binpac to avoid generating the duplicates,
just mark any switch generated with an annotation to avoid reporting
them.
2025-08-20 08:52:24 -07:00
Tim Wojtulewicz
670c4dcbcf binpac: Add missing .cmake-format.json, reformat with pre-commit 2025-08-20 08:52:24 -07:00
Tim Wojtulewicz
dacfe747b9 binpac: Format output closer to what clang-format would output 2025-08-20 08:52:24 -07:00
Tim Wojtulewicz
964817f9bf binpac: Add cmake-format and typos pre-commit configs 2025-08-20 08:52:24 -07:00
Tim Wojtulewicz
3297de477b binpac: Reformat C++ code in Spicy style 2025-08-20 08:52:24 -07:00
Tim Wojtulewicz
716bf016a1 binpac: Remove usage of FindRequiredPackage 2025-08-20 08:52:24 -07:00
Tim Wojtulewicz
a4bc3fdf32 binpac: Add /J flag on Windows to force unsigned char 2025-08-20 08:52:24 -07:00
Tim Wojtulewicz
874de5d25b binpac: Force -std=c++17 mode for cmake targets, remove use of RequireCXX17.cmake 2025-08-20 08:52:24 -07:00
Tim Wojtulewicz
b7cc5afa78 binpac: Require CMake 3.15.0 to build, similar to the recent changes to zeek and broker 2025-08-20 08:52:24 -07:00
Tim Wojtulewicz
d39df6b243 binpac: Remove vendored CMake files from repo 2025-08-20 08:52:24 -07:00
Tim Wojtulewicz
4d0a29a725 binpac: Don't output comment for &let/&withinput if no such fields exist 2025-08-20 08:52:24 -07:00
Tim Wojtulewicz
ba7a7c2201 binpac: Include stdint.h early to prevent redefinition of int type macros 2025-08-20 08:52:24 -07:00
Tim Wojtulewicz
e05a0b8748 binpac: Remove argument from BINPAC_LSAN_DISABLE macro to fix warning on Windows 2025-08-20 08:52:24 -07:00
Tim Wojtulewicz
5264b957f1 binpac: Generate range-based for loops for array cleanup 2025-08-20 08:52:24 -07:00
Tim Wojtulewicz
65da8cf5de binpac: Avoid initializing array length variables twice in generated code 2025-08-20 08:52:24 -07:00
Tim Wojtulewicz
299f39e8e2 binpac: Mark overridden methods with 'override' 2025-08-20 08:52:24 -07:00
Tim Wojtulewicz
45ef19049c binpac: Add final keyword to class definitions 2025-08-20 08:52:24 -07:00
Tim Wojtulewicz
613ffef4a2 binpac: Use nullptr in generated code 2025-08-20 08:52:24 -07:00
Tim Wojtulewicz
9f3750d0cc binpac: Apply clang-tidy's modernize-use-nullptr check 2025-08-20 08:52:24 -07:00
Vern Paxson
49a96f5216 binpac: address linter warnings about use of sprintf() 2025-08-20 08:52:23 -07:00
Tomer Lev
d5f2c9c3a8 binpac: Only adding subdir if running standalone 2025-08-20 08:52:23 -07:00
Tomer Lev
9a4e01e634 binpac: Additional Windows fixes. Fixed wrong MSVC macro definition and std::filesystem invocation. Linking to libunistd library 2025-08-20 08:52:23 -07:00
Arne Welzel
60265b8ce7 binpac: pac_scan: Exit with failure for include errors
Elsewhere (zeek/zeek#2482), it was observed that when binpac encounters
include failures, it still exits with 0 indicating success. Subsequent
compilation of the produced .h and .cc files likely fails.

Exit with 1 on include errors to make pin pointing issues easier by
having make/ninja stop earlier.
2025-08-20 08:52:23 -07:00
Tim Wojtulewicz
d21f99ef2b binpac: Wrap native dirname() call in ifdef, call std::filesystem on Windows 2025-08-20 08:52:23 -07:00
Elad Solomon
faa1b7abbf binpac: Adapted binpac to compile with MSVC for Windows environment. 2025-08-20 08:52:23 -07:00
Tim Wojtulewicz
dd3737b5c8 binpac: Apply bits of nadi-bittorrent patch that aren't applied 2025-08-20 08:52:23 -07:00
Tim Wojtulewicz
090325df40 binpac: Add pre-commit hooks and run clang-format on everything 2025-08-20 08:52:23 -07:00
Tim Wojtulewicz
090ac0a6e0 binpac: Remove already-applied binpac-* patches 2025-08-20 08:52:23 -07:00
Tim Wojtulewicz
6034744a0c binpac: Rename files in patches to match current directory structure 2025-08-20 08:52:23 -07:00
Seth Hall
c010152340 binpac: CMAKE_CFG_INTDIR is no longer necessary.
CMake documentation says that CMAKE_CFG_INTDIR is no longer necessary to
find the right binary for the configuration and is in fact deprecated in
recent versions of CMake.
2025-08-20 08:52:23 -07:00
Seth Hall
024b4ff8f3 binpac: Updates for building Zeek as a submodule 2025-08-20 08:52:23 -07:00
Jon Siwek
508e78ebe9 binpac: Prevent use of LeakSanitizer on FreeBSD 2025-08-20 08:52:23 -07:00
Tim Wojtulewicz
f365c253a7 binpac: Fix LGTM findings 2025-08-20 08:52:23 -07:00
Tim Wojtulewicz
5d75f8ed6c binpac: Remove usage of ZEEK_FORWARD_DECLARE_NAMESPACED macro 2025-08-20 08:52:23 -07:00
Jon Siwek
b1101e6e16 binpac: Fix #include of RE.h to use zeek/RE.h 2025-08-20 08:52:23 -07:00
Jon Siwek
c5fe0eaa17 binpac: GH-14: Use larger temporary storage for evaluating case-expressions
For example:

    inum: uint32 = case (ed & 0x0f) of {
        0x00    -> n_8;  # n_8 is a uint8
        0x01    -> n_16; # n_16 is a uint16
        0x02    -> n_32; # n_32 is a uint32
        default -> 0;
    };

Previously, the temporary storage used for evaluating the
case-expression was based on whatever type the first case yields, which
is a uint8 in the above example.  That behavior can lead to a narrowing
conversion whenever the 0x01 or 0x02 cases occur.

The new behavior is to base the temporary storage's type on the largest
numeric type that the case-expression can yield, which is uint32 in the
above example.
2025-08-20 08:52:23 -07:00
Jon Siwek
11b6feb18b binpac: Update minimum required CMake to 3.5 2025-08-20 08:52:23 -07:00
Tim Wojtulewicz
f1d7d0c80d binpac: Move RE_Matcher to zeek namespace 2025-08-20 08:52:23 -07:00
Tim Wojtulewicz
cd7a2e9783 binpac: Squash two rules into one with a wildcard 2025-08-20 08:52:23 -07:00
Tim Wojtulewicz
a7f14ed423 binpac: Allow namespaced names as typenames for function return values 2025-08-20 08:52:23 -07:00
Jon Siwek
9de6212dda binpac: Remove use of Variable-Length-Arrays
Related to https://github.com/zeek/zeek/issues/895
2025-08-20 08:52:23 -07:00
Jon Siwek
db7c3d7c5c binpac: Fix incorrect boundary checks in flowbuffer frame length parsing
Incremental flowbuffer parsing sought to first parse the "minimum header
length" required to get the full frame length, possibly from a record
field, but generating the logic to parse that field could greedily
bundle in additional boundary-checks for all subsequent fields of
known-size.

E.g. for flowunit parsing of this:

    type HDR = record {
        version:    uint8;
        reserved:   uint8;
        len:        uint16;
    } &byteorder=bigendian;

    type FOO_PDU(is_orig: bool) = record {
        hdr:        HDR;
        plen:       uint8;
        ptype:      uint8;
        something:  bytestring &restofdata;
    } &byteorder=bigendian, &length=hdr.len;

The flowbuffer was correctly seeking to buffer 4 bytes and parse the
"hdr.len" field, but the generated parsing logic for "hdr.len" included
a boundary check all the way up to include "plen" and "ptype".

This causes out-of-bounds exceptions to be thrown for inputs that should
actually be possible to incrementally parse via flowbuffer.
2025-08-20 08:52:23 -07:00
Jon Siwek
3aad9c74c3 binpac: Disable LeakSanitizer
https://github.com/zeek/zeek/issues/699
2025-08-20 08:52:23 -07:00
Jon Siwek
b2ef28c2e7 binpac: Fix Zeek build for multi-config CMake generators (e.g. Xcode) 2025-08-20 08:52:23 -07:00
Jon Siwek
3cba237e84 binpac: Fix shared library versioning to agree with OpenBSD expectations
OpenBSD shared library names are like "libfoo.so.major.minor" and
binpac was previously letting the post-release number into the name
like "libbinpac.so.0.54-7", which isn't compatible with that scheme.

Related to https://github.com/zeek/zeek/issues/649
2025-08-20 08:52:23 -07:00
Jon Siwek
8b4b74e54a binpac: Move CMake project() after cmake_minimum_required() 2025-08-20 08:52:23 -07:00
Jon Siwek
ef933c9e76 binpac: Fix signed integer overflow in array bounds checks
Array lengths use signed integer storage, so multiplication of that
by the element size for purpose of bounds checking against available
data may produce a signed integer overlow, which is undefined behavior.
2025-08-20 08:52:23 -07:00
Jon Siwek
7632c69566 binpac: Fix a printf format specifier 2025-08-20 08:52:23 -07:00
Daniel Thayer
219dbd0fa3 binpac: More Bro to Zeek renaming 2025-08-20 08:52:23 -07:00
Daniel Thayer
078722fc8d binpac: Rename Bro to Zeek 2025-08-20 08:52:23 -07:00
Jon Siwek
533d823514 binpac: Fix C++11 compatibility issue for older compilers 2025-08-20 08:52:23 -07:00
Jon Siwek
21cf20fc6f binpac: Improve storage type used for case-type index
The type used to store the index for a case-type now tracks the
type of the index expression rather than always using an "int".

The case fields also now have some checking done at code-gen-time to
ensure the constants used for cases does not exceed the numeric limit
of the type used in the case's index expression.  Then, assuming, it
looks safe, the C++ case labels are generated with casts to the type
of the Binpac case's index expression to ensure compilers accept it
(since all Binpac numbers use "int" for storage/printing internally).
2025-08-20 08:52:23 -07:00
Jon Siwek
b4b229acf7 binpac: Add FlowBuffer policy mechanisms
This allows for tunability of the following behaviors:

* Minimum flowbuffer capacity to use when parsing a new unit

* Threshold at which flowbuffer capacity is contracted back to the
  minimum after parsing a complete unit and before parsing the next

* Maximum flowbuffer capacity to allow when parsing a given unit

Failed flowbuffer allocations due to reaching maximum capacity or any
other reason now throw ExceptionFlowBufferAlloc.
2025-08-20 08:52:23 -07:00
Jon Siwek
7e6e24a4d8 binpac: Build binpac shared lib instead of static by default
Related to https://github.com/zeek/zeek/issues/307
2025-08-20 08:52:23 -07:00
Jon Siwek
7bb1a148af binpac: Bump minimum CMake version to 2.8.12 2025-08-20 08:52:23 -07:00
Derek Ditch
2da5fecc16 binpac: Set installdirs using GNUInstallDirs module in CMake 2025-08-20 08:52:23 -07:00
Jon Siwek
1d750aa164 binpac: Replace u_char usages with unsigned char
Improve Alpine (musl) support by not relying on the (technically)
non-standard u_char typedef.
2025-08-20 08:52:23 -07:00
Jon Siwek
46e2490cb0 binpac: Fix array bounds checking
For arrays that are fields within a record, the bounds check was based
on a pointer to the start of the record rather than the start of the
array field.
2025-08-20 08:52:23 -07:00
Jon Siwek
de87adf398 binpac: Update BinPAC_EXE CMake variable to be a full path 2025-08-20 08:52:23 -07:00
Jon Siwek
721ea63a33 binpac: Install headers to alternate path as part of Bro sub-project 2025-08-20 08:52:23 -07:00
Jon Siwek
eea32ada6d binpac: Remove "installation skip" code paths 2025-08-20 08:52:23 -07:00
Jon Siwek
9bb3a94595 binpac: Don't install binpac.h.in 2025-08-20 08:52:23 -07:00
Robin Sommer
c149922d64 binpac: Fix compiler warning. 2025-08-20 08:52:23 -07:00
Jon Siwek
465fd6bd56 binpac: BIT-1829: throw exceptions for negative array length expressions 2025-08-20 08:52:23 -07:00
Jon Siwek
455e2fbac5 binpac: BIT-1829: throw exceptions for excessive array sizes
For arrays with unknown element size, it used to cap the array length to
be the maximum it could be for the given input buffer, assuming 1-byte
elements.  An exception is instead now raised for cases where the
maximum array size (number of elements) exceeds what's possibly in the
buffer.  Using an exception versus capping the length may help prevent
protocol analyzers from unintentionally accessing array indices that
were not actually parsed even if the evauluated-length-expression for
that given array implies it may have been.
2025-08-20 08:52:23 -07:00
Jon Siwek
5a688c2730 binpac: Migrate fmt() usage to strfmt()
The former is easy to misuse by accidentally storing the contents of
the temporary string return value and accessing it later.  There's also
potential pitfalls in changing it to return a pointer into a static
buffer, so instead start using strfmt() uniformly across the codebase
and change some methods to use strings instead of char*.
2025-08-20 08:52:23 -07:00
Jon Siwek
0a05aa92fc binpac: Improve parsing of known-length, static-size arrays
In this case, the bounds checking for individual elements can be
optimized out of the parsing-loop in favor of a single, array-wide
bounds check beforehand.
2025-08-20 08:52:23 -07:00
Jon Siwek
d6fc439c21 binpac: GH-4: fix premature loop termination when parsing known-length arrays
For arrays with a length expression (e.g. uint16[size] instead of
uint16[]), the parsing loop would consider reaching the end of the
data buffer as a successful loop termination condition even if it's
not yet parsed the required number of elements.

Now, for such arrays, the loop will only terminate based on the loop
counter (derived from the length expression) or else it will throw an
OOB exception when trying to parse an element and finding not enough
data in the buffer.

Credit to Tomas Bortoli for reporting the problem and proposing
patches.
2025-08-20 08:52:23 -07:00
Jon Siwek
9c61eefe0d binpac: BIT-1829: fix &length suppressing boundary checks for array elements
It should only suppress the parsing-loop boundary check in the case
where array elaments are a single byte in length and thus covered by
the boundary check (generated as a result of &length) that is placed
before the parsing-loop.
2025-08-20 08:52:23 -07:00
Jon Siwek
39547dccec binpac: BIT-1914: emit deprecation warning for &check usages 2025-08-20 08:52:23 -07:00
Jon Siwek
8a1c8db02e binpac: BIT-1914: move &check implementation to new &enforce attribute
&check returns to being a no-op to avoid unintentionally
breaking existing code.
2025-08-20 08:52:23 -07:00
Jon Siwek
0ecf7755ea binpac: BIT-1914: Implement &check
Patch submitted by Antoine
2025-08-20 08:52:23 -07:00
Jon Siwek
0b84838465 binpac: Fix an uninitialized member warning 2025-08-20 08:52:23 -07:00
giralt
5cfbefca7c binpac: Extends BinPAC to support arbitrary line breakers via &linebreaker attribute
This feature is needed to run the FIX ASCII analyzer: https://github.com/reservoirlabs/fix-ascii
2025-08-20 08:52:23 -07:00
Johanna Amann
827d1ff11e binpac: Fix integer overflow in binpac generated code.
The issue is that t_begin_of_data + %s can sometimes overflow.

Bug reported and patch proposed by
Philippe Antoine <p.antoine@catenacyber.fr> from Catena cyber.
2025-08-20 08:52:23 -07:00
Johanna Amann
e4c168836e binpac: Allow more than one &require attribute on a field.
Patch by François Pennaneach <francois.pennaneach@free.fr>.

BIT-1753 #close
2025-08-20 08:52:23 -07:00
Bryon Gloden, CISSP®
ffe92f487f binpac: Update pac_parse.yy
(error) Memory leak: msgbug

Found by https://github.com/bryongloden/cppcheck
2025-08-20 08:52:23 -07:00
Bartolo Otrit
f1239143cb binpac: Bug fix of pac_swap function with int32 type of argument.
How to reproduce:

>>>code
int32 n = 0xF71B0000;
int32 n1 = pac_swap(n);
code<<<

n1 becomes 0xFFFFFFF7 instead of 0x00001BF7

Reason: Undefined behaviour after bit shift operation because of
negative value of the argument. See C++ standard (2011) 5.8.2 (Shift
operators).
2025-08-20 08:52:23 -07:00
Robin Sommer
d73e3485c1 binpac: Fixing Coverity warning. 2025-08-20 08:52:23 -07:00
Vlad Grigorescu
dc49b0343f binpac: Add a comment in the generated C++ code for fall through in switch
A common BinPAC construct for parsing records is a switch statement,
with no breaks between the cases, as control is expected to fall
through.

Coverity raises an error about this; this commit should fix that.
2025-08-20 08:52:23 -07:00
Seth Hall
a9d294528d binpac: Fixed compiler complaining about recursive function. 2025-08-20 08:52:23 -07:00
Robin Sommer
e3e4453dac binpac: Adding missing include. 2025-08-20 08:52:23 -07:00
Jon Siwek
ae20042943 binpac: BIT-1343: fix %include to work with relative paths 2025-08-20 08:52:23 -07:00
Jon Siwek
ded5abb01e binpac: BIT-1361: Improve boundary checks of records that use &length
Specifying &length on a record no longer skips generating boundary
checks for individual fields.  E.g. a record field that specifies a
&length that extends beyond the &length of the record containing it
should throw binpac::ExceptionOutOfBound, the usual way of handling
out-of-bounds conditions.
2025-08-20 08:52:23 -07:00
Jon Siwek
8648820497 binpac: Fix potential out-of-bounds memory reads in generated code.
Field lengths derived from other data in the input could potentially
lead to reading from outside the bounds of the input buffer.

Reported by John Villamil and Chris Rohlf - Yahoo Paranoids
2025-08-20 08:52:23 -07:00
Jon Siwek
db1c70b32e binpac: Separate declaration of binpac::init from definition.
When friend'ing a global function via qualified-id, Clang complains if
it's not been previously declared.
2025-08-20 08:52:23 -07:00
Robin Sommer
434f147932 binpac: Adding a new binpac::init() function that must be called by the host
before anything else.

Internally, this function compiles all regular expressions, avoiding
to that inside the regexp constructore. The code is a bit hackish due
to the way the regexp code depends on the Bro header.
2025-08-20 08:52:23 -07:00
Jon Siwek
498a5314ed binpac: Request format macros from inttypes.h explicitly.
This helps ensure the availability of PRI* macros from .pac files,
which cannot create this definition themselves since the inclusion
of binpac.h is hardcoded to be placed very early in the generated
code and already includes inttypes.h itself.
2025-08-20 08:52:23 -07:00
Jon Siwek
a5fb8e3787 binpac: Fix uninitialized (or unused) fields. 2025-08-20 08:52:23 -07:00
Jon Siwek
81bf65e148 binpac: Generate initialization code for external types.
Numeric/pointer types can be initialized to 0.
2025-08-20 08:52:23 -07:00
Jon Siwek
201b43f3be binpac: Optimize negative string length check.
Strings with a constant &length expression can be checked for negative
length values while generating the parser instead of in the parser
itself (which likely just ends up being dead code).
2025-08-20 08:52:23 -07:00
Jon Siwek
13e14768da binpac: Add virtual dtor to RefCount base class.
The code generated for types w/ &refcount will subclass RefCount and
Unref definitely deletes via a pointer to that base class so it needs a
virtual dtor.
2025-08-20 08:52:23 -07:00
Jon Siwek
4d7de63ef0 binpac: Add missing break to switch statement case. 2025-08-20 08:52:23 -07:00
Jon Siwek
8136abafef binpac: Remove unreachable code. 2025-08-20 08:52:23 -07:00
Jon Siwek
5e0f604418 binpac: Add missing va_end()'s to match va_start()'s.
Probably not an issue on most implementations, but undefined behavior
is scary and it's easy to fix.
2025-08-20 08:52:23 -07:00
Jon Siwek
cb524c2fde binpac: Fix two use-after-free bugs. 2025-08-20 08:52:23 -07:00
Jon Siwek
871541e636 binpac: Fix double-free.
The field is deleted by a base class dtor.
2025-08-20 08:52:23 -07:00
Robin Sommer
61cc83affa binpac: Adding an interface to manually control the buffering for generated
parsers.

This consists of two parts:

    1. The generated Flow classes expose their flow buffers via a new
       method flow_buffer().

    2. Flow buffers get two new methods:

        // Interface for delayed parsing. Sometimes BinPAC doesn't get the
        // buffering right and then one can use these to feed parts
        // individually and assemble them internally. After calling
        // FinishBuffer(), one can send the uppper-layer flow an FlowEOF()
        // to trigger parsing.
        void BufferData(const_byteptr data, const_byteptr end);
        void FinishBuffer();
2025-08-20 08:52:23 -07:00
Jon Siwek
ce2b56751b binpac: Fix an exception slicing issue in binpac generated cleanup code.
Switch to using a no-argument throw to preserve the dynamic type of
the binpac exception.  Otherwise, the exception is "sliced" and can only
be subsequently handled as binpac::Exception and not a derived type.
2025-08-20 08:52:23 -07:00
Jon Siwek
14e3d5a1a3 binpac: Add scoping to usages of binpac::Exception classes in generated code.
This allows analyzers to define their own types of the same name
without mistakingly overshadowing the usages of binpac::Exception
and its derived types in the generated parser code.
2025-08-20 08:52:23 -07:00
Robin Sommer
6c70f7851b binpac: Silence warning for generated code when compiling with clang. 2025-08-20 08:52:23 -07:00
Jon Siwek
8cf0be6d0f binpac: Change binpac.h integral typedefs and reimplement 64-bit pac_swap().
Integer types now use <inttypes.h>, and the 64-bit byte-swapping
function uses a union approach instead of masking/bit-shifting.

Addresses #761.
2025-08-20 08:52:23 -07:00
Jon Siwek
bf2184bb0f binpac: Raise minimum required CMake version to 2.6.3 2025-08-20 08:52:23 -07:00
Robin Sommer
fccf3a7340 binpac: Distribution cleanup. 2025-08-20 08:52:23 -07:00
Robin Sommer
092d049f8e binpac: Arrays now suport the &transient attribute.
If set, parsed elements won't actually be added to the array, and read
access to the array aren't permitted. This is helpful to save memory
in the case of large arrays for which elements don't need (or can't)
be buffered.
2025-08-20 08:52:23 -07:00
Jon Siwek
5db7ba4050 binpac: Update to use cmake submodule 2025-08-20 08:52:23 -07:00
Jon Siwek
969998d148 binpac: Remove $Id$ tags 2025-08-20 08:52:23 -07:00
Jon Siwek
3841c68d87 binpac: Install binaries with an RPATH 2025-08-20 08:52:23 -07:00
Jon Siwek
a4f05185d6 binpac: Workaround for FreeBSD CMake port missing debug flags 2025-08-20 08:52:23 -07:00
Robin Sommer
77e4315a57 binpac: Fixing compiler warning 2025-08-20 08:52:23 -07:00
Seth Hall
1d6cea8c52 binpac: Adding int64 and uint64 types to binpac. 2025-08-20 08:52:23 -07:00
Jon Siwek
50f5a913c3 binpac: Adding files to CMake build targets so they show up in generated IDE projects.
This addresses #413.
2025-08-20 08:52:23 -07:00
Robin Sommer
d41a2def5a binpac: Fixing crash with undefined case expressions.
Found by Emmanuele Zambon.
2025-08-20 08:52:23 -07:00
Jon Siwek
e7e2ee38e7 binpac: Add explicit CMake check for compiler 2025-08-20 08:52:23 -07:00
Seth Hall
1a15b968e6 binpac: Added an option to quiet the status output from binpac.
This adds the -q command line flag to quiet the output.
It also fixes a small compiler warning.
2025-08-20 08:52:23 -07:00
Jon Siwek
c2dbefab17 binpac: MacPorts & Fink paths now prepended to default search prefixes 2025-08-20 08:52:23 -07:00
Jon Siwek
2260d6c60e binpac: Add warning when building and installing are done by different users 2025-08-20 08:52:22 -07:00
Jon Siwek
4dd640d0f7 binpac: CMake 2.6 compatibility changes 2025-08-20 08:52:22 -07:00
Robin Sommer
71cc7e9d5b binpac: Cleaning up. 2025-08-20 08:52:22 -07:00
Jon Siwek
67e5bc7198 binpac: Made uninstall target cooperate with other projects 2025-08-20 08:52:22 -07:00
Jon Siwek
aacc6ee043 binpac: Added uninstall target 2025-08-20 08:52:22 -07:00
Jon Siwek
ed7e697d35 binpac: Changed default CMAKE_BUILD_TYPE to RelWithDebInfo
The --enable-debug option of the configure wrapper changes it to Debug.
Removed --enable-release option of the configure wrapper.
2025-08-20 08:52:22 -07:00
Jon Siwek
32423cf27b binpac: Customizable error messages for missing prereqs.
Adds the FindRequiredPackage() macro that wraps the functionality
of the standard find_package() macro.
2025-08-20 08:52:22 -07:00
Jon Siwek
173c3784ab binpac: Prepend build dir to search path.
This avoids inclusion of conflicting superproject config.h.
2025-08-20 08:52:22 -07:00
Jon Siwek
6b1b6b178a binpac: configure now writes directly to CMakeCache.txt
The intermediate BuildOptions.cmake file is no longer needed.
2025-08-20 08:52:22 -07:00
Jon Siwek
8366dd6bcb binpac: Minor style changes. 2025-08-20 08:52:22 -07:00
Jon Siwek
32db4e4447 binpac: CMake module path adjustment.
To allow inclusion from a superproject.
2025-08-20 08:52:22 -07:00
Jon Siwek
a05eb8b150 binpac: Added configure script to wrap cmake functionality 2025-08-20 08:52:22 -07:00
Jon Siwek
92f936fdb8 binpac: Added headers to install target.
Also set some convenience variables that mimic what a FindBinPAC
module would set.  These could be used by a superproject that
wants to decide whether to use an existing BinPAC installation
or (re)build from source.
2025-08-20 08:52:22 -07:00
Jon Siwek
47c64d7fed binpac: Changes to add an install target. 2025-08-20 08:52:22 -07:00
Jon Siwek
4644605860 binpac: Added debug/release mode compiler flags and build summary output. 2025-08-20 08:52:22 -07:00
Jon Siwek
0944e3619c binpac: Added bison flag for verbose output. 2025-08-20 08:52:22 -07:00
Jon Siwek
9d7d6f8868 binpac: Two small changes:
- Moved find_package() calls up to top directory so failure can occur
  right away if any dependencies are missing
- Got rid of a bunch of header checks and preprocessor definitions that
  aren't ever used; not sure why I had them there in the first place
2025-08-20 08:52:22 -07:00
Jon Siwek
677ae82203 binpac: Changes to the config.h generation.
- Renamed VERSION preprocessor definition to not conflict with Bro's.
- Removed check for HAVE_CONFIG_H; config.h will always be generated in the
  binpac build directory, but if a parent directory has generated a config.h
  and added that to compiler include search paths via include_directories(),
  then that one should be used -- include_directories() appends paths by
  default and the parent CMakeLists.txt will have called it first.
2025-08-20 08:52:22 -07:00
Jon Siwek
73a67f0ae3 binpac: Removed unnecessary subdir for custom CMake modules. 2025-08-20 08:52:22 -07:00
Jon Siwek
65668d3ea6 binpac: Initial, working CMake build added. 2025-08-20 08:52:22 -07:00
Jon Siwek
c8665318e6 binpac: Initial import of Bro's binpac subdirectory from SVN r7088. 2025-08-20 08:52:22 -07:00
Evan Typanski
5a1c4fd5fe Merge remote-tracking branch 'origin/topic/etyp/coverity-attr'
* origin/topic/etyp/coverity-attr:
  Fix Coverity issue with new `Attributes` ctor
2025-08-20 11:38:43 -04:00
Evan Typanski
111583602e Fix Coverity issue with new Attributes ctor 2025-08-20 08:28:18 -04:00
Tim Wojtulewicz
8632d79775 Merge remote-tracking branch 'origin/topic/timw/ci-centos9-newer-python'
* origin/topic/timw/ci-centos9-newer-python:
  CI: Update CentOS 9 to Python 3.13
2025-08-19 15:08:45 -07:00
Arne Welzel
cf8a54b3df Merge remote-tracking branch 'origin/topic/awelzel/no-null-strings-in-threading-vals'
* origin/topic/awelzel/no-null-strings-in-threading-vals:
  logging/Manager: Also pass non-null vector and set
  logging/Manager: Non-null strings for empty strings
2025-08-19 20:27:46 +02:00
Arne Welzel
c44ce78591 logging/Manager: Also pass non-null vector and set
Primarily to align with strings and also to keep the plugin
API the same.
2025-08-19 20:04:08 +02:00
Arne Welzel
247931f2df logging/Manager: Non-null strings for empty strings
After #4724, empty strings would result in nullptrs being stored in the
threading::Value's string_val.data field instead of a valid pointer to
an empty strings. This upsets UBSAN's  nonnull check for memcpy()

    [01:29:45.807]   ../../src/SerializationFormat.cc:80:33: runtime error: null pointer passed as argument 2, which is declared to never be null
    [01:29:45.807]   /usr/include/string.h:44:28: note: nonnull attribute specified here
    [01:29:45.807]       #0 0x5b2e9c933a3f in zeek::detail::SerializationFormat::WriteData(void const*, unsigned long) /zeek/build/src/../../src/SerializationFormat.cc:80:5
    [01:29:45.807]       #1 0x5b2e9c935184 in zeek::detail::BinarySerializationFormat::Write(char const*, int, char const*) /zeek/build/src/../../src/SerializationFormat.cc:371:40

Continue to allocate the empty string for now as a fix.
2025-08-19 20:03:23 +02:00
Tim Wojtulewicz
963ee89528 CI: Update CentOS 9 to Python 3.13 2025-08-19 10:43:40 -07:00
Johanna Amann
8d89e035fd Merge remote-tracking branch 'origin/topic/johanna/ci_for_ubuntu_25_04_instead_of_ubuntu_24_10_because_that_one_is_at_eol'
* origin/topic/johanna/ci_for_ubuntu_25_04_instead_of_ubuntu_24_10_because_that_one_is_at_eol:
  CI: Ubuntu 24.10 is eol, add Ubuntu 25.04
2025-08-19 15:23:20 +01:00
Johanna Amann
721ff91ac0 CI: Ubuntu 24.10 is eol, add Ubuntu 25.04 2025-08-19 09:12:51 +01:00
zeek-bot
f6a369ec2b Update doc submodule [nomail] [skip ci] 2025-08-19 00:37:30 +00:00
Tim Wojtulewicz
7514f7c038 Merge remote-tracking branch 'origin/topic/timw/add-missing-cluster-serializer-header'
* origin/topic/timw/add-missing-cluster-serializer-header:
  Add a missing header for the broker cluster serializer
2025-08-18 14:59:50 -07:00
Tim Wojtulewicz
177a45f71c Merge remote-tracking branch 'origin/topic/bbannier/bump-spicy'
* origin/topic/bbannier/bump-spicy:
  Bump auxil/spicy to latest development snapshot
2025-08-18 14:47:14 -07:00
Tim Wojtulewicz
18b3303b54 Add a missing header for the broker cluster serializer 2025-08-18 14:00:24 -07:00
Evan Typanski
59e84e06f6 Merge remote-tracking branch 'origin/topic/etyp/fix-optional-attr-errors'
* origin/topic/etyp/fix-optional-attr-errors:
  Fix parameter attributes pretending to be records
  Only allow `&optional` in records
2025-08-18 14:49:56 -04:00
Tim Wojtulewicz
644d480afd Update docs submodule [nomail] [skip ci] 2025-08-18 10:03:50 -07:00
Tim Wojtulewicz
a4da8d3f7b Merge remote-tracking branch 'origin/topic/etyp/update-news-record-vec-deprecation'
* origin/topic/etyp/update-news-record-vec-deprecation:
  Add `record_type_to_vector` deprecation to NEWS
2025-08-18 09:40:50 -07:00
Evan Typanski
acd885b9f3 Add record_type_to_vector deprecation to NEWS 2025-08-18 11:58:51 -04:00
Arne Welzel
9b94e25e67 Merge remote-tracking branch 'origin/topic/awelzel/4754-follow-up'
* origin/topic/awelzel/4754-follow-up:
  cluster/serializer/broker: Drop unused include
  cluster/serializer/broker: fixup inconsistent param comment
2025-08-18 16:44:43 +02:00
Arne Welzel
8d0a942101 cluster/serializer/broker: Drop unused include 2025-08-18 14:52:21 +02:00
Arne Welzel
f4e7c4afe8 cluster/serializer/broker: fixup inconsistent param comment
Thanks clang-tidy.

References #4754 #4756
2025-08-18 14:51:40 +02:00
Arne Welzel
2c9015d247 Merge branch 'master' of https://github.com/blightzero/zeek
* 'master' of https://github.com/blightzero/zeek:
  Changed behavior of var-extraction-uri.zeek from policy/protocol/http to extract only the URI parameter names. Do not include the path in the first parameter name. Only extract uri vars if parameters actually exist.
2025-08-18 13:14:34 +02:00
Benjamin Bannier
e9203de4d8 Bump auxil/spicy to latest development snapshot 2025-08-18 12:59:25 +02:00
Arne Welzel
e04f725523 Merge remote-tracking branch 'amazing-pp/t/psql-login-no-role'
* amazing-pp/t/psql-login-no-role:
  Report PostgreSQL login success only after ReadyForQuery
2025-08-18 09:40:22 +02:00
Fupeng Zhao
e4e56789db
Report PostgreSQL login success only after ReadyForQuery
Previously, Zeek treated the receipt of `AuthenticationOk` as a
successful login. However, according to the PostgreSQL
Frontend/Backend Protocol, the startup phase is not complete until
the server sends `ReadyForQuery`. It is still possible for the server
to emit an `ErrorResponse` (e.g. ERRCODE_INVALID_AUTHORIZATION_SPECIFICATION)
after `AuthenticationOk` but before `ReadyForQuery`.

This change updates the PostgreSQL analyzer to defer reporting login
success until `ReadyForQuery` is observed. This prevents false
positives in cases where authentication succeeds but session startup
fails.
2025-08-18 10:59:44 +08:00
Arne Welzel
c0a863cba0 Merge remote-tracking branch 'origin/topic/vern/stmt-line-numbers'
* origin/topic/vern/stmt-line-numbers:
  maintenance updates for ZAM BiF-tracking
  fix line numbers associated with "if" and initialization statements
2025-08-17 17:29:09 +02:00
Arne Welzel
3d6a064ecc Merge remote-tracking branch 'origin/topic/awelzel/4754-double-wrapped-broker-data-records'
* origin/topic/awelzel/4754-double-wrapped-broker-data-records:
  cluster/serializer/broker: Do not special case Broker::Data anymore
  broker/Data: Support unwrapping Broker::Data records
2025-08-17 16:57:28 +02:00
Arne Welzel
f57a1263d4 cluster/serializer/broker: Do not special case Broker::Data anymore
The previous approach ignored the fact that nested / inner values might
also be Broker::Data values. I'm not super sure about the validity of
the test, because it's essentially demonstrating any-nesting, but
it's not leading to extra Broker::Data encoding.
2025-08-17 16:56:20 +02:00
Arne Welzel
9e70d8b8ad broker/Data: Support unwrapping Broker::Data records
Calling val_to_data() on a Broker::Data ends up wrapping the
Broker::Data record instead of using the contained broker::value
directly.

Seems this should be the default behavior and wonder if the flag
even makes sense, but for a 8.0 backport that seems more reasonable.
2025-08-17 16:56:20 +02:00
Vern Paxson
5b74b3d0ac maintenance updates for ZAM BiF-tracking 2025-08-16 14:10:17 -07:00
Vern Paxson
46d0b55417 fix line numbers associated with "if" and initialization statements 2025-08-16 14:09:32 -07:00
Tim Wojtulewicz
a3983cc939 Merge remote-tracking branch 'origin/revert-4746-topic/timw/move-submodules-to-main-repo'
* origin/revert-4746-topic/timw/move-submodules-to-main-repo:
  Revert "Move BinPAC, bifcl, af_packet, and gen_zam submodules into main zeek repo"
2025-08-15 15:21:12 -07:00
Tim Wojtulewicz
e64ec54172
Revert "Move BinPAC, bifcl, af_packet, and gen_zam submodules into main zeek repo" 2025-08-15 15:11:22 -07:00
Tim Wojtulewicz
a10a70994e Merge remote-tracking branch 'origin/topic/timw/move-submodules-to-main-repo'
* origin/topic/timw/move-submodules-to-main-repo:
  Fix some clang-tidy findings in generated BIF code
  Fix clang-tidy and pre-commit warnings for gen-zam code files
  Move gen-zam code into the main Zeek repository
  Move zeek-af_packet-plugin code into the main Zeek repository
  Move the bifcl code into the main Zeek repository
  Fix clang-tidy findings in the binpac lib code
  Add copyright headers to all of the binpac source files
  Move binpac code into the main Zeek repository
2025-08-15 14:02:23 -07:00
Tim Wojtulewicz
a1f5f0a40e Fix some clang-tidy findings in generated BIF code 2025-08-15 13:57:27 -07:00
Tim Wojtulewicz
f194b14727 Fix clang-tidy and pre-commit warnings for gen-zam code files 2025-08-15 13:57:27 -07:00
Tim Wojtulewicz
8f918dab47 Move gen-zam code into the main Zeek repository
This is based on commit 56a6db00b887c79d26f303676677cb490d1c296d from
the gen-zam repository.
2025-08-15 13:57:27 -07:00
Tim Wojtulewicz
5ccf64102b Move zeek-af_packet-plugin code into the main Zeek repository
This is based on commit b89a6f64123f778090d1dd6ec48e6b8e8906ea11 from
the zeek-af_packet-plugin repository.
2025-08-15 13:57:27 -07:00
Tim Wojtulewicz
68926faf47 Move the bifcl code into the main Zeek repository
This is based on commit 5947749f7850b075f11d6a2aaefe7dad4f63cb62f from
the bifcl repository.
2025-08-15 13:57:27 -07:00
Tim Wojtulewicz
cd1414ab69 Fix clang-tidy findings in the binpac lib code 2025-08-15 13:57:27 -07:00
Tim Wojtulewicz
4ae8bb856d Add copyright headers to all of the binpac source files 2025-08-15 13:57:27 -07:00
Tim Wojtulewicz
ff26835976 Move binpac code into the main Zeek repository
This is based on commit 48f75b5f6415fe9d597e3e991cec635b1bc400dc from
the binpac repository.
2025-08-15 13:57:27 -07:00
Evan Typanski
4445bc1daf Fix parameter attributes pretending to be records
Parameters relied on is_record for a couple of validations, but they are
not records and should not be treated as such. This way we can validate
&optional better.
2025-08-14 12:00:15 -04:00
Evan Typanski
4e5a56c5e0 Only allow &optional in records
There was some confusing behavior with &optional and locals, so this
should get rid of that by making it an error. However, there is a case
where function parameters are still allowed to have &optional - this is
because there are checks for &default in parameters as well.
2025-08-14 11:38:19 -04:00
zeek-bot
a2680d5eca Update doc submodule [nomail] [skip ci] 2025-08-14 00:25:34 +00:00
Benjamin Grap
fafc0212a5 Changed behavior of var-extraction-uri.zeek from policy/protocol/http to extract only the URI parameter names. Do not include the path in the first parameter name. Only extract uri vars if parameters actually exist. 2025-08-13 22:45:20 +02:00
Arne Welzel
63574b9fd4 Merge remote-tracking branch 'origin/topic/awelzel/docker-trixie'
* origin/topic/awelzel/docker-trixie:
  ci: Run zeekctl and builtin tasks with Debian 13, too
  ci: Prepend timestamps to output
  ci: Enable Spicy for arm_debian13
  ci: Add Debian 13.0 (trixie)
  docker: Bump to debian:trixie-slim
2025-08-13 21:21:16 +02:00
Arne Welzel
b346418856 ci: Run zeekctl and builtin tasks with Debian 13, too 2025-08-13 20:42:20 +02:00
Arne Welzel
80ecaf491c ci: Prepend timestamps to output 2025-08-13 20:37:19 +02:00
Arne Welzel
3e4c2c0288 ci: Enable Spicy for arm_debian13 2025-08-13 20:37:19 +02:00
Arne Welzel
ccd4a2935c ci: Add Debian 13.0 (trixie) 2025-08-13 20:37:16 +02:00
Arne Welzel
91afdd03b8 docker: Bump to debian:trixie-slim 2025-08-13 20:37:14 +02:00
Tim Wojtulewicz
75ba63eb3f Merge remote-tracking branch 'origin/topic/timw/limit-string-and-container-lengths-in-logs'
* origin/topic/timw/limit-string-and-container-lengths-in-logs:
  Add NEWS entry for field length limiting
  Tag truncated values with a flag, plus pack threading::Value better
  Remove length limiting on string fields for HTTP
  Make total_size counter a member in logging::Manager
  Remove using numeric_limits and just check for zero instead
  Expand the size of the log-size filters for x509
  Add options to filter at the stream level as well as globally
  Add a weird that gets emitted when strings/containers are over the limits
  Add metrics to track string and container fields limited by length
  Replace unused stream argument from RecordToLogRecord with WriterInfo
  Implement string- and container-length filtering at the log record level
2025-08-12 17:43:02 -07:00
Tim Wojtulewicz
a1c201fb8f Add NEWS entry for field length limiting 2025-08-12 17:31:29 -07:00
Tim Wojtulewicz
39814816af Tag truncated values with a flag, plus pack threading::Value better 2025-08-12 17:31:29 -07:00
Tim Wojtulewicz
c8818d76bd Remove length limiting on string fields for HTTP 2025-08-12 17:31:29 -07:00
Tim Wojtulewicz
29425688da Make total_size counter a member in logging::Manager 2025-08-12 17:31:29 -07:00
Tim Wojtulewicz
98a77b5f25 Remove using numeric_limits and just check for zero instead 2025-08-12 17:31:29 -07:00
Tim Wojtulewicz
8a4bc084f9 Expand the size of the log-size filters for x509 2025-08-12 17:31:28 -07:00
Tim Wojtulewicz
0ec2161b04 Add options to filter at the stream level as well as globally 2025-08-12 17:31:28 -07:00
Tim Wojtulewicz
339d46ae26 Add a weird that gets emitted when strings/containers are over the limits 2025-08-12 17:31:28 -07:00
Tim Wojtulewicz
837fde1a08 Add metrics to track string and container fields limited by length 2025-08-12 17:31:28 -07:00
Tim Wojtulewicz
cd74a4e138 Replace unused stream argument from RecordToLogRecord with WriterInfo
This also adds a WriterInfo argument to ValToLogVal and passes the one from
RecordToLogRecord into it.
2025-08-12 17:31:28 -07:00
Tim Wojtulewicz
e2e7ab28da Implement string- and container-length filtering at the log record level 2025-08-12 17:31:28 -07:00
Tim Wojtulewicz
cc59bfa5d8 Merge remote-tracking branch 'origin/topic/bbannier/bump-spicy'
* origin/topic/bbannier/bump-spicy:
  Bump pre-commit hooks
  Bump auxil/spicy to latest development snapshot
2025-08-12 12:38:51 -07:00
Tim Wojtulewicz
d9357b4204 Merge remote-tracking branch 'origin/topic/timw/remove-8.1-deprecations'
* origin/topic/timw/remove-8.1-deprecations:
  Pass DNS complete_flag along as a uint8_t instead of a String
  Update docs submodule with 8.1 deprecation removals
  Update zeekjs submodule with 8.1 deprecation fixes
  Remove deprecations tagged for v8.1
2025-08-12 11:01:29 -07:00
Tim Wojtulewicz
f1d69df165 Pass DNS complete_flag along as a uint8_t instead of a String 2025-08-12 11:00:40 -07:00
Tim Wojtulewicz
73c9a1f3d9 Update docs submodule with 8.1 deprecation removals 2025-08-12 11:00:40 -07:00
Tim Wojtulewicz
cdba3c601f Update zeekjs submodule with 8.1 deprecation fixes 2025-08-12 10:19:03 -07:00
Tim Wojtulewicz
d95affde4d Remove deprecations tagged for v8.1 2025-08-12 10:19:03 -07:00
Benjamin Bannier
62e742aa3b Bump pre-commit hooks 2025-08-12 17:49:42 +02:00
Benjamin Bannier
5465a1c312 Bump auxil/spicy to latest development snapshot 2025-08-12 17:47:40 +02:00
zeek-bot
e4dab3dded Update doc submodule [nomail] [skip ci] 2025-08-12 00:44:57 +00:00
Tim Wojtulewicz
76289a8022 Merge remote-tracking branch 'origin/topic/awelzel/4730-smb-read-response-data-offset'
* origin/topic/awelzel/4730-smb-read-response-data-offset:
  smb2/read: Parse only 1 byte for data_offset, ignore reserved1
2025-08-11 11:37:38 -07:00
Tim Wojtulewicz
dff534962e Merge remote-tracking branch 'origin/topic/timw/docs-generation-virtualenv'
* origin/topic/timw/docs-generation-virtualenv:
  Update docs submodule with new python packages
  Use virtualenv in docs generation/builds
2025-08-10 21:28:48 -07:00
Tim Wojtulewicz
302f6f2787 Update docs submodule with new python packages 2025-08-10 21:21:41 -07:00
Tim Wojtulewicz
ef055ddb7c Use virtualenv in docs generation/builds 2025-08-08 20:38:31 -07:00
Arne Welzel
b2a2ad7e10 smb2/read: Parse only 1 byte for data_offset, ignore reserved1
A user provided a SMB2 pcap with the reserved1 field of a ReadResponse
set to 1 instead of 0. This confused the padding computation due to
including this byte into the offset. Properly split data_offset and
reserved1 into individual byte fields.

Closes #4730
2025-08-08 16:12:20 +02:00
Arne Welzel
13f613eb1d Merge remote-tracking branch 'origin/topic/awelzel/4176-cluster-on-sub-unsub-hooks'
* origin/topic/awelzel/4176-cluster-on-sub-unsub-hooks:
  cluster: Add on_subscribe() and on_unsubscribe() hooks
2025-08-08 14:24:18 +02:00
Tim Wojtulewicz
54d67c3322 Merge remote-tracking branch 'origin/topic/timw/cleanup-warnings-from-plugin-btest-builds'
* origin/topic/timw/cleanup-warnings-from-plugin-btest-builds:
  Update zeek-aux to remove BRO_DIST from plugin skeleton
  cmake_minimum_required() should come before project()
2025-08-07 08:39:40 -07:00
Tim Wojtulewicz
162ecc022e Update zeek-aux to remove BRO_DIST from plugin skeleton 2025-08-07 08:39:08 -07:00
Arne Welzel
bd9130a69a Merge remote-tracking branch 'origin/topic/awelzel/tap-analyzer-take-four-thanks-clang-tidy'
* origin/topic/awelzel/tap-analyzer-take-four-thanks-clang-tidy:
  btest/tap-analyzer: Update existing test and add new one for UpdateConnVal()
  SessionAdapter: Keep tap_analyzers until destruction
  tcp,udp,icmp adapters: Move TapPacket() to earlier
  tcp,udp,icmp adapters: Fix UpdateConnVal() superclass call
2025-08-07 10:49:12 +02:00
Tim Wojtulewicz
3c535ec215 cmake_minimum_required() should come before project() 2025-08-06 12:10:41 -07:00
Arne Welzel
f98508bbb0 btest/tap-analyzer: Update existing test and add new one for UpdateConnVal()
This also changes the output of connection UIDs from the tap analyzer to be
prefixed with C for easier correlation with other logs.

Relates to #4337 #4725 #4734 #4737
2025-08-06 17:22:59 +02:00
Arne Welzel
bdff2935a4 SessionAdapter: Keep tap_analyzers until destruction
connection_state_remove() is invoked after Done(), so it's not a good
idea to remove the tap analyzers before in case they have up-to-date
information for the connection val.

Relates to #4337 #4725 #4734 #4737
2025-08-06 17:22:55 +02:00
Arne Welzel
ee93213d39 tcp,udp,icmp adapters: Move TapPacket() to earlier
Writing a test, the packet was tapped after protocol analysis at least
for TCP. Ensure tapping happens before. The adapter->Process() moving
after pkt->session made me a bit wondering if things are underspecified
here, but seems reasonable to set the session on pkt before adapter->Process().

Relates to #4337 #4725 #4734 #4737
2025-08-06 17:22:51 +02:00
Arne Welzel
9d7cfcbce3 tcp,udp,icmp adapters: Fix UpdateConnVal() superclass call
Now that SessionAdapter implements UpdateConnVal(), the individual
adapters need to call that instead of Analyzer::UpdateConnVal()

Thanks clang-tidy.

Relates to #4337 #4725 #4734 #4737
2025-08-06 17:22:44 +02:00
Johanna Amann
2f2f328a72 Merge remote-tracking branch 'origin/topic/johanna/analyzer-log-proto'
* origin/topic/johanna/analyzer-log-proto:
  Add proto to analyzer.log
2025-08-06 14:38:47 +01:00
Evan Typanski
22f77248f5 Merge remote-tracking branch 'origin/topic/etyp/fix-record-vec-type-conflict'
* origin/topic/etyp/fix-record-vec-type-conflict:
  Fix record coercion with compatible types
2025-08-06 09:10:19 -04:00
Arne Welzel
33b6869425 Merge remote-tracking branch 'origin/topic/awelzel/tap-analyzer-take-three'
* origin/topic/awelzel/tap-analyzer-take-three:
  TapAnalyzer: Fix docstring
  btest/plugins/tap-analyzer: Update baseline
2025-08-06 14:27:56 +02:00
Arne Welzel
ce7c394af1 TapAnalyzer: Fix docstring
Relates to #4337 #4725 #4734
2025-08-06 14:19:40 +02:00
Arne Welzel
ac776b0aad btest/plugins/tap-analyzer: Update baseline
Relates to #4337 #4725 #4734
2025-08-06 14:17:42 +02:00
Johanna Amann
82266b1e78 Add proto to analyzer.log
The analyzer.log file was missing the protocol field to distinguish
tcp/udp connections.
2025-08-06 11:34:57 +01:00
Arne Welzel
7dea987432 Merge remote-tracking branch 'origin/topic/awelzel/4337-tap-analyzer-follow-up'
* origin/topic/awelzel/4337-tap-analyzer-follow-up:
  TapAnalyzer: More verdict to action rename
2025-08-05 20:00:44 +02:00
Arne Welzel
b4925fbd16 TapAnalyzer: More verdict to action rename
Relates to #4725 #4337
2025-08-05 19:59:06 +02:00
Arne Welzel
1e05588e8e Merge remote-tracking branch 'origin/topic/awelzel/4337-tap-analyzer-sketch'
* origin/topic/awelzel/4337-tap-analyzer-sketch:
  IPBasedAnalyzer: Call TapPacket() when skipping
  SessionAdapter: Introduce TapAnalyzer for session adapter
2025-08-05 19:49:01 +02:00
Arne Welzel
4bc7f9532c IPBasedAnalyzer: Call TapPacket() when skipping
When skip_further_processing() is called, a TapAnalyzer should still see
the packets as skipped with SkipReason "skipping".
2025-08-05 19:47:04 +02:00
Arne Welzel
dc904b2216 SessionAdapter: Introduce TapAnalyzer for session adapter
This commit introduces a mechanism to attach light weight analyzers to
the root analyzer of sessions in order to tap into the packets delivered
to child analyzer.
2025-08-05 19:47:02 +02:00
Evan Typanski
006bef71b5 Fix record coercion with compatible types
Fixes #4722
2025-08-04 17:09:26 -04:00
Christian Kreibich
56325d1412 Merge branch 'topic/christian/zeek-8.0-news'
* topic/christian/zeek-8.0-news:
  Compile contributors for Zeek 8.0 in the NEWS file
2025-08-04 09:35:53 -07:00
Christian Kreibich
4fdd83f3f5 Compile contributors for Zeek 8.0 in the NEWS file 2025-08-04 09:32:58 -07:00
Tim Wojtulewicz
6afeeca090 Start of 8.1.0 development 2025-08-04 08:26:29 -07:00
Arne Welzel
4ecc62322e Merge remote-tracking branch 'origin/topic/awelzel/depend-on-libzmq'
* origin/topic/awelzel/depend-on-libzmq:
  ci/windows: No ZeroMQ cluster backend
  cluster/zeromq: Bail on missing ZeroMQ by default
2025-08-01 17:10:32 +02:00
Arne Welzel
3c2d01e19e Merge remote-tracking branch 'origin/topic/neverlord/std-span'
* origin/topic/neverlord/std-span:
  Remove zeek::Span and use std::span instead
2025-08-01 14:50:02 +02:00
Arne Welzel
1a87ebab72 cluster: Add on_subscribe() and on_unsubscribe() hooks
Closes #4176
2025-08-01 14:06:19 +02:00
Arne Welzel
7a68208ecf ci/windows: No ZeroMQ cluster backend
Doesn't seems there's libzmq available, so just skip building.
2025-08-01 10:17:13 +02:00
Arne Welzel
993502e0b6 cluster/zeromq: Bail on missing ZeroMQ by default 2025-08-01 09:46:06 +02:00
zeek-bot
aabb36abf7 Update doc submodule [nomail] [skip ci] 2025-08-01 00:28:48 +00:00
Tim Wojtulewicz
f2e155d7fa Merge remote-tracking branch 'origin/topic/timw/update-ct-ca-lists'
* origin/topic/timw/update-ct-ca-lists:
  Update CT/CA lists to versions from NSS 3.114
2025-07-31 14:32:21 -07:00
Tim Wojtulewicz
528f0d9766 Merge remote-tracking branch 'origin/topic/timw/update-submodules-ahead-of-8.0'
* origin/topic/timw/update-submodules-ahead-of-8.0:
  Updating submodule(s) [nomail]
2025-07-31 14:29:48 -07:00
Tim Wojtulewicz
1daead9edd Update CT/CA lists to versions from NSS 3.114 2025-07-31 11:34:23 -07:00
Tim Wojtulewicz
74a3fe5856 Updating submodule(s) [nomail] 2025-07-31 10:37:45 -07:00
Tim Wojtulewicz
b9a5a635bd Merge remote-tracking branch 'origin/topic/timw/clang-tidy-fix'
* origin/topic/timw/clang-tidy-fix:
  Fix use-after-move reported by clang-tidy
2025-07-31 10:34:58 -07:00
Tim Wojtulewicz
647da4f970 Fix use-after-move reported by clang-tidy
This was introduced by 9eb94ee151.
2025-07-31 09:55:43 -07:00
Johanna Amann
136bdb43fd Merge remote-tracking branch 'origin/topic/johanna/gh-4694'
* origin/topic/johanna/gh-4694:
  Add tests for the deprecated-dpd-log.zeek policy script
  Move c$service_violation to deprecated-dpd-log.zeek
2025-07-31 16:11:00 +01:00
Tim Wojtulewicz
3e0012ea30 Merge remote-tracking branch 'origin/topic/bbannier/bump-spicy'
* origin/topic/bbannier/bump-spicy:
  Bump `auxil/spicy` to latest development snapshot
2025-07-31 07:58:05 -07:00
Benjamin Bannier
c0ce3f19fb Bump auxil/spicy to latest development snapshot 2025-07-31 13:47:32 +02:00
zeek-bot
defc0c96d8 Update doc submodule [nomail] [skip ci] 2025-07-31 00:18:15 +00:00
Arne Welzel
10e7f14f78 Merge remote-tracking branch 'origin/topic/awelzel/defer-more-stuff'
* origin/topic/awelzel/defer-more-stuff:
  RecordType: Ensure &default fields are always re-initialized
  Attr: Deprecate using &default and &optional together on record fields
  RecordType: Allow deferring &default=vector(), set(), table() fields
2025-07-30 10:35:56 +02:00
Arne Welzel
9eb94ee151 RecordType: Ensure &default fields are always re-initialized
This started working partly after the deferral logic introduced with
Zeek 6.0 so this finishes it :-)
2025-07-30 10:26:06 +02:00
Arne Welzel
473723cc47 Attr: Deprecate using &default and &optional together on record fields
If &default implies re-initialization of the field, using them together
doesn't make much sense.
2025-07-30 10:26:06 +02:00
Arne Welzel
23181e4811 RecordType: Allow deferring &default=vector(), set(), table() fields 2025-07-30 10:26:06 +02:00
Arne Welzel
d7fbd49d9e Merge remote-tracking branch 'origin/topic/vern/zam-record-fields-fixes'
* origin/topic/vern/zam-record-fields-fixes:
  fixes for specialized ZAM operations needing to check whether record fields exist
2025-07-30 10:08:21 +02:00
Johanna Amann
a90969800c Add tests for the deprecated-dpd-log.zeek policy script
This re-adds baselines for the old dpd.log to check functionality until
its removal in 8.1
2025-07-30 07:58:36 +01:00
Johanna Amann
8de178d923 Move c$service_violation to deprecated-dpd-log.zeek
This moves c$service_violation to the deprecated-dpd-log policy script.

This is the only script in the distribution that uses the field, and it
is unlikely to be used externally. It is also responsible for a
significant amount of memory use by itself.

This also restores the field being populated, which was broken in
GH-4362
2025-07-30 07:58:36 +01:00
Vern Paxson
47bf6af6a5 fixes for specialized ZAM operations needing to check whether record fields exist 2025-07-30 08:36:04 +02:00
zeek-bot
86ab82c0df Update doc submodule [nomail] [skip ci] 2025-07-30 00:25:27 +00:00
Johanna Amann
a22b45c69e Merge remote-tracking branch 'origin/topic/johanna/gh-4202'
* origin/topic/johanna/gh-4202:
  Update NEWS for Conn::set_conn changes
  DNS-fuzzer: raise new_connection event
  Optimize Conn::set_conn to minimize operations
  Move Conn::set_conn() from connection_state_remove to new_connection
2025-07-29 21:01:51 +01:00
Johanna Amann
8de1357e52 Update NEWS for Conn::set_conn changes 2025-07-29 18:41:59 +01:00
Johanna Amann
5e74eefd88 DNS-fuzzer: raise new_connection event
The conn protocol scripts now assume that new_connection is run before
connection_state_remove. Update the DNS analyzer to raise the
new_connection event.
2025-07-29 18:41:59 +01:00
Arne Welzel
ab282e3637 Merge remote-tracking branch 'origin/topic/awelzel/cluster-event-out-of-detail'
* origin/topic/awelzel/cluster-event-out-of-detail:
  cluster::Event: Move implementation into cluster/Event.{h,cc}
  cluster: Move cluster::detail::Event to cluster::Event
2025-07-29 18:24:20 +02:00
Arne Welzel
40389603c2 cluster::Event: Move implementation into cluster/Event.{h,cc} 2025-07-29 18:13:59 +02:00
Arne Welzel
bda70067ec cluster: Move cluster::detail::Event to cluster::Event
This class is a parameter of virtual methods of the Backend API for users
to implement and also a parameter to the HookPublishEvent() API. Seems it
shouldn't be in detail and instead we should own it.

Alternatively, could mark the cluster APIs as not-stable-yet, but I
think we can move forward and make it non-detail for 8.0.
2025-07-29 18:13:59 +02:00
Tim Wojtulewicz
9f3a1a135f Merge remote-tracking branch 'origin/topic/timw/fix-fuzzer-conn-key-deprecation'
* origin/topic/timw/fix-fuzzer-conn-key-deprecation:
  Fix ConnKey deprecation warnings from generic fuzzer
2025-07-29 07:41:23 -07:00
Tim Wojtulewicz
743b9e27cc Merge remote-tracking branch 'origin/topic/timw/fix-irc-analyzer-event-types'
* origin/topic/timw/fix-irc-analyzer-event-types:
  Fix types passed to some of the IRC analyzer events
2025-07-29 07:19:36 -07:00
Tim Wojtulewicz
06ec03046d Merge remote-tracking branch 'origin/topic/timw/fix-ranges-debian-11-build-failure'
* origin/topic/timw/fix-ranges-debian-11-build-failure:
  Fix build failure with std::ranges on Debian 11
2025-07-29 07:19:11 -07:00
Arne Welzel
cd7836dda2 Merge remote-tracking branch 'origin/topic/awelzel/4431-zeromq-drop-policy-v2'
* origin/topic/awelzel/4431-zeromq-drop-policy-v2:
  cluster.bif: Improve Cluster::publish() docstring
  btest/cluster/zeromq: Add tests for overload behavior
  cluster/zeromq: Metric for msg errors
  cluster/zeromq: Drop events when overloaded
  cluster/zeromq: Comments and move lookups to InitPostScript()
  cluster/zeromq: Rework lambdas to member functions
  cluster/zeromq: Support local XPUB/XSUB hwm and buf configurability
  cluster/OnLoop: Support DontBlock and Force flags for queueing
  cluster/ThreadedBackend: Injectable OnLoopProcess instance
2025-07-29 11:38:49 +02:00
Arne Welzel
55ecd90928 cluster.bif: Improve Cluster::publish() docstring 2025-07-29 11:23:53 +02:00
Arne Welzel
c8307487d1 btest/cluster/zeromq: Add tests for overload behavior
The overload-drop.zeek and overload-no-drop.zeek tests have proxy,
worker-1 and worker-2 publish to the manager topic. For the drop
case, we verify that both, the senders, but also the manager drops
events. For the no-drop test, the HWMs are set such that all events
are buffered.

The overload-worker-proxy-topic*.zeek tests are similar, but instead
of publishing to the manager topic, proxy, worker-1 and worker-2 publish
to the proxy and worker topics to overload each other. This had
previously resulted in lockups and these tests verify that this doesn't
happen anymore.
2025-07-29 11:23:53 +02:00
Arne Welzel
d2bb86f8b4 cluster/zeromq: Metric for msg errors 2025-07-29 11:23:53 +02:00
Arne Welzel
073de9f5fd cluster/zeromq: Drop events when overloaded
When either the XPUB socket's hwm is reached, or the onloop queue is
full, drop the events. Users can set ths xpub_sndhwm and
onloop_queue_hwm to 0 to avoid these drops at the risk of unbounded
memory growth.
2025-07-29 11:23:53 +02:00
Arne Welzel
5de9296c77 cluster/zeromq: Comments and move lookups to InitPostScript() 2025-07-29 11:23:53 +02:00
Arne Welzel
85d5dda028 cluster/zeromq: Rework lambdas to member functions 2025-07-29 11:23:53 +02:00
Arne Welzel
5dc4586b70 cluster/zeromq: Support local XPUB/XSUB hwm and buf configurability 2025-07-29 11:23:53 +02:00
Arne Welzel
d79d4b1b2a cluster/OnLoop: Support DontBlock and Force flags for queueing
Also allow max_queue_size to be 0 for unlimited queueing.
2025-07-29 11:23:53 +02:00
Arne Welzel
12518e8256 Merge remote-tracking branch 'origin/topic/awelzel/expose-num-packets-unprocessed'
* origin/topic/awelzel/expose-num-packets-unprocessed:
  ConnStats: Expose num_packets_unprocessed
  packet_analysis/Manager: Rename GetUnprocessedCount() to PacketsUnprocessed()
2025-07-29 10:12:46 +02:00
Johanna Amann
83d5243cf6 Optimize Conn::set_conn to minimize operations
Now that Conn::set_conn is guaranteed to be called at the beginning and
at the end of the connection, we can skip re-setting the elements that
we know will not have changed. This prevents repeated lookups, e.g. to
check that addresses are in the local networks.

During `connection_state_remove`, only the duration, number of
packets, service, and history fields are updated.

local_orig and local_resp are updated when the connection is flipped. A
test was added for that purpose. It uses the already existing
http.zeek-image-post-1080-8000-x.pcap, which was slightly rewritten for
this, so that one side of the connection has IP addresses different from
127.0.0.1.

The existing history-flip test also was updated to have one side being
in a local-net, to check that the flipping of local_orig and local_resp
works correctly at the beginning of a connection.
2025-07-29 09:11:57 +01:00
Johanna Amann
3e4f67e67c Move Conn::set_conn() from connection_state_remove to new_connection
c$conn is often needed for connection events, but it being established
in connection_state_removed can be a problem because event handlers have
to remember to call Con::set_conn().

This commit moves to call Conn::set_conn() in new_connection.

Addresses GH-4202

update logs
2025-07-29 09:11:57 +01:00
Arne Welzel
96f9cc73c3 Merge remote-tracking branch 'origin/topic/awelzel/spicy-format-for-8.0'
* origin/topic/awelzel/spicy-format-for-8.0:
  Update .git-blame-ignore-revs
  analyzer/protocol: Reformat with spicy-format
  pre-commit-config: Bump spicy-format to 0.26.0
2025-07-29 10:05:33 +02:00
Arne Welzel
e535f4bab1 Update .git-blame-ignore-revs 2025-07-29 10:04:14 +02:00
Arne Welzel
d70bcd07b9 analyzer/protocol: Reformat with spicy-format 2025-07-29 10:01:32 +02:00
Arne Welzel
aa2afa3e9b pre-commit-config: Bump spicy-format to 0.26.0 2025-07-29 09:59:50 +02:00
Dominik Charousset
690a2a1122 Remove zeek::Span and use std::span instead 2025-07-29 07:51:29 +02:00
Tim Wojtulewicz
d8e93f1b2d Fix types passed to some of the IRC analyzer events 2025-07-28 17:43:08 -07:00
Tim Wojtulewicz
fe689ecf60 Fix ConnKey deprecation warnings from generic fuzzer 2025-07-28 17:29:16 -07:00
zeek-bot
941ea4282b Update doc submodule [nomail] [skip ci] 2025-07-29 00:28:44 +00:00
Tim Wojtulewicz
6b4b3b41cd Fix build failure with std::ranges on Debian 11 2025-07-28 15:58:46 -07:00
Tim Wojtulewicz
73d56407b1 Merge remote-tracking branch 'origin/topic/awelzel/3935-dce-rpc-named-pipe-docs'
* origin/topic/awelzel/3935-dce-rpc-named-pipe-docs:
  dce-rpc: Make named_pipe filed docs extensive
2025-07-28 14:18:23 -07:00
Tim Wojtulewicz
22fc57a90a Merge remote-tracking branch 'origin/topic/johanna/gh-4656'
* origin/topic/johanna/gh-4656:
  Fix parsing of EDNS rcode
2025-07-28 14:16:24 -07:00
Tim Wojtulewicz
8063be111a Merge remote-tracking branch 'origin/topic/timw/more-irc-coverage'
* origin/topic/timw/more-irc-coverage:
  Expand coverage of IRC analyzer with more commands
  Add support for ircv3 tags
2025-07-28 14:15:47 -07:00
Tim Wojtulewicz
e2a702f1ab Expand coverage of IRC analyzer with more commands 2025-07-28 14:13:55 -07:00
Tim Wojtulewicz
a33f100880 Add support for ircv3 tags
This also replaces the irc-dcc-send.trace file in our pcap library with
a cleaner one that includes ircv3 tags.
2025-07-28 14:06:33 -07:00
Tim Wojtulewicz
8aeaed69c5 Merge remote-tracking branch 'origin/topic/timw/lazy-allocate-id-option-handlers'
* origin/topic/timw/lazy-allocate-id-option-handlers:
  Move ID::type in structure to fill memory padding
  Use sorted forward_list instead of multimap for ID option change handlers
2025-07-28 13:57:26 -07:00
Tim Wojtulewicz
47553c79ec Move ID::type in structure to fill memory padding 2025-07-28 13:41:51 -07:00
Tim Wojtulewicz
035b4a4a8e Use sorted forward_list instead of multimap for ID option change handlers 2025-07-28 13:41:51 -07:00
Tim Wojtulewicz
020dd1a848 Merge remote-tracking branch 'origin/topic/timw/cpp20-modernization'
* origin/topic/timw/cpp20-modernization:
  Remove intermediate cipher vectors in ssl-analyzer.pac
  Reduce the size of Func::Body quite a bit with some extra packing
  Switch to using std::ranges algorithms
  Enable modernize-std-numbers clang-tidy checker, fix findings
  Switch to using c++20 constraints instead of std::enable_if
2025-07-28 13:13:02 -07:00
Tim Wojtulewicz
d021845079 Remove intermediate cipher vectors in ssl-analyzer.pac 2025-07-28 13:03:25 -07:00
Tim Wojtulewicz
2cfa5e79fa Reduce the size of Func::Body quite a bit with some extra packing 2025-07-28 13:03:25 -07:00
Tim Wojtulewicz
72c79006ac Switch to using std::ranges algorithms 2025-07-28 13:03:25 -07:00
Tim Wojtulewicz
b4cbda4e02 Enable modernize-std-numbers clang-tidy checker, fix findings 2025-07-28 13:03:25 -07:00
Tim Wojtulewicz
414728cc71 Switch to using c++20 constraints instead of std::enable_if 2025-07-28 13:03:25 -07:00
Evan Typanski
c00314746a Merge branch 'topic/etyp/deprecate-record-ty-to-vec'
* topic/etyp/deprecate-record-ty-to-vec:
  Deprecate `record_type_to_vector`
2025-07-28 12:25:44 -04:00
Evan Typanski
7f93ff5ecd Deprecate record_type_to_vector
After #4682, record_fields is ordered so this is redundant. Furthermore,
it is incorrectly documented, as it says nested records are flattened.
2025-07-28 11:11:33 -04:00
Arne Welzel
120f061bcd ConnStats: Expose num_packets_unprocessed
Not sure it's the best place to put, but we don't have packet analysis stats
bif and also num_packets is already there, so seems reasonable to put the
num_packets_unprocessed into
2025-07-28 14:10:53 +02:00
Arne Welzel
fa476746bf packet_analysis/Manager: Rename GetUnprocessedCount() to PacketsUnprocessed()
Mostly to align with PacketsProcessed()
2025-07-28 13:41:32 +02:00
zeek-bot
7894d88461 Update doc submodule [nomail] [skip ci] 2025-07-26 00:28:44 +00:00
Tim Wojtulewicz
a09b4108c8 Merge remote-tracking branch 'origin/topic/timw/odesc-size-t'
* origin/topic/timw/odesc-size-t:
  Use size_t for byte sizes in SerializationFormat
  Add ODesc::Size() that returns size_t, deprecate ODesc::Len()
2025-07-25 09:14:01 -07:00
Tim Wojtulewicz
e1342ff72d Use size_t for byte sizes in SerializationFormat 2025-07-25 09:13:10 -07:00
Tim Wojtulewicz
7a5209855f Add ODesc::Size() that returns size_t, deprecate ODesc::Len() 2025-07-25 09:13:10 -07:00
Arne Welzel
3f810e038b dce-rpc: Make named_pipe filed docs extensive
Closes #3935
2025-07-25 11:12:38 +02:00
Arne Welzel
6e2a18ce4f Merge remote-tracking branch 'origin/topic/awelzel/conn-id-ctx-singleton'
* origin/topic/awelzel/conn-id-ctx-singleton:
  RecordType: Allow field init deferral of deferrable record constructors
  Conn: Use conn_id_ctx singleton
  Conn: Add InitPostScript() and conn_id_ctx singleton
  ID: Add conn_id_ctx
2025-07-25 10:59:07 +02:00
Arne Welzel
2cb26eda51 RecordType: Allow field init deferral of deferrable record constructors
The ctx: conn_id_ctx &default=conn_id_ctx() field was not optimized
as deferrable even though by default its an empty record and so deferring
initialization seems safe. Open-code the special record constructor
expression case in ExprFieldInit so that the ctx field is not default
initialized at record construction anymore. I am wondering a bit if the
same applies to &default=set() and &default=table().
2025-07-25 10:55:51 +02:00
zeek-bot
8a6aca6175 Update doc submodule [nomail] [skip ci] 2025-07-25 00:19:51 +00:00
Tim Wojtulewicz
90da71ef16 Merge remote-tracking branch 'origin/topic/timw/update-broker'
* origin/topic/timw/update-broker:
  Update broker submodule to pull in clang 20 fix [nomail]
2025-07-24 12:46:27 -07:00
Tim Wojtulewicz
73f2cadd88 Update broker submodule to pull in clang 20 fix [nomail] 2025-07-24 10:43:57 -07:00
Tim Wojtulewicz
9c845d9979 Merge remote-tracking branch 'origin/topic/timw/pid-start-time-metric'
* origin/topic/timw/pid-start-time-metric:
  Add process_start_time_seconds and process_pid metrics
2025-07-24 10:39:52 -07:00
Tim Wojtulewicz
d5db359772 Add process_start_time_seconds and process_pid metrics 2025-07-24 10:39:14 -07:00
Arne Welzel
906cec9adb Conn: Use conn_id_ctx singleton 2025-07-24 17:35:07 +02:00
Arne Welzel
eba6355b84 Conn: Add InitPostScript() and conn_id_ctx singleton 2025-07-24 17:28:31 +02:00
Arne Welzel
a2922cdde9 ID: Add conn_id_ctx
Seemed a bit unfortunate to use id::connection and id::conn_id, but
then do something different for conn_id_ctx.
2025-07-24 17:27:51 +02:00
Tim Wojtulewicz
d12b381e3e Merge remote-tracking branch 'origin/topic/timw/no-weekly-tasks-on-master-pushes'
* origin/topic/timw/no-weekly-tasks-on-master-pushes:
  CI: Only run weekly tasks as part of cron
2025-07-24 08:01:07 -07:00
Johanna Amann
383dce9343 Fix parsing of EDNS rcode
The EDNS rcode was incorrectly calculated. The extended rcode is formed
by taking the upper 8 bits of the extended rcode field, plus the lower 4
bits of the existing rcode.

This also adds a new trace with an extended rcode, and a testcase
parsing it.

Reported by dwhitemv25.

Fixes GH-4656
2025-07-24 14:57:00 +01:00
Arne Welzel
e231efac0b Merge remote-tracking branch 'origin/topic/awelzel/4645-icmp-conns-inconsistent'
* origin/topic/awelzel/4645-icmp-conns-inconsistent:
  conn_key/fivetuple: Handle one-way ICMP conns in DoConnKeyFromVal()
2025-07-24 09:49:07 +02:00
Arne Welzel
785bb2ee13 conn_key/fivetuple: Handle one-way ICMP conns in DoConnKeyFromVal()
When a conn_id represents a ICMP "connection", we need to determine the
is_one_way flag for InitTuple() in order to skip any flipping of address
and ports for one-way ICMP connections.

Fixes #4645
2025-07-24 09:48:33 +02:00
Johanna Amann
4399f171ae Merge remote-tracking branch 'origin/topic/johanna/pppoe-session-id-logging'
* origin/topic/johanna/pppoe-session-id-logging:
  Update external tests for pppoe-session-id conn.log changes
  PPPoE: add session id logging
2025-07-24 07:57:18 +01:00
zeek-bot
106831bc62 Update doc submodule [nomail] [skip ci] 2025-07-24 00:29:42 +00:00
Tim Wojtulewicz
acdf8f4d4d Merge remote-tracking branch 'origin/topic/timw/coverity-fixes'
* origin/topic/timw/coverity-fixes:
  Fix a few other minor issues reported by Coverity
  Add a few extra null checks, plus a missing initialization that led to a bad null check
  Fix some integer overflow issues reported by Coverity
  Ignore a couple of known-unused results reported by Coverity
  Fix some bit-shifting overflow/UB issues reported by Coverity
  Reset the value of a status variable in SQLite backend before using it in a loop
  Fix a potential memory leak reported by Coverity
  Avoid some string copies in IRC analyzer
  Add some additional std::moves reported by Coverity
  Fix an unsigned integer comparison reported by Coverity
  Fix uninitialized class member Coverity findings
  Handle uncaught exception during setup
  Update gen-zam submodule for Coverity findings
2025-07-23 15:26:29 -07:00
Tim Wojtulewicz
64bca5ce4c Fix a few other minor issues reported by Coverity 2025-07-23 15:17:53 -07:00
Tim Wojtulewicz
d22810e476 Add a few extra null checks, plus a missing initialization that led to a bad null check 2025-07-23 15:17:53 -07:00
Tim Wojtulewicz
2e5db823ef Fix some integer overflow issues reported by Coverity 2025-07-23 15:17:53 -07:00
Tim Wojtulewicz
2da3b3a2a6 Ignore a couple of known-unused results reported by Coverity 2025-07-23 15:17:53 -07:00
Tim Wojtulewicz
d4cb3c8225 Fix some bit-shifting overflow/UB issues reported by Coverity 2025-07-23 15:17:53 -07:00
Tim Wojtulewicz
22e78c3c24 Reset the value of a status variable in SQLite backend before using it in a loop 2025-07-23 15:17:53 -07:00
Tim Wojtulewicz
0b3b5e2ef2 Fix a potential memory leak reported by Coverity 2025-07-23 15:17:53 -07:00
Tim Wojtulewicz
dea44003a1 Avoid some string copies in IRC analyzer 2025-07-23 15:17:53 -07:00
Tim Wojtulewicz
205c72d26f Add some additional std::moves reported by Coverity 2025-07-23 15:17:53 -07:00
Tim Wojtulewicz
2ce26f1be0 Fix an unsigned integer comparison reported by Coverity 2025-07-23 15:17:53 -07:00
Tim Wojtulewicz
4c58fb26c4 Fix uninitialized class member Coverity findings 2025-07-23 15:17:53 -07:00
Tim Wojtulewicz
923ffbf25a Handle uncaught exception during setup 2025-07-23 15:17:53 -07:00
Tim Wojtulewicz
382dfca7a8 Update gen-zam submodule for Coverity findings 2025-07-23 15:17:53 -07:00
Tim Wojtulewicz
ca3b670d0f Merge remote-tracking branch 'origin/topic/timw/storage-forced-sync'
* origin/topic/timw/storage-forced-sync:
  Fix swapped storage metrics names
  Add flag to force synchronous mode when calling storage script-land functions
2025-07-23 14:03:56 -07:00
Tim Wojtulewicz
146837fe73 Fix swapped storage metrics names 2025-07-23 13:14:46 -07:00
Tim Wojtulewicz
7e3ed2010d Add flag to force synchronous mode when calling storage script-land functions 2025-07-23 13:14:34 -07:00
Tim Wojtulewicz
7b858cf270 CI: Only run weekly tasks as part of cron 2025-07-23 12:15:10 -07:00
Arne Welzel
ee5ffdf42c Merge remote-tracking branch 'origin/topic/awelzel/control-switch-to-cluster'
* origin/topic/awelzel/control-switch-to-cluster:
  NEWS: ZeekControl, ZeroMQ and WebSocket
  Update zeekctl module for ClusterBackend and UseWebSocket
  control: Use Cluster::publish() for replying
2025-07-23 19:31:45 +02:00
Tim Wojtulewicz
f5500a718f Merge remote-tracking branch 'origin/topic/timw/clang-tidy-bif-code'
* origin/topic/timw/clang-tidy-bif-code:
  Fix clang-tidy findings in embedded C++ from bif files
2025-07-23 10:20:26 -07:00
Tim Wojtulewicz
3b6a27d0a3 Fix clang-tidy findings in embedded C++ from bif files 2025-07-23 10:19:32 -07:00
Tim Wojtulewicz
83c914ce2d Merge remote-tracking branch 'origin/topic/timw/ci-weekly-compiler-task'
* origin/topic/timw/ci-weekly-compiler-task:
  CI: Add weekly task for running builds with newest compilers
2025-07-23 08:21:31 -07:00
Tim Wojtulewicz
2e612fc493 Merge remote-tracking branch 'origin/topic/timw/commit-info-for-plugin-ci-build'
* origin/topic/timw/commit-info-for-plugin-ci-build:
  Output more information when cloning repos for include_plugins CI task
2025-07-23 08:20:43 -07:00
Johanna Amann
9ab7b768c6 Update external tests for pppoe-session-id conn.log changes 2025-07-23 14:09:17 +01:00
Johanna Amann
e5a434c392 PPPoE: add session id logging
This adds a new PacketAnalyzer::PPPoE::session_id bif, which extracts
the PPPoE session ID from the current packet.

Furthermore, a new policy script is added which adds the pppoe session
id to the connection log.

Related to GH-4602
2025-07-23 13:43:45 +01:00
Arne Welzel
84cbd3784f Merge remote-tracking branch 'origin/topic/awelzel/make-record-fields-ordered'
* origin/topic/awelzel/make-record-fields-ordered:
  Type/RecordType: Make table returned by GetRecordFieldsVal() ordered
2025-07-23 13:38:05 +02:00
Arne Welzel
24faa5722f NEWS: ZeekControl, ZeroMQ and WebSocket 2025-07-23 13:31:11 +02:00
Arne Welzel
7131be9fa5 Update zeekctl module for ClusterBackend and UseWebSocket 2025-07-23 13:31:08 +02:00
Arne Welzel
3f2fe6fc3d control: Use Cluster::publish() for replying
Switching to ZeroMQ as cluster backend and dabbling with zeekctl
and WebSocket, replies didn't arrive due to the usage of
Broker::publish() rather than Cluster::publish(). Additionally,
add the node name to the topic on which we reply so that the
receiver can figure out which node sent the reply. It could've
been a separate event parameter, but the topic appears just fine.
2025-07-23 11:59:32 +02:00
zeek-bot
55cdb707e9 Update doc submodule [nomail] [skip ci] 2025-07-23 00:29:23 +00:00
Tim Wojtulewicz
48610bef41 CI: Add weekly task for running builds with newest compilers 2025-07-22 14:27:22 -07:00
Tim Wojtulewicz
07a1c6b699 Merge remote-tracking branch 'origin/topic/timw/update-af-packet'
* origin/topic/timw/update-af-packet:
  Update zeek-af_packet-plugin submodule to fix initialization [nomail]
2025-07-22 11:40:27 -07:00
Tim Wojtulewicz
b0d1688fe1 Update zeek-af_packet-plugin submodule to fix initialization [nomail] 2025-07-22 10:24:29 -07:00
Tim Wojtulewicz
ed81e251dc Merge remote-tracking branch 'origin/topic/timw/update-broker'
* origin/topic/timw/update-broker:
  Update broker submodule [nomail]
2025-07-22 08:05:22 -07:00
Tim Wojtulewicz
94b026ee47 Update zeek-af_packet-plugin submodule [nomail] 2025-07-22 08:04:33 -07:00
Arne Welzel
9f3a3b423f Type/RecordType: Make table returned by GetRecordFieldsVal() ordered
Seems only reasonable to provide that guarantee as pointed out in #4674.
2025-07-22 16:58:40 +02:00
Tim Wojtulewicz
f9dbd55599 Update broker submodule [nomail] 2025-07-21 15:50:51 -07:00
Arne Welzel
b4d2af23dd cluster/ThreadedBackend: Injectable OnLoopProcess instance
This allows injecting a custom onloop process to configure the
max_queue_size at instantiation time. Also allow access to the
instance directly and deprecate the QueueForProcessing() helper
2025-07-21 21:36:33 +02:00
Tim Wojtulewicz
e458da944f Return weird if a log line is over a configurable size limit 2025-07-21 09:14:52 -07:00
zeek-bot
db018253fe Update doc submodule [nomail] [skip ci] 2025-07-19 00:21:36 +00:00
Tim Wojtulewicz
cb2e193452 Merge remote-tracking branch 'origin/topic/timw/storage-metrics'
* origin/topic/timw/storage-metrics:
  Add SQLite page_count and file_size metrics
  Add btests to cover storage metrics
  Add storage metrics for operations, expirations, data transferred
  Fix ordering of telemtry metrics when running under test
  Make RunPragma take an optional value parser to return data
  Make SQLite::Step take a callback function for parsing result data
2025-07-18 14:28:46 -07:00
Tim Wojtulewicz
d0a6d84237 Add SQLite page_count and file_size metrics 2025-07-18 14:28:04 -07:00
Tim Wojtulewicz
f73ac7089f Add btests to cover storage metrics 2025-07-18 14:28:04 -07:00
Tim Wojtulewicz
a0ffe7f748 Add storage metrics for operations, expirations, data transferred 2025-07-18 14:28:04 -07:00
Tim Wojtulewicz
cab0883254 Fix ordering of telemtry metrics when running under test 2025-07-18 14:28:04 -07:00
Tim Wojtulewicz
365e6cbc9e Make RunPragma take an optional value parser to return data 2025-07-18 14:28:04 -07:00
Tim Wojtulewicz
b44f7ca9ad Make SQLite::Step take a callback function for parsing result data 2025-07-18 14:28:04 -07:00
Benjamin Bannier
784c4537e6 Merge branch 'topic/bbannier/bump-spicy' 2025-07-18 13:32:45 +02:00
Benjamin Bannier
e470c3241d Bump auxil/spicy to latest development snapshot 2025-07-18 11:07:37 +02:00
Tim Wojtulewicz
1dc7d88efd Merge remote-tracking branch 'origin/topic/timw/update-libkqueue'
* origin/topic/timw/update-libkqueue:
  Update libkqueue submodule [nomail]
2025-07-17 12:59:10 -07:00
Tim Wojtulewicz
5773283e10 Update libkqueue submodule [nomail] 2025-07-17 10:38:05 -07:00
Tim Wojtulewicz
beb70e27b5 Merge remote-tracking branch 'origin/topic/timw/cpp20-starts-and-ends-with'
* origin/topic/timw/cpp20-starts-and-ends-with:
  Use std::string/string_view versions of starts_with/ends_with where appropriate
2025-07-17 09:09:40 -07:00
Tim Wojtulewicz
a1d121e5aa Use std::string/string_view versions of starts_with/ends_with where appropriate
The util:: versions of these methods remain as a thin wrapper around them so
they can be used with const char* arguments. Otherwise callers have to manually
make string_view objects from the input.
s Please enter the commit message for your changes. Lines starting
2025-07-17 09:08:54 -07:00
Tim Wojtulewicz
6218643347 Merge remote-tracking branch 'origin/topic/timw/hilti-nolint-enum'
* origin/topic/timw/hilti-nolint-enum:
  Add nolint for enum size for HILTI_RT_ENUM use
2025-07-17 08:40:58 -07:00
zeek-bot
79639499fb Update doc submodule [nomail] [skip ci] 2025-07-17 00:27:51 +00:00
Tim Wojtulewicz
49a7f64460 Add nolint for enum size for HILTI_RT_ENUM use 2025-07-16 09:49:57 -07:00
Robin Sommer
c94ce6b946
Merge remote-tracking branch 'origin/topic/robin/gh-4481-test-analyzer'
* origin/topic/robin/gh-4481-test-analyzer:
  Spicy: Fix missing include.
  Bump Spicy.
  Spicy: Add functions to check if Zeek provides an analyzer of a given name.
2025-07-16 17:47:08 +02:00
Arne Welzel
8f4470926f Merge remote-tracking branch 'origin/topic/awelzel/eml-extraction-v3'
* origin/topic/awelzel/eml-extraction-v3:
  NEWS: Add entry about SMTP::enable_rfc822_msg_file_analysis
  btest: Add tests for full email extraction
  SMTP: Adapt scripts for enable_rfc822_msg_file_analysis
  SMTP: Add missing Undelivered() call
  SMTP: Add enable_rfc822_msg_file_analysis
2025-07-16 12:38:29 +02:00
Arne Welzel
c69ed1adf7 NEWS: Add entry about SMTP::enable_rfc822_msg_file_analysis 2025-07-16 12:37:33 +02:00
cccs-jsjm
1b3b3892b5 btest: Add tests for full email extraction 2025-07-16 12:37:33 +02:00
Arne Welzel
4c60dfd6c5 SMTP: Adapt scripts for enable_rfc822_msg_file_analysis
Specifically, set a MIME part's parent_id to the rfc822_msg_fuid if it
is set and take into account the current rfc822_msg_fuid for describe_file()
to avoid fuid collisions of the top-level RFC822 message and the first
MIME part.
2025-07-16 12:37:33 +02:00
Arne Welzel
a42875d033 SMTP: Add missing Undelivered() call
Not that it's implement, but for consistency.
2025-07-16 11:27:00 +02:00
Arne Welzel
6f05fbf2ce SMTP: Add enable_rfc822_msg_file_analysis
Enabling this option will instantiate a new fa_file instance for every
top-level RFC 822 message in an SMTP transaction.
2025-07-16 11:26:49 +02:00
Robin Sommer
a840613441
Spicy: Fix missing include. 2025-07-16 09:34:22 +02:00
Robin Sommer
7575c35c68
Bump Spicy. 2025-07-16 09:34:22 +02:00
Christian Kreibich
fba319857b Merge branch 'topic/bbannier/named-ctr'
* topic/bbannier/named-ctr:
  Prefer explicit construction to coercion in record initialization
2025-07-15 17:38:04 -07:00
Christian Kreibich
907ddce581 Merge branch 'topic/christian/fix-debuglogger-stdsort'
* topic/christian/fix-debuglogger-stdsort:
  Add missing header to allow std::sort() on GCC 15.1
2025-07-15 17:37:02 -07:00
Christian Kreibich
1dc7d1f124 Add missing header to allow std::sort() on GCC 15.1 2025-07-15 16:38:52 -07:00
Tim Wojtulewicz
42a2a19f28 Merge remote-tracking branch 'origin/topic/bbannier/sqlite-no-stale-entries'
* origin/topic/bbannier/sqlite-no-stale-entries:
  Make PUT on SQLite backend implicitly overwrite expired entries
  Prevent SQLite storage backend from serving expired entries
2025-07-15 15:51:54 -07:00
Benjamin Bannier
16c40f4f3a Make PUT on SQLite backend implicitly overwrite expired entries
The backend does not serve expired but still present entries so to a
user they do not exist. When they put new data over such an entry their
expecation is that the value is overwritten, even if not explicitly
requested.
2025-07-15 15:50:43 -07:00
Benjamin Bannier
2f67539c0f Prevent SQLite storage backend from serving expired entries
The SQLite storage backend implements expiration by hand and garbage
collection is done in `DoExpire`. This previously relied exclusively on
gets not running within `Storage::expire_interval` of the put, otherwise
we would potentially serve expired entries.

With this patch we explictly check that entries are not expired before
serving them so that the SQLite backend should never serve expired
entries.
2025-07-15 15:47:31 -07:00
Tim Wojtulewicz
abac0b577c Merge remote-tracking branch 'origin/topic/timw/update-submodules'
* origin/topic/timw/update-submodules:
  Update package-manager submodule [nomail]
  Update binpac submodule [nomail]
2025-07-15 08:58:11 -07:00
Robin Sommer
7dc5a70dc8
Spicy: Add functions to check if Zeek provides an analyzer of a given name.
```
## Checks if there is a Zeek analyzer of a given name.
##
## analyzer: the Zeek-side name of the analyzer to check for
## if_enabled: if true, only checks for analyzers that are enabled
##
## Returns the type of the analyzer if it exists, or ``Undef`` if it does not.
public function has_analyzer(analyzer: string, if_enabled: bool = True): bool &cxxname="zeek::spicy::rt::has_analyzer";

## Differentiates between the types of analyzers Zeek provides.
public type AnalyzerType = enum { Protocol, File, Packet, };

## Returns the type of a Zeek analyzer of a given name.
##
## analyzer: the Zeek-side name of the analyzer to check
## if_enabled: if true, only checks for analyzers that are enabled
##
## Returns the type of the analyzer if it exists, or ``Undef`` if it does not.
public function analyzer_type(analyzer: string, if_enabled: bool = True): AnalyzerType &cxxname="zeek::spicy::rt::analyzer_type";

```

Closes #4481.
2025-07-15 14:22:27 +02:00
Tim Wojtulewicz
e55c37ae8b Update package-manager submodule [nomail] 2025-07-14 21:40:21 -07:00
Tim Wojtulewicz
4a7c681b99 Update binpac submodule [nomail] 2025-07-14 21:40:21 -07:00
zeek-bot
e0e62e28f6 Update doc submodule [nomail] [skip ci] 2025-07-15 00:30:17 +00:00
Tim Wojtulewicz
dc5d7c3fc9 Merge remote-tracking branch 'origin/topic/timw/std-filesystem'
* origin/topic/timw/std-filesystem:
  Fix some missing #includes resulting from removal of ghc::filesystem
  Remove ghc::filesystem submodule, switch to std::filesystem
2025-07-14 13:09:24 -07:00
Tim Wojtulewicz
55b427142d Merge remote-tracking branch 'origin/topic/johanna/connection-syn-packet-doc'
* origin/topic/johanna/connection-syn-packet-doc:
  Documentation: connection_SYN_packet
2025-07-14 11:26:13 -07:00
Johanna Amann
2fc75009f4 Documentation: connection_SYN_packet
Slightly clarify documentation related to the connection_SYN_packet
event.
2025-07-14 11:25:49 -07:00
Tim Wojtulewicz
1f87382302 Fix some missing #includes resulting from removal of ghc::filesystem 2025-07-14 11:23:54 -07:00
Tim Wojtulewicz
770bc0491e Remove ghc::filesystem submodule, switch to std::filesystem 2025-07-14 11:23:54 -07:00
Tim Wojtulewicz
2414e54195 Output more information when cloning repos for include_plugins CI task 2025-07-14 11:19:19 -07:00
Tim Wojtulewicz
a843521e78 Merge remote-tracking branch 'origin/topic/timw/cpp20-clang-tidy-updates'
* origin/topic/timw/cpp20-clang-tidy-updates:
  Use ranges::reverse_view to fix a few reverse ranged-for loops
  Disable a few new modernize clang-tidy checkers, enabled by C++20
2025-07-14 09:31:31 -07:00
Tim Wojtulewicz
8640f92b1f Use ranges::reverse_view to fix a few reverse ranged-for loops 2025-07-14 09:30:54 -07:00
Tim Wojtulewicz
832f67e91c Disable a few new modernize clang-tidy checkers, enabled by C++20 2025-07-14 09:30:54 -07:00
Arne Welzel
a014f48e0f Merge remote-tracking branch 'origin/topic/awelzel/4655-putty-org-to-chiark'
* origin/topic/awelzel/4655-putty-org-to-chiark:
  btest: Switch putty.org usage in tests to official URL
2025-07-14 09:31:20 +02:00
Arne Welzel
13f32a6b37 btest: Switch putty.org usage in tests to official URL
Closes #4655
2025-07-14 09:07:58 +02:00
Tim Wojtulewicz
448590270b Merge remote-tracking branch 'origin/topic/timw/move-util-deferred'
* origin/topic/timw/move-util-deferred:
  Move util::Deferred into util-types.h
2025-07-13 19:23:08 -07:00
Tim Wojtulewicz
6e96cb59ec Move util::Deferred into util-types.h 2025-07-13 19:22:02 -07:00
zeek-bot
e91e9c4523 Update doc submodule [nomail] [skip ci] 2025-07-12 00:17:54 +00:00
Benjamin Bannier
d5fd29edcd Prefer explicit construction to coercion in record initialization
While we support initializing records via coercion from an expression
list, e.g.,

    local x: X = [$x1=1, $x2=2];

this can sometimes obscure the code to readers, e.g., when assigning to
value declared and typed elsewhere. The language runtime has a similar
overhead since instead of just constructing a known type it needs to
check at runtime that the coercion from the expression list is valid;
this can be slower than just writing the readible code in the first
place, see #4559.

With this patch we use explicit construction, e.g.,

    local x = X($x1=1, $x2=2);
2025-07-11 16:28:37 -07:00
Evan Typanski
54f9e45597 Merge remote-tracking branch 'origin/topic/etyp/baseline-cleanup'
* origin/topic/etyp/baseline-cleanup:
  Cleanup unused baselines
2025-07-11 15:35:59 -04:00
Tim Wojtulewicz
0e869a5941 Merge remote-tracking branch 'origin/topic/timw/cpp20-NEWS'
* origin/topic/timw/cpp20-NEWS:
  Add NEWS entry about C++ 20 [nomail] [skip ci]
2025-07-11 12:13:54 -07:00
Tim Wojtulewicz
a4acae2dfe Add NEWS entry about C++ 20 [nomail] [skip ci] 2025-07-11 11:57:24 -07:00
Evan Typanski
a739d47835 Merge remote-tracking branch 'origin/topic/vern/add-del-void-exprs'
* origin/topic/vern/add-del-void-exprs:
  crash fixes for constructs that expect add/delete expressions to return values
2025-07-11 12:58:56 -04:00
Vern Paxson
fe5c953d31 crash fixes for constructs that expect add/delete expressions to return values 2025-07-11 12:56:08 -04:00
zeek-bot
a6776a9f25 Update doc submodule [nomail] [skip ci] 2025-07-11 00:49:08 +00:00
Tim Wojtulewicz
1e55543e86 Merge branch 'topic/timw/c++20'
* topic/timw/c++20:
  Reduce some false-positive warnings from GCC to warnings with -Werror
  Add zeek-namespaced alias for jthread
  Include RequireCXXStd.cmake from main CMakeLists.txt
  Update submodules to C++20-enabled versions
2025-07-10 15:43:09 -07:00
Tim Wojtulewicz
57a3c733d1 Reduce some false-positive warnings from GCC to warnings with -Werror
This also works around some of the same warnings. These are known bugs
in GCC 11+ and GCC 13.x.
2025-07-10 14:07:08 -07:00
Tim Wojtulewicz
cd356ce45d Add zeek-namespaced alias for jthread
Apple Clang (as of version 17.0.0) does not support jthread unless
you enable experimental libcpp features by defining
_LIBCPP_ENABLE_EXPERIMENTAL or passing -fexperimental_library to
the compiler. Even if you don't do those, our 3rdparty jthread
library fails to build because of a bunch of namespace/naming
collisions. I moved our 3rdparty one to the `nonstd` namespace, and
am using an alias under __APPLE__ to avoid the collisions.
2025-07-10 14:07:07 -07:00
Tim Wojtulewicz
350d0859aa Include RequireCXXStd.cmake from main CMakeLists.txt 2025-07-10 14:07:07 -07:00
Tim Wojtulewicz
0de1d8a345 Update submodules to C++20-enabled versions 2025-07-10 14:07:07 -07:00
Evan Typanski
066bbab07b Cleanup unused baselines 2025-07-10 16:46:09 -04:00
Tim Wojtulewicz
c6011e2160 Merge remote-tracking branch 'origin/topic/timw/known-services-with-storage-framework'
* origin/topic/timw/known-services-with-storage-framework:
  Modify known-services policy script to add storage framework support
2025-07-10 08:55:49 -07:00
Tim Wojtulewicz
1f64bb2870 Modify known-services policy script to add storage framework support
This adds a flag to enable using the storage framework instead of Broker stores,
plus a btest for both broker and the the storage framework.
2025-07-10 08:55:01 -07:00
Robin Sommer
6446bdf0dc
Merge remote-tracking branch 'origin/topic/bbannier/bump-spicy'
* origin/topic/bbannier/bump-spicy:
  [Spicy] Add linker scope to debugging output.
  [Spicy] Remove declarations for unimplemented functions.
  [Spicy] Bump `auxil/spicy/` to latest development snapshot.
2025-07-10 09:41:07 +02:00
Robin Sommer
ce6c7a6cd1
Merge remote-tracking branch 'origin/topic/bbannier/protocol-handle-close-finish'
* origin/topic/bbannier/protocol-handle-close-finish:
  [Spicy] Let `zeek::protocol_handle_close()` send a TCP EOF.
2025-07-10 09:38:11 +02:00
zeek-bot
d06468fd34 Update doc submodule [nomail] [skip ci] 2025-07-10 00:18:59 +00:00
Tim Wojtulewicz
0848ddfb9f Merge remote-tracking branch 'origin/topic/vern/ZAM-incr-op-opt-fix'
* origin/topic/vern/ZAM-incr-op-opt-fix:
  ZAM optimizer fix for += / -= set operations
2025-07-09 15:10:17 -07:00
Vern Paxson
1d43760862 ZAM optimizer fix for += / -= set operations 2025-07-09 13:40:33 -07:00
Robin Sommer
da59c12a9a
[Spicy] Add linker scope to debugging output. 2025-07-09 17:36:05 +02:00
Benjamin Bannier
96b8cd8ee4
[Spicy] Remove declarations for unimplemented functions. 2025-07-09 17:36:05 +02:00
Benjamin Bannier
2307c62a61
[Spicy] Bump auxil/spicy/ to latest development snapshot. 2025-07-09 17:36:05 +02:00
Benjamin Bannier
d6c22295bd
[Spicy] Let zeek::protocol_handle_close() send a TCP EOF.
Zeek's analyzer API makes it hard to determine during analyzer
shutdown whether a regular end-of-data has been reached, or if we're
aborting in the middle of a session (e.g., because Zeek missed the
remaining packets): the corresponding analyzer method, `EndOfData()`
gets called in both cases.

In an earlier change, we had stopped signaling Spicy analyzers a
regular finish when that `EndOfData()` method executes, because doing
so could trigger a parse error if it wasn't a regular shutdown—-which
isn't desired, a user request was to just silently stop processing in
this case.

However, that behavior now seems unfortunate in the case that one
deliberately calls `zeek::protocol_handle_close()` to terminate an
analyzer: this feels like a regular shutdown that should just
immediately happen. We achieve this now in this function by
additionally signaling the shutdown at the TCP layer as an "end of
file", which, for Spicy analyzers, happens to run the final, orderly
tear-down.

Not exactly great, but ti seems to thread the needle to achieve the
desired semantics in both cases.
2025-07-09 17:28:19 +02:00
Benjamin Bannier
92868804b1 Merge branch 'topic/bbannier/bump-pre-commit-hook-spicy-format' 2025-07-09 11:56:03 +02:00
Benjamin Bannier
b959ba3395 Bump spicy-format pre-commit hook
pre-commit ignores Cargo.lock files for Rust projects, so any movement
in a Rust project's dependencies can break a hook, even if no code in
the hook changed. I have tried to work with upstream on a fix, but they
basically told me they weren't interested and to get lost.

This bumps the `spicy-format` pre-commit hook to a new version which
explicitly deals with bumps of its dependencies. Having to do this
semi-regularly is not fun, and ideally somebody interested in using this
hook would help set up infrastructure in the hook so it just pulls
pre-built binaries. This is not directly supported by pre-commit, but
many projects work around this by declaring a Python module which then
pulls pre-build binaries which already exist for spicy-format.
2025-07-09 11:40:25 +02:00
Christian Kreibich
9322687823 Merge branch 'topic/christian/rdp-cookie-clarification'
* topic/christian/rdp-cookie-clarification:
  Clarify the cookie field's origin in the RDP log.
2025-07-08 17:45:27 -07:00
zeek-bot
8be80f8c18 Update doc submodule [nomail] [skip ci] 2025-07-09 00:27:47 +00:00
Christian Kreibich
2ca0fb6539 Clarify the cookie field's origin in the RDP log. 2025-07-08 16:31:57 -07:00
Arne Welzel
0c60f2a70a Merge branch 'topic/jgras/connection-packet-threshold' of https://github.com/J-Gras/zeek
* 'topic/jgras/connection-packet-threshold' of https://github.com/J-Gras/zeek:
  Add NEWS entry for generic packet thresholds
  Allow for multiple generic packet thresholds
  Add btest for conn_generic_packet_threshold_crossed event
  Update dump-events btest baseline
  Add conn_generic_packet_threshold_crossed event
2025-07-08 17:54:27 +02:00
Johanna Amann
8ba77da152 Merge remote-tracking branch 'origin/topic/johanna/gh-4602'
* origin/topic/johanna/gh-4602:
  PPPoE: don't forward more bytes than header indicates
2025-07-08 11:44:53 +01:00
Johanna Amann
4c46c02aec Merge remote-tracking branch 'origin/topic/johanna/random-indentation'
* origin/topic/johanna/random-indentation:
  Fix indentation of scripts / tests
2025-07-08 11:41:37 +01:00
Jan Grashoefer
50ab72efc2 Add NEWS entry for generic packet thresholds 2025-07-08 11:30:38 +02:00
Jan Grashoefer
e6d8c3b072 Allow for multiple generic packet thresholds
Co-authored-by: Arne Welzel <arne.welzel@corelight.com>
2025-07-08 11:29:06 +02:00
Johanna Amann
1fed0ed58d PPPoE: don't forward more bytes than header indicates
This changes the PPPoE parser so that it doesn't forward extra bytes
that might be appended after the payload. Instead, it raises a weird if
the payload size doesn't match the size indicated by the header.

This is in line with what other protocol parsers (like UDP) are doing.

Two tests needed to be updated - with this change, the traffic in
pppoe-over-qinq.pcap is now valid TLS. A new trace was introduced for
the confirmation-violation-info test.

Addresses GH-4602
2025-07-08 10:20:59 +01:00
Johanna Amann
359c7707e0 Fix indentation of scripts / tests
No functional changes
2025-07-08 10:13:48 +01:00
Arne Welzel
d42d467965 Merge remote-tracking branch 'origin/topic/vern/line-number-ordering'
* origin/topic/vern/line-number-ordering:
  Bump ZeekJS to work with new Location constructor
  remove non-functional column information from Location objects
  isolate Location specifics to private class variables to enforce correct line number ordering
2025-07-08 10:40:58 +02:00
Arne Welzel
781097ef72 Bump ZeekJS to work with new Location constructor 2025-07-08 10:39:53 +02:00
Vern Paxson
a9b37467a4 remove non-functional column information from Location objects 2025-07-08 10:39:53 +02:00
Vern Paxson
5c63133226 isolate Location specifics to private class variables to enforce correct line number ordering 2025-07-08 10:39:28 +02:00
Arne Welzel
3c941a6d3e Merge remote-tracking branch 'origin/topic/awelzel/id-opt-info-branch-clone-no-lint'
* origin/topic/awelzel/id-opt-info-branch-clone-no-lint:
  script_opt/IDOptInfo: Add NOLINT(bugprone-branch-clone)
2025-07-07 20:07:35 +02:00
Arne Welzel
0cc30faa55 script_opt/IDOptInfo: Add NOLINT(bugprone-branch-clone) 2025-07-07 18:52:11 +02:00
Arne Welzel
b034fd3f55 Merge remote-tracking branch 'origin/topic/awelzel/bump-zeekjs-0-18-0'
* origin/topic/awelzel/bump-zeekjs-0-18-0:
  Bump zeekjs to v0.18.0
2025-07-07 18:17:25 +02:00
Arne Welzel
869bd181b2 Merge remote-tracking branch 'origin/topic/vern/ZAM-const-prop-fix'
* origin/topic/vern/ZAM-const-prop-fix:
  fix for error in ZAM's constant propagation logic
2025-07-07 18:15:57 +02:00
Vern Paxson
0c1e248572 fix for error in ZAM's constant propagation logic 2025-07-04 16:05:46 -07:00
Arne Welzel
e3cb063032 Bump zeekjs to v0.18.0
1b7071e version: 0.18.0
    07c801e tests: Bump version requirement for new-event and log-events
    b7b69eb Add support for node v24
2025-07-04 17:10:49 +02:00
zeek-bot
319af542d9 Update doc submodule [nomail] [skip ci] 2025-07-04 00:25:19 +00:00
Arne Welzel
eb6b4a0c46 Merge remote-tracking branch 'origin/topic/awelzel/revert-to-tpe'
* origin/topic/awelzel/revert-to-tpe:
  scripts: Use tpe instead of type_, again
2025-07-03 20:44:04 +02:00
Arne Welzel
df581c59b4 scripts: Use tpe instead of type_, again
The .rst generation doesn't escape the trailing `_` and the docs build
gets upset due to using `type` as a reference target then.

For the better or worse, revert to using tpe. Though I acknowledge this
means we need to be careful with trailing underscores because our docs
build is so fragile.

Partly reverts b9eabbabba.
2025-07-03 20:25:34 +02:00
Arne Welzel
388cbcee48 Merge remote-tracking branch 'origin/topic/awelzel/4605-conn-id-context'
* origin/topic/awelzel/4605-conn-id-context:
  NEWS: Adapt for conn_id$ctx introduction
  conn_key/fivetuple: Drop support for non conn_id records
  Conn: Move conn_id init and flip to IPBasedConnKey
  IPBasedConnKey: Add GetTransportProto() helper
  input/Manager: Ignore empty record types
  external: Bump commit hashes for external suites
  ip/vlan_fivetuple: Populate nested conn_id_context, not conn_id
  ConnKey: Extend DoPopulateConnIdVal() with ctx
  btest: Update tests and baselines after adding ctx to conn_id
  init-bare: Add conn_id_ctx to conn_id
2025-07-03 18:42:48 +02:00
Arne Welzel
a7bc144465 NEWS: Adapt for conn_id$ctx introduction 2025-07-03 18:21:36 +02:00
Arne Welzel
6eb0d4df32 conn_key/fivetuple: Drop support for non conn_id records
Previously, we supported any records that happened to have orig_h,
resp_h, etc. fields, but it's not exactly clear why we ever did. Users
that relied on this can instantiate an explicit conn_id instance, too.
2025-07-03 18:21:36 +02:00
Arne Welzel
f8eab9e9cf Conn: Move conn_id init and flip to IPBasedConnKey
This loosens the coupling of the script-layer conn_id record and
the code in Conn a bit, moving more into the IPBasedConnKey class.

I'm not quite sure whether moving the flipping logic is worth it,
but assuming Conn could become non-IP in the future, it might.
2025-07-03 18:21:36 +02:00
Arne Welzel
661fa91231 IPBasedConnKey: Add GetTransportProto() helper 2025-07-03 18:21:36 +02:00
Arne Welzel
a975d65d01 input/Manager: Ignore empty record types
Somewhere record types with zero fields get the optional attribute
apparently. The input/sqlite/basic test failed due to complaining
that ctx is optional. It isn't optional and when it has zero fields
we can just ignore it, too.

Also adds a input framework test with an explicit empty record type
2025-07-03 18:21:15 +02:00
Arne Welzel
8c7d732d4c external: Bump commit hashes for external suites
get_file_handle() may include c$id and perturbs their values when adding new
fields. I think that's reasonable, as files transferred in one VLAN should
be treated separate from files transferred in a different VLAN.
2025-07-03 18:19:47 +02:00
Arne Welzel
e221042f14 ip/vlan_fivetuple: Populate nested conn_id_context, not conn_id
This also enforces conn_id and conn_id_ctx types instead of being
able to handle any conn_id-like record.
2025-07-03 18:19:46 +02:00
Arne Welzel
b7a22a87c6 ConnKey: Extend DoPopulateConnIdVal() with ctx
This prepares the move where ConnKey implementations should fill out
ctx rather than filling conn_id directly. The API continues to receive
both, conn_id and ctx, as adding fields to `conn_id` is reasonable
use-case even if it's just for logging purposes.
2025-07-03 18:19:46 +02:00
Arne Welzel
112e3c1c03 btest: Update tests and baselines after adding ctx to conn_id 2025-07-03 18:19:46 +02:00
Arne Welzel
25fc4d5d98 init-bare: Add conn_id_ctx to conn_id
This nested record can be used to discriminate orig_h or resp_h being
observed in different "contexts". A context can be based on VLAN tags,
but any custom ConnKey implementation should populate the ctx field,
allowing to write context-aware Zeek scripts without needing to know
what the context really is.
2025-07-03 18:19:46 +02:00
Jan Grashoefer
d8ee27bdcc Add btest for conn_generic_packet_threshold_crossed event 2025-07-03 12:47:29 +02:00
Jan Grashoefer
b0d2713547 Update dump-events btest baseline
Changes in endpoint stats are a side-effect caused by the ConnSize
analyzer updating the conn record triggering the threshold event. The
phenomenon is described in https://github.com/zeek/zeek/issues/4214.
2025-07-03 12:32:31 +02:00
Jan Grashoefer
4831bf80d1 Add conn_generic_packet_threshold_crossed event 2025-07-03 12:09:47 +02:00
Johanna Amann
2a34cf3f46 Merge remote-tracking branch 'origin/topic/johanna/ssl-small-tweaks'
* origin/topic/johanna/ssl-small-tweaks:
  Spicy SSL analyzer: move unknown version out of possible range
  Spicy SSL analyzer: move exceptions to &requires & throw
2025-07-02 07:50:33 +01:00
zeek-bot
d519d052bc Update doc submodule [nomail] [skip ci] 2025-07-02 00:28:17 +00:00
Evan Typanski
310a82e7fd Merge remote-tracking branch 'origin/topic/etyp/redis-resp3'
* origin/topic/etyp/redis-resp3:
  Touchup TODOs in the Redis analyzer
  Handle more Redis RESP3 protocol pieces
  Stringify all Redis-RESP serialized data
  Handle Redis protocol `message` separately
  Add Redis analyzer array stringification
2025-07-01 14:20:19 -04:00
Evan Typanski
e7c798e526 Touchup TODOs in the Redis analyzer
Also renames `KnownCommand` to `RedisCommand` to avoid conflicts.
2025-07-01 14:14:15 -04:00
Evan Typanski
64443e5e5a Handle more Redis RESP3 protocol pieces
This passes the "minimum protocol version" along in the reply and adds
support for attributes, which were added relatively recently.
2025-07-01 14:14:15 -04:00
Evan Typanski
b34d3ff2f0 Stringify all Redis-RESP serialized data 2025-07-01 14:14:15 -04:00
Evan Typanski
a4ce682bc9 Handle Redis protocol message separately
Closes #4504

Messages are not typical responses, so they need special handling. This
is different between RESP2 and 3, so this is the first instance where
the script layer needs to tell the difference.
2025-07-01 14:14:15 -04:00
Evan Typanski
8b914f4714 Add Redis analyzer array stringification
This was going to be how "message" server data was handled, but that
ended up being bad. Regardless, this is probably nice to have.
2025-07-01 10:23:57 -04:00
Benjamin Bannier
e3b0d1d2be Merge branch 'topic/bbannier/bump-pre-commit-hooks' 2025-07-01 11:09:23 +02:00
Benjamin Bannier
b9eabbabba Bump pre-commit hooks 2025-07-01 10:39:47 +02:00
Arne Welzel
6d272038fe Merge remote-tracking branch 'origin/topic/timw/4617-reset-expire-time-on-overwrite'
* origin/topic/timw/4617-reset-expire-time-on-overwrite:
  SQLite: Reset expiration time on overwrite
2025-07-01 09:20:58 +02:00
zeek-bot
7a19e4e7d3 Update doc submodule [nomail] [skip ci] 2025-07-01 00:28:16 +00:00
Tim Wojtulewicz
fd7259f436 SQLite: Reset expiration time on overwrite 2025-06-30 14:41:10 -07:00
Tim Wojtulewicz
5daa83bfa4 Merge remote-tracking branch 'origin/topic/bbannier/readability-isolate-declaration'
* origin/topic/bbannier/readability-isolate-declaration:
  Make clang-tidy warnings report as errors to cause CI build to fail
  Fix a clang-tidy finding in cluster telemetry code
  Fix clang-tidy readability-isolate-declaration warnings
2025-06-30 14:19:37 -07:00
Tim Wojtulewicz
79959310a6 Make clang-tidy warnings report as errors to cause CI build to fail 2025-06-30 14:19:06 -07:00
Tim Wojtulewicz
1bc39cb541 Fix a clang-tidy finding in cluster telemetry code 2025-06-30 14:19:06 -07:00
Benjamin Bannier
627c3ad726 Fix clang-tidy readability-isolate-declaration warnings
I missed one of these in review so a machine is probably better at
catching them.

I fixed the existing instances which where largely in code which look
dated. Where possible I slightly reorganized the code so we do not have
to leave values uninitialized, but did not touch up anything else.
2025-06-30 14:19:06 -07:00
Arne Welzel
c725311d07 Merge remote-tracking branch 'origin/topic/awelzel/cluster-log-websocket-application-name'
* origin/topic/awelzel/cluster-log-websocket-application-name:
  cluster/WebSocket: Include X-Application-Name in cluster.log
2025-06-30 17:56:19 +02:00
Arne Welzel
1d931b5a2f cluster/WebSocket: Include X-Application-Name in cluster.log
A bit ad-hoc formatting for the log, but that's mostly because cluster.log
only has message field and I don't think having a dedicated application_name
column is worth it. That could also be added by custom scripts if it's really
wanted for a given deployment.
2025-06-30 17:55:24 +02:00
Arne Welzel
5847a2d32e Merge remote-tracking branch 'origin/topic/awelzel/cluster-telemetry-follow-up'
* origin/topic/awelzel/cluster-telemetry-follow-up:
  Bump cluster test suite
  cluster/Telemetry: Cache CallExpr locations
  cluster/Telemetry: Avoid unneeded StringVal() construction
  Val: Switch TablePatternMatcher to std::string_view
  RE: Add MatchAll() and MatchSet() for std::string_view
  cluster/websocket: Fix and test for invalid X-Application-Name
  cluster/telemetry: Move topic_normalization redef to zeromq
2025-06-30 13:30:04 +02:00
Arne Welzel
42ed82824e Bump cluster test suite
Since zeek/zeek#4552, metrics are labeled with node, not endpoint,
adapt the tests for that.
2025-06-30 13:22:31 +02:00
Arne Welzel
73e55fa909 cluster/Telemetry: Cache CallExpr locations 2025-06-30 13:22:31 +02:00
Arne Welzel
be8b4747c4 cluster/Telemetry: Avoid unneeded StringVal() construction 2025-06-30 13:22:31 +02:00
Arne Welzel
dad5ccd622 Val: Switch TablePatternMatcher to std::string_view
...and add TableVal::LookupPattern(std::string_view sv).
2025-06-30 13:22:31 +02:00
Arne Welzel
dce51b99e5 RE: Add MatchAll() and MatchSet() for std::string_view 2025-06-30 13:22:31 +02:00
Arne Welzel
5c6a6d9427 cluster/websocket: Fix and test for invalid X-Application-Name 2025-06-30 13:22:31 +02:00
zeek-bot
e79ae5a1d9 Update doc submodule [nomail] [skip ci] 2025-06-27 00:19:29 +00:00
Johanna Amann
2bb47d8d9a Spicy SSL analyzer: move unknown version out of possible range
This moves the negotiated version outside of the possible range of
protocol values. I don't think it was possible to cause a problem with
this in the past - but this approach seems safer.
2025-06-26 20:26:02 +01:00
Johanna Amann
2ce0d4f73b Spicy SSL analyzer: move exceptions to &requires & throw
This commit changes exception handling in a couple of places, to prefer
the use of &requires and throw.
2025-06-26 20:26:02 +01:00
Johanna Amann
dbeadc65ba Merge remote-tracking branch 'origin/topic/johanna/gh-4547'
* origin/topic/johanna/gh-4547:
  Spicy SSL analyzer: make record layer version parsing more strict
2025-06-26 20:21:54 +01:00
Arne Welzel
222f34b4ac Bump cluster testuite for endpoint to node renaming 2025-06-26 19:22:09 +02:00
Arne Welzel
3cd6e1ca06 Merge remote-tracking branch 'origin/topic/vern/if-coverage'
* origin/topic/vern/if-coverage:
  extend script coverage profiling to track whether conditionals evaluate to true/false
2025-06-26 18:49:42 +02:00
Johanna Amann
74b847a122 Spicy SSL analyzer: make record layer version parsing more strict
The Spicy based SSL analyzer was, so far, more permissive with the
record layer versions that it would accept.

This change brings the parsing of record layer versions in line with the
binpac based analyzer. This behavioral difference was discovered due to
a test that changed with the recent dpd log changes.
2025-06-26 16:57:51 +01:00
Vern Paxson
0255b5d120 extend script coverage profiling to track whether conditionals evaluate to true/false 2025-06-26 16:10:50 +02:00
Arne Welzel
26f5166d7a cluster/telemetry: Move topic_normalization redef to zeromq 2025-06-26 15:22:11 +02:00
Arne Welzel
22958f7cdf Merge remote-tracking branch 'origin/topic/awelzel/1474-cluster-telemetry'
* origin/topic/awelzel/1474-cluster-telemetry:
  btest/cluster/telemetry: Add smoke testing for telemetry
  cluster/WebSocket: Fetch X-Application-Name header as app label
  cluster/WebSocket: Pass X-Application-Name to dispatcher
  broker/WebSocketShim: Add calls to Telemetry hooks
  cluster/WebSocket: Configure telemetry for WebSocket backends
  broker: Hook up generic cluster telemetry
  cluster: Introduce telemetry component

One bug fix removing static from a variable that shouldn't be static.
2025-06-26 14:54:01 +02:00
Johanna Amann
14e801a709 Merge remote-tracking branch 'origin/topic/johanna/gh-4598'
* origin/topic/johanna/gh-4598:
  Only pass session ticket data in ssl_session_ticket_handshake event
2025-06-26 09:59:16 +01:00
zeek-bot
9f16050d0a Update doc submodule [nomail] [skip ci] 2025-06-26 00:26:06 +00:00
Arne Welzel
771c37b6b2 Merge branch 'rename' of https://github.com/bhaskarbhar/zeek
* 'rename' of https://github.com/bhaskarbhar/zeek:
  Update zeek.bif
  Update init-bare.zeek
  Added Baseline
  Renamed
2025-06-25 19:27:13 +02:00
bhaskarbhar
f9c34f29c7
Update zeek.bif 2025-06-25 22:53:29 +05:30
bhaskarbhar
722381366b
Update init-bare.zeek 2025-06-25 22:51:43 +05:30
root
1fba346f5d Added Baseline 2025-06-25 21:22:21 +05:30
root
da89e7ee6e Renamed 2025-06-25 21:10:08 +05:30
Arne Welzel
0e1431eef4 btest/cluster/telemetry: Add smoke testing for telemetry 2025-06-25 17:13:01 +02:00
Arne Welzel
b28e5f261e cluster/WebSocket: Fetch X-Application-Name header as app label 2025-06-25 17:12:59 +02:00
Arne Welzel
2f7d5eaf2a cluster/WebSocket: Pass X-Application-Name to dispatcher
This is going to be used to add labels to telemetry if the
X-Application-Name header is set.
2025-06-25 17:07:29 +02:00
Arne Welzel
6a84237a95 broker/WebSocketShim: Add calls to Telemetry hooks
WebSocket clients with Broker do not use the normal Broker backend, so
we need to add the telemetry invocations explicitly.
2025-06-25 16:59:49 +02:00
Arne Welzel
376e6dba97 cluster/WebSocket: Configure telemetry for WebSocket backends 2025-06-25 16:59:49 +02:00
Arne Welzel
f011e7e667 broker: Hook up generic cluster telemetry 2025-06-25 16:59:49 +02:00
Arne Welzel
4c34274a6c cluster: Introduce telemetry component 2025-06-25 16:59:49 +02:00
Evan Typanski
d3593e0489 Merge remote-tracking branch 'origin/topic/etyp/remove-list'
* origin/topic/etyp/remove-list:
  Remove `list` from Zeek grammar
2025-06-25 10:36:08 -04:00
Arne Welzel
cd934c460b Merge remote-tracking branch 'origin/topic/christian/extensible-conntuples'
* origin/topic/christian/extensible-conntuples:
  btest/plugins: Add test for custom ConnKey factory
  NEWS updates for pluggable connection tuples.
  Add a VLAN-aware flow tuple implementation.
  Deprecate ConnTuple and related APIs.
  Deprecate the old Connection constructor and detail::ConnKey class.
  Switch to virtualized use of new zeek::ConnKey class tree
  Provide a connkey factory for Zeek's default five-tuples.
  Add IP-specific ConnKey implementation.
  Establish plugin infrastructure for ConnKey factories.
  Add new ConnKey abstraction.
2025-06-25 14:17:49 +02:00
Arne Welzel
e7b1b174f0 btest/plugins: Add test for custom ConnKey factory
This just counts DoInits() and adds that information to the conn_id
record, but without including it into the hash. Mostly for smoke
testing.
2025-06-25 13:19:26 +02:00
Christian Kreibich
a040f550f4 NEWS updates for pluggable connection tuples. 2025-06-25 13:19:26 +02:00
Christian Kreibich
29b0f844c0 Add a VLAN-aware flow tuple implementation.
This is a first "real" implementation of a custom tuple, adding additional
fields over the standard five-tuple.

Includes test cases.
2025-06-25 13:19:26 +02:00
Christian Kreibich
a5122b5032 Deprecate ConnTuple and related APIs.
Given IP-aware ConnKeys, ConnTuples aren't really required any more. ConnTuple
had two benefits:

- It preserved the original src/dst orientation from the packet headers it was
based on, which IPBasedConnKey now tracks and provides accessor methods for.

- In IPBasedAnalyzer::AnalyzePacket() its instance survived past the std:move()
of the key into NewConn(), which we sidestep by keeping the original src address
and port around until we need after the connection is obtained.
2025-06-25 13:19:26 +02:00
Christian Kreibich
7548dc9e96 Deprecate the old Connection constructor and detail::ConnKey class.
The new key-based Connection constructor replaces the former, and the new
ConnKey class tree replaces the latter.
2025-06-25 13:19:26 +02:00
Christian Kreibich
52d6228b06 Switch to virtualized use of new zeek::ConnKey class tree
This touches quite a few places, but each just swaps out existing
APIs and/or zeek::detail::ConnKey instances.
2025-06-25 13:19:26 +02:00
Christian Kreibich
b8f82ff659 Provide a connkey factory for Zeek's default five-tuples.
Since the base factory is pure virtual this is now the first full
implementation, but still a bit of a special case because it implements Zeek's
default behavior and doesn't add "custom" content to the tuple.
2025-06-25 13:18:08 +02:00
Christian Kreibich
5af8fc242a Add IP-specific ConnKey implementation.
The InitTuple() implementation here is a placeholder for a fuller one following
later, when we do away with the need for ConnTuple.
2025-06-25 13:18:08 +02:00
Christian Kreibich
0c64f6a7b9 Establish plugin infrastructure for ConnKey factories.
ConnKey factories are intermediaries that encapsulate the details of how to
instantiate ConnKeys, which codify the hash input for connection lookups.
2025-06-25 13:18:07 +02:00
Christian Kreibich
d19fdfd17c Add new ConnKey abstraction. 2025-06-25 13:18:07 +02:00
Arne Welzel
4b472f2771 Merge remote-tracking branch 'origin/topic/awelzel/telemetry-endpoint-to-node-rename'
* origin/topic/awelzel/telemetry-endpoint-to-node-rename:
  telemetry: Rename endpoint label to node label
2025-06-25 09:33:55 +02:00
Arne Welzel
eea194ddd8 telemetry: Rename endpoint label to node label
Using a label named "endpoint" is not intuitive and requires explaining to
users that it's really just the Cluster::node value. Change the label to
"node", so that we don't need to do the explaining.

This probably breaks some existing users of the Prometheus metrics, but after
looking more at metrics recently, "endpoint" really is a thorn in my eye.
2025-06-25 09:33:01 +02:00
zeek-bot
261582bcd5 Update doc submodule [nomail] [skip ci] 2025-06-25 00:17:53 +00:00
Tim Wojtulewicz
4c2990f6ad Merge remote-tracking branch 'origin/topic/timw/available_tags'
* origin/topic/timw/available_tags:
  Add get_tags_by_category BIF method
2025-06-24 15:38:32 -07:00
bhaskarbhar
04d6fa3cb7 Add get_tags_by_category BIF method 2025-06-24 13:47:49 -07:00
Tim Wojtulewicz
4db7d40894 Add NEWS entry about deprecation of --with-binpac and --with-bifcl 2025-06-24 12:56:03 -07:00
Tim Wojtulewicz
e5afa4160c Merge remote-tracking branch 'origin/topic/timw/remove-with-binpac-bifcl'
* origin/topic/timw/remove-with-binpac-bifcl:
  Deprecate --with-binpac/--with-bifcl configure options
  Remove deprecated --disable-archiver configure argument
2025-06-24 12:51:15 -07:00
Tim Wojtulewicz
60953e14e7 Deprecate --with-binpac/--with-bifcl configure options 2025-06-24 12:50:35 -07:00
Tim Wojtulewicz
60a4aef941 Remove deprecated --disable-archiver configure argument 2025-06-24 12:50:35 -07:00
Arne Welzel
5e5d943273 Merge remote-tracking branch 'origin/topic/awelzel/publish-error-test-avoid-tsan-report'
* origin/topic/awelzel/publish-error-test-avoid-tsan-report:
  btest/broker/publish-errors: Avoid exit(0)
2025-06-24 19:07:23 +02:00
Arne Welzel
2e30f87e33 btest/broker/publish-errors: Avoid exit(0)
Calling exit() doesn't properly shutdown the manager instances and TSAN reports a
leaked thread. Just avoid this for now by using terminate() instead.
2025-06-24 19:06:52 +02:00
Arne Welzel
fbeb3adfe6 Merge remote-tracking branch 'origin/topic/awelzel/dns-naming-authority-pointer'
* origin/topic/awelzel/dns-naming-authority-pointer:
  DNS: Implement NAPTR RR support
  DNS: Move extract_char_string() helper around
2025-06-24 17:44:17 +02:00
Arne Welzel
4f1fc296b6 DNS: Implement NAPTR RR support
My phone is sending NAPTR queries and we reported an unknown RR type 35
in weird.log for the response, so figured I'd just add it.
2025-06-24 17:43:27 +02:00
Johanna Amann
9d06a13828 Only pass session ticket data in ssl_session_ticket_handshake event
This commit fixes the parsing of the data field in the SSL analyzer. So
far, this field contained two extra bytes at the beginning, which
contain the length of the following data.

Now, the data passed to the event only contains the actual value of the
session ticket.

The Spicy analyzer already contains the correct handling of this field,
and does not need to be updated. A test that uses the event and
exhibited the bug was added.
2025-06-24 16:33:14 +01:00
Arne Welzel
cab4ebf513 Merge remote-tracking branch 'origin/topic/awelzel/4586-zeromq-ipv6'
* origin/topic/awelzel/4586-zeromq-ipv6:
  cluster/zeromq: Short-circuit DoPublishLogWrite() when not initialized
  cluster/zeromq: Hook up and enable IPV6 by default
  cluster/zeromq/connect: Make failures fatal
  cluster/zeromq: Move log_push creation to DoInit()
2025-06-24 17:16:58 +02:00
Arne Welzel
1afd497c0c cluster/zeromq: Short-circuit DoPublishLogWrite() when not initialized
After moving the log_push initialization from the constructor to the
DoInit() method, it's now possible that DoPublishLogWrites() is invoked
even if DoInit() was never called. Handle this by short-circuiting. This
is sort of an error, but can happen during tests if scripts are loaded
somewhat arbitrarily.
2025-06-24 17:12:45 +02:00
Arne Welzel
89c0b0faf3 cluster/zeromq: Hook up and enable IPV6 by default
ZeroMQ's IPv6 support isn't enabled by default, resulting in
"No such device" errors when attempting to listen on an IPv6
address. This change adds a ipv6 option to the ZeroMQ module
and enables it by default. Further, adds a test configuring
everything to listen on IPv6 ::1 as well, and one test to provoke
the original error. This also regularizes some error messages.

The addr_to_uri() calls weren't actually needed, but they apparently do
not hurt and the result is easier on the eyes, so use them :-)
2025-06-24 17:12:45 +02:00
Benjamin Bannier
767ddfd8a1 Merge branch 'topic/bbannier/issue-4587' 2025-06-24 16:31:01 +02:00
Benjamin Bannier
c15d04282d Build builtin Spicy analyzers in debug mode if debug mode is enabled
Closes #4587.
2025-06-24 16:30:41 +02:00
Johanna Amann
72bd683c23 Merge remote-tracking branch 'origin/topic/johanna/default-canonifier-only-first-timestamp'
* origin/topic/johanna/default-canonifier-only-first-timestamp:
  Default canonifier change to only remove first timestamp in line
  Align SMB timestamp calculation between operating systems
2025-06-24 14:02:04 +01:00
Tim Wojtulewicz
e39a1d7271 Merge remote-tracking branch 'origin/topic/timw/ipv6-chain-vector'
* origin/topic/timw/ipv6-chain-vector:
  Switch IPv6_Hdr_Chain to a vector of objects instead of pointers
2025-06-23 10:52:33 -07:00
Tim Wojtulewicz
d6e25a2e22 Switch IPv6_Hdr_Chain to a vector of objects instead of pointers 2025-06-23 10:41:23 -07:00
Tim Wojtulewicz
33b23ef4b1 Merge remote-tracking branch 'origin/topic/timw/zeromq-include-paths'
* origin/topic/timw/zeromq-include-paths:
  Remove unneeded include dirs in zeromq CMakeLists.txt
2025-06-23 10:40:10 -07:00
Tim Wojtulewicz
7e6d3a6b39 Remove unneeded include dirs in zeromq CMakeLists.txt 2025-06-23 10:39:13 -07:00
Tim Wojtulewicz
8d92ad472c Merge branch 'topic/timw/clang-tidy-fixes'
* topic/timw/clang-tidy-fixes: (41 commits)
  Deprecate BRO_PLUGIN_INSTALL_PATH constant
  Make constants in IP::ParseResult uppercase, deprecate the old ones
  Fix comparison against CapLen results in IPTunnel
  Fix clang-tidy cppcoreguidelines-virtual-class-destructor warnings in headers
  Fix clang-tidy cppcoreguidelines-macro-usage warnings in headers
  Fix clang-tidy modernize-use-using warnings in headers
  Fix clang-tidy modernize-use-transparent-functors warnings in headers
  Fix clang-tidy modernize-use-override warnings in headers
  Fix clang-tidy modernize-use-nullptr warnings in headers
  Fix clang-tidy modernize-use-equals-delete warnings in headers
  Fix clang-tidy modernize-use-emplace warnings in headers
  Fix clang-tidy modernize-use-default-member-init warnings in headers
  Fix clang-tidy modernize-use-bool-literals warnings in headers
  Fix clang-tidy modernize-return-braced-init-list warnings in headers
  Fix clang-tidy modernize-type-traits warnings in headers
  Fix clang-tidy modernize-redundnat-void-arg warnings in headers
  Fix clang-tidy modernize-pass-by-value warnings in headers
  Fix clang-tidy modernize-loop-convert warnings in headers
  Fix clang-tidy modernize-macro-to-enum warnings in headers
  Fix clang-tidy performance-unnecessary-copy-initialization warnings in headers
  ...
2025-06-23 10:37:29 -07:00
Tim Wojtulewicz
6aa5145782 Deprecate BRO_PLUGIN_INSTALL_PATH constant 2025-06-23 08:35:25 -07:00
Tim Wojtulewicz
37be47328e Make constants in IP::ParseResult uppercase, deprecate the old ones 2025-06-23 08:35:25 -07:00
Tim Wojtulewicz
a27dee6370 Fix comparison against CapLen results in IPTunnel 2025-06-23 08:35:24 -07:00
Tim Wojtulewicz
311a744a20 Fix clang-tidy cppcoreguidelines-virtual-class-destructor warnings in headers 2025-06-23 08:35:24 -07:00
Tim Wojtulewicz
e84c99fb14 Fix clang-tidy cppcoreguidelines-macro-usage warnings in headers 2025-06-23 08:35:24 -07:00
Tim Wojtulewicz
74bf987b82 Fix clang-tidy modernize-use-using warnings in headers 2025-06-23 08:35:24 -07:00
Tim Wojtulewicz
6f79a6381f Fix clang-tidy modernize-use-transparent-functors warnings in headers 2025-06-23 08:35:24 -07:00
Tim Wojtulewicz
e613e7c304 Fix clang-tidy modernize-use-override warnings in headers 2025-06-23 08:35:24 -07:00
Tim Wojtulewicz
edf3ceb52c Fix clang-tidy modernize-use-nullptr warnings in headers 2025-06-23 08:35:24 -07:00
Tim Wojtulewicz
f15cab4a2b Fix clang-tidy modernize-use-equals-delete warnings in headers 2025-06-23 08:35:24 -07:00
Tim Wojtulewicz
cb78d2202f Fix clang-tidy modernize-use-emplace warnings in headers 2025-06-23 08:35:24 -07:00
Tim Wojtulewicz
fb55c8856e Fix clang-tidy modernize-use-default-member-init warnings in headers 2025-06-23 08:35:24 -07:00
Tim Wojtulewicz
a05b4abdf7 Fix clang-tidy modernize-use-bool-literals warnings in headers 2025-06-23 08:35:24 -07:00
Tim Wojtulewicz
ed202b36b2 Fix clang-tidy modernize-return-braced-init-list warnings in headers 2025-06-23 08:35:24 -07:00
Tim Wojtulewicz
157c488b9d Fix clang-tidy modernize-type-traits warnings in headers 2025-06-23 08:35:24 -07:00
Tim Wojtulewicz
23184af21c Fix clang-tidy modernize-redundnat-void-arg warnings in headers 2025-06-23 08:35:24 -07:00
Tim Wojtulewicz
d19486d039 Fix clang-tidy modernize-pass-by-value warnings in headers 2025-06-23 08:35:24 -07:00
Tim Wojtulewicz
c0e275604f Fix clang-tidy modernize-loop-convert warnings in headers 2025-06-23 08:35:24 -07:00
Tim Wojtulewicz
451b25cfad Fix clang-tidy modernize-macro-to-enum warnings in headers 2025-06-23 08:35:24 -07:00
Tim Wojtulewicz
6b34d4d094 Fix clang-tidy performance-unnecessary-copy-initialization warnings in headers 2025-06-23 08:35:24 -07:00
Tim Wojtulewicz
e7b89f81e9 Fix clang-tidy performance-noexcept-move-constructor warnings in headers 2025-06-23 08:35:24 -07:00
Tim Wojtulewicz
a136159ceb Fix clang-tidy performance-move-const-arg warnings in headers 2025-06-23 08:35:24 -07:00
Tim Wojtulewicz
baf00a54e8 Fix clang-tidy performance-inefficient-vector-operation warnings in headers 2025-06-23 08:35:24 -07:00
Tim Wojtulewicz
f386deba94 Fix clang-tidy performance-enum-size warnings in headers 2025-06-23 08:35:24 -07:00
Tim Wojtulewicz
89ac0cb418 Fix clang-tidy performance-avoid-endl warnings in headers 2025-06-23 08:35:24 -07:00
Tim Wojtulewicz
2abb7830a5 Fix clang-tidy bugprone-use-after-move warnings in headers 2025-06-23 08:35:24 -07:00
Tim Wojtulewicz
9c3dddfa12 Fix clang-tidy bugprone-suspicious-realloc-usage warnings in headers 2025-06-23 08:35:24 -07:00
Tim Wojtulewicz
a58110986d Fix clang-tidy bugprone-unhandled-self-assignment warnings in headers 2025-06-23 08:35:24 -07:00
Tim Wojtulewicz
9a3401deee Fix clang-tidy bugprone-suspicious-memory-comparison warnings in headers 2025-06-23 08:35:24 -07:00
Tim Wojtulewicz
bdd1909c61 Fix clang-tidy bugprone-sizeof-expression warnings in headers
This one is weird. This checker complains because we tend to use PList,
which sets the type of T to a pointer. The checker is making note that
we're doing sizeof() on a pointer, which always returns the same value
every time. It's asking whether we meant to do that, or if we meant to
pass the actual type to sizeof.
2025-06-23 08:35:24 -07:00
Tim Wojtulewicz
3dae1fa46e Fix clang-tidy bugprone-parent-virtual-call warnings in headers 2025-06-23 08:35:24 -07:00
Tim Wojtulewicz
29ca66f494 Fix clang-tidy bugprone-multi-level-implicit-pointer-conversion warnings in headers 2025-06-23 08:35:24 -07:00
Tim Wojtulewicz
13b7713889 Fix clang-tidy bugprone-macro-parentheses warnings in headers 2025-06-23 08:35:24 -07:00
Tim Wojtulewicz
d327d6388c Fix clang-tidy bugprone-implicit-widening-of-multiplication-result warnings in headers 2025-06-23 08:35:24 -07:00
Tim Wojtulewicz
3b7122aadb Fix clang-tidy bugprone-forward-declaration-namespace warnings in headers 2025-06-23 08:35:24 -07:00
Tim Wojtulewicz
b27eba6533 Fix clang-tidy bugprone-branch-clone warnings in headers 2025-06-23 08:35:24 -07:00
Tim Wojtulewicz
694e53e47b Fix clang-tidy bugprone-bitwise-pointer-cast warnings in headers 2025-06-23 08:35:24 -07:00
Tim Wojtulewicz
e452c53ffb Change clang-tidy configuration to also scan headers 2025-06-23 08:35:24 -07:00
Tim Wojtulewicz
d12d0d7a29 Don't pass local source/binary directory to zeek_add_plugin for Redis backend 2025-06-23 08:35:24 -07:00
Tim Wojtulewicz
19f4ef03df Update bifcl/binpac/gen-zam submodules with clang-tidy fixes 2025-06-23 08:35:24 -07:00
Tim Wojtulewicz
c07519353f Avoid linting headers in external paths 2025-06-23 08:35:24 -07:00
Arne Welzel
b1157e4e03 Merge remote-tracking branch 'origin/topic/bbannier/issue-4594'
* origin/topic/bbannier/issue-4594:
  Align WebSocket error in cluster with one in Broker
2025-06-22 15:49:23 +02:00
Arne Welzel
b0a26eddaa Merge remote-tracking branch 'origin/topic/awelzel/4571-reject-cluster-event-broker-publish'
* origin/topic/awelzel/4571-reject-cluster-event-broker-publish:
  broker: Handle Broker::publish() with non Broker::Event
2025-06-22 15:48:36 +02:00
Arne Welzel
07e9870f34 broker: Handle Broker::publish() with non Broker::Event
Closes #4571
2025-06-22 15:45:31 +02:00
Benjamin Bannier
e1acb246a5 Align WebSocket error in cluster with one in Broker
The schema of cluster WebSocket error messages deviated from the
existing one in Broker which breaks seamless migration from the Broker
WebSocket bindings.

This patch aligns the serialization in cluster with the one in Broker.
This is technically a breaking change of the cluster schema, but since
it never worked like documented and is still experimental this is
probably fine.

Closes #4594.
2025-06-21 18:13:09 +02:00
Arne Welzel
25b5cabab7 DNS: Move extract_char_string() helper around 2025-06-21 13:50:29 +02:00
Evan Typanski
826ed4cef5 Remove list from Zeek grammar
Using it would make Zeek segfault (at least in locals). It has been an
error for 15 years.
2025-06-20 15:53:15 -04:00
Arne Welzel
cf43cf1809 cluster/zeromq/connect: Make failures fatal
The cluster is borked if the initialization fails, so may as well just
completely abort Zeek at that point with a fatal error. There's no real
point in continuing to run.
2025-06-20 13:03:47 +02:00
Arne Welzel
a20a2fe6e0 cluster/zeromq: Move log_push creation to DoInit()
The log_push socket should be affected by the IPV6 option, so need to
delay its creation a bit.
2025-06-20 11:17:49 +02:00
Johanna Amann
0c875220e9 Default canonifier change to only remove first timestamp in line
In the past, we used a default canonifier, which removes everything that
looks like a timestamp from log files. The goal of this is to prevent
logs from changing, e.g., due to local system times ending up in log
files.

This, however, also has the side-effect of removing information that is
parsed from protocols which probably should be part of our tests.
There is at least one test (1999 certificates) where the entire test
output was essentially removed by the canonifier.

GH-4521 was similarly masked by this.

This commit changes the default canonifier, so that only the first
timestamp in a line is removed. This should skip timestamps that are
likely to change while keeping timestamps that are parsed
from protocol information.

A pass has been made over the tests, with some additional adjustments
for cases which require the old canonifier.

There are some cases in which we probably could go further and not
remove timestamps at all - that, however, seems like a follow-up
project.
2025-06-18 15:41:48 +01:00
Johanna Amann
6e1097a423 Align SMB timestamp calculation between operating systems
The way that SMB timestamps were calculated used a "long double" for
the conversion calculation.

OS-X and Linux seem to have different sizes for long doubles. On the
Linux distributions that I have available, a long double is 128bits, vs
64 bits in OS-X.

This leads to slight discrepancies in the timestamps. This commit
changes this calculation to use a double on both systems, which is 64
bits and eliminates this difference.
2025-06-18 15:41:40 +01:00
Johanna Amann
a22837536d Merge remote-tracking branch 'origin/topic/johanna/gh-4521'
* origin/topic/johanna/gh-4521:
  Change x509 not_before/not_after to not be based on local timezone
2025-06-18 13:27:57 +01:00
Johanna Amann
e797e15d38 Change x509 not_before/not_after to not be based on local timezone
Not the not_before/not_after fields output GMT based times.

Also adds a new btest diff canonifier which only removes the first
timestamp in a line.

Fixes GH-4521
2025-06-18 13:21:35 +01:00
Johanna Amann
ea23581ef7 Merge remote-tracking branch 'origin/topic/timw/deprecate-zeekstring-vector-methods'
* origin/topic/timw/deprecate-zeekstring-vector-methods:
  Mark ZeekString vector helper methods deprecated
2025-06-18 12:29:47 +01:00
Benjamin Bannier
2866934792 Merge branch 'topic/bbannier/spicy-ssl-refs' 2025-06-18 13:14:13 +02:00
Benjamin Bannier
bf4dce5e5f Enable Spicy SSL analyzer in nightly CI job against Spicy HEAD 2025-06-18 11:00:18 +02:00
Benjamin Bannier
ea4d30eb6a Clean up use of references in Spicy SSL analyzer
The Spicy SSL analyzer was using references pretty heavily, probably to
work around now fixed issues with `inout` parameters in older Spicy
versions. At least for units this seems not needed anymore, and was also
partially incorrect, e.g., the Spicy docs call out that when using
`inout` parameters, passed and expected types should match exactly so
passing a reference as an `inout` value seems incorrect. Additionally,
one use case for references in Spicy is to use their interior
mutability, i.e., a reference never needs to be passed `inout` since
their can always be mutated.

Internally units are stored as reference-counted values, and references
to units are not much cheaper since they also need to be refcounted.
With that there seems litle reason to use references in this analyzer at
all, and this patch drops their use completely; instead we either pass
values, or values declared `inout`.

We leave the use of references for sharing sinks in place.
2025-06-18 10:49:38 +02:00
Benjamin Bannier
1c3b7273d6 Add workaround for zeek/spicy#2091 2025-06-18 10:49:38 +02:00
Arne Welzel
19f2621f7b Merge remote-tracking branch 'origin/topic/awelzel/4573-remove-is-packet-source'
* origin/topic/awelzel/4573-remove-is-packet-source:
  IOSource: Remove IsPacketSource
2025-06-17 09:25:39 +02:00
Arne Welzel
2bc320cf11 IOSource: Remove IsPacketSource
This wasn't used in tree and even the PktSrc class doesn't override this
to return true, so just remove it outright without deprecation.

Closes #4573
2025-06-17 09:25:03 +02:00
Arne Welzel
f4357485d2 Merge remote-tracking branch 'origin/topic/awelzel/4562-post-proc-lookup-failure'
* origin/topic/awelzel/4562-post-proc-lookup-failure:
  btest/logging: Fly-by cleanup
  logging/Ascii: Fix abort() for non-existing postrotation functions
2025-06-16 14:58:49 +02:00
Arne Welzel
bcca7702cd btest/logging: Fly-by cleanup 2025-06-16 14:56:30 +02:00
Arne Welzel
45f5a4c1b8 logging/Ascii: Fix abort() for non-existing postrotation functions
When looking up the postprocessor function from shadow files, id::find_func()
would abort() if the function wasn't available instead of falling back
to the default postprocessor.

Fix by using id::find() and checking the type explicitly and also adding a
strict type check while at it.

This issue was tickled by loading the json-streaming-logs package,
Zeek creating shadow files containing its custom postprocessor function,
then restarting Zeek without the package loaded.

Closes #4562
2025-06-16 14:55:49 +02:00
Benjamin Bannier
e35fc1b7b1 Merge branch 'topic/bbannier/bump-spicy' 2025-06-16 14:39:52 +02:00
Arne Welzel
99155f6ec6 Merge remote-tracking branch 'origin/topic/awelzel/add-ws-tls-nocert-btest'
* origin/topic/awelzel/add-ws-tls-nocert-btest:
  btest/cluster/websocket: Add cert-less test
2025-06-16 13:48:08 +02:00
Arne Welzel
77f1337b4c btest/cluster/websocket: Add cert-less test 2025-06-16 13:47:33 +02:00
Benjamin Bannier
fe27962836 Bump auxil/spicy to latest development snapshot 2025-06-16 10:39:21 +02:00
zeek-bot
2242423aa3 Update doc submodule [nomail] [skip ci] 2025-06-12 00:26:21 +00:00
Tim Wojtulewicz
2b8cb515b9 Merge remote-tracking branch 'origin/topic/timw/fix-master'
* origin/topic/timw/fix-master:
  Add missing #include to packet_analysis/Component.h
2025-06-11 13:18:43 -07:00
Tim Wojtulewicz
f712c77682 Add missing #include to packet_analysis/Component.h 2025-06-11 12:10:14 -07:00
Tim Wojtulewicz
0a8149c185 Merge remote-tracking branch 'origin/topic/timw/util-types'
* origin/topic/timw/util-types:
  Remove some unused #includes from spicy code
  Remove using util.h in various headers in favor of util-types.h
  Move type definitions/aliases from util.h to a separate file
2025-06-11 11:12:27 -07:00
Tim Wojtulewicz
dc42f0fd5f Remove some unused #includes from spicy code 2025-06-11 11:11:54 -07:00
Tim Wojtulewicz
f8c04998af Remove using util.h in various headers in favor of util-types.h 2025-06-11 11:11:54 -07:00
Tim Wojtulewicz
9928403b0b Move type definitions/aliases from util.h to a separate file 2025-06-11 11:11:54 -07:00
Christian Kreibich
62442058e7 Merge branch 'topic/christian/enumval-string-fix'
* topic/christian/enumval-string-fix:
  Bugfix: AsString() on an EnumVal will segfault
2025-06-11 09:01:03 -07:00
Arne Welzel
f5063bfcd4 Merge remote-tracking branch 'origin/topic/awelzel/4522-bdat-last-reply-fix'
* origin/topic/awelzel/4522-bdat-last-reply-fix:
  smtp: Fix last_reply column in smtp.log for BDAT LAST
2025-06-11 17:25:21 +02:00
zeek-bot
53c56491ee Update doc submodule [nomail] [skip ci] 2025-06-11 00:30:17 +00:00
Christian Kreibich
dcf6e7432d Bugfix: AsString() on an EnumVal will segfault
This likely simply hasn't come up in practice, but we now go the intended route
of producing the textual enum value from the type.
2025-06-10 15:16:11 -07:00
Tim Wojtulewicz
14ca808bcf Merge remote-tracking branch 'origin/topic/timw/netbios-ssn-session-timeout-constant'
* origin/topic/timw/netbios-ssn-session-timeout-constant:
  Move netbios_ssn_session_timeout to a script-level constant
2025-06-10 12:08:46 -07:00
Tim Wojtulewicz
ed51738668 Move netbios_ssn_session_timeout to a script-level constant 2025-06-10 11:58:20 -07:00
Arne Welzel
61f93f9eb6 Merge remote-tracking branch 'origin/topic/awelzel/disable-zam-bif-tracking'
* origin/topic/awelzel/disable-zam-bif-tracking:
  btest/opt/ZAM-bif-tracking: Disable by default
2025-06-10 18:50:54 +02:00
Arne Welzel
dc26558894 btest/opt/ZAM-bif-tracking: Disable by default
After a public discussion and also chatting with Vern directly, disable the
ZAM bif tracking test to avoid an update every time new functions are
added. Usually these aren't performance critical and the defaults
characterization is fine. If they are performance critical, then Vern
is currently best positioned to properly integrate an optimized version.
2025-06-10 15:53:18 +02:00
Christian Kreibich
2f8bbeab1f Merge branch 'topic/christian/btest-trace-cleanup'
* topic/christian/btest-trace-cleanup:
  Btests: don't use -C in Zeek invocations that don't actually need it
  Remove executable file permission bits from a bunch of our pcaps
2025-06-09 18:00:44 -07:00
zeek-bot
9e2accf016 Update doc submodule [nomail] [skip ci] 2025-06-07 00:24:09 +00:00
Christian Kreibich
8b39e59572 Btests: don't use -C in Zeek invocations that don't actually need it 2025-06-06 13:46:45 -07:00
Christian Kreibich
e3cecdf04d Remove executable file permission bits from a bunch of our pcaps 2025-06-06 12:35:14 -07:00
Tim Wojtulewicz
e6d0f8a64d Mark ZeekString vector helper methods deprecated 2025-06-06 12:26:43 -07:00
Tim Wojtulewicz
ac9ee9f219 Merge remote-tracking branch 'origin/topic/timw/clang-tidy-modernize-fixes'
* origin/topic/timw/clang-tidy-modernize-fixes:
  Move initialization of RandTest members to header
  Update .clang-tidy to have modernize-* enabled with some exclusions
  Fix clang-tidy modernize-use-transparent-functors findings
  Fix clang-tidy modernize-use-override findings
  Fix clang-tidy modernize-use-nullptr findings
  Fix clang-tidy modernize-use-emplace findings
  Fix clang-tidy modernize-use-default-member-init findings
  Fix clang-tidy modernize-use-bool-literals findings
  Fix clang-tidy modernize-return-braced-init-list findings
  Fix clang-tidy modernize-redundant-void-arg findings
  Fix clang-tidy modernize-pass-by-value findings
  Fix clang-tidy modernize-min-max-use-initializer-list findings
  Fix clang-tidy modernize-make-unique findings
  Fix clang-tidy modernize-loop-convert findings (LOOP_OVER_ macros)
  Fix clang-tidy modernize-loop-convert findings
  Update bifcl submodule with clang-tidy fixes [nomail]
2025-06-06 11:45:59 -07:00
Tim Wojtulewicz
b22caa812d Move initialization of RandTest members to header 2025-06-06 11:43:06 -07:00
Tim Wojtulewicz
359ab18bf7 Update .clang-tidy to have modernize-* enabled with some exclusions 2025-06-06 11:43:06 -07:00
Tim Wojtulewicz
0681ab9071 Fix clang-tidy modernize-use-transparent-functors findings 2025-06-06 11:43:06 -07:00
Tim Wojtulewicz
2f0e3a5e23 Fix clang-tidy modernize-use-override findings 2025-06-06 11:43:06 -07:00
Tim Wojtulewicz
ee319fc1c5 Fix clang-tidy modernize-use-nullptr findings 2025-06-06 11:43:06 -07:00
Tim Wojtulewicz
a3078f3132 Fix clang-tidy modernize-use-emplace findings 2025-06-06 11:43:06 -07:00
Tim Wojtulewicz
3943e64372 Fix clang-tidy modernize-use-default-member-init findings 2025-06-06 11:43:06 -07:00
Tim Wojtulewicz
0227e3a545 Fix clang-tidy modernize-use-bool-literals findings 2025-06-06 11:43:06 -07:00
Tim Wojtulewicz
17c14a3ce1 Fix clang-tidy modernize-return-braced-init-list findings 2025-06-06 11:43:06 -07:00
Tim Wojtulewicz
8c3eee7a87 Fix clang-tidy modernize-redundant-void-arg findings 2025-06-06 11:43:06 -07:00
Tim Wojtulewicz
5930d2f944 Fix clang-tidy modernize-pass-by-value findings 2025-06-06 11:43:06 -07:00
Tim Wojtulewicz
46e67a749a Fix clang-tidy modernize-min-max-use-initializer-list findings 2025-06-06 11:43:06 -07:00
Tim Wojtulewicz
2aa2e2c071 Fix clang-tidy modernize-make-unique findings 2025-06-06 11:43:06 -07:00
Tim Wojtulewicz
5d3222cbfe Fix clang-tidy modernize-loop-convert findings (LOOP_OVER_ macros) 2025-06-06 11:43:06 -07:00
Tim Wojtulewicz
f3588657bf Fix clang-tidy modernize-loop-convert findings 2025-06-06 11:43:06 -07:00
Tim Wojtulewicz
49b803c0a8 Update bifcl submodule with clang-tidy fixes [nomail] 2025-06-06 11:43:06 -07:00
Christian Kreibich
b95f1b0925 Merge branch 'topic/christian/zeekygen-parse-only'
* topic/christian/zeekygen-parse-only:
  Fix a typo.
  Update NEWS for Zeekygen parse-only change.
  Remove adjustments and custom terminate() for Zeekygen invocation.
  Suppress warnings on deprecated DPD scripts during Zeekygen
  Stop suppressing stdout during Zeekygen docs generation
  Make Zeekygen docs generation (-X) imply parse-only (-a)
2025-06-06 10:43:32 -07:00
Arne Welzel
2468fe2355 Merge branch 't/gh-4448' of https://github.com/AmazingPP/zeek
* 't/gh-4448' of https://github.com/AmazingPP/zeek:
  Fix `&ordered` attribute not preserved in table initializer assignments
2025-06-06 17:35:54 +02:00
Arne Welzel
d650589ad4 smtp: Fix last_reply column in smtp.log for BDAT LAST
The response to BDAT LAST was never recognized, resulting in the
BDAT LAST commands not being logged in a timely fashion and receiving
the wrong status.

This likely doesn't handle complex pipeline scenarios, but it fixes
the wrong behavior for smtp_reply() not handling simple BDAT commands
responses.

Thanks @cccs-jsjm for the report!

Closes #4522
2025-06-06 10:40:49 +02:00
Arne Welzel
8189716adc Merge branch 'topic/ado/final-docker' of https://github.com/edoardomich/zeek
* 'topic/ado/final-docker' of https://github.com/edoardomich/zeek:
  docker: Add `net-tools` and `procps` dependencies
2025-06-06 10:26:45 +02:00
Edoardo Mich
3eec9daae6 docker: Add net-tools and procps dependencies
Add `net-tools` and `procps` to the final.Dockerfile, to avoid warning in
zeekctl commands like: "failed to find local IP addresses [...]" and the
error in `zeekctl top` command caused respectively by missing `ifconfig`
and `top` commands.
2025-06-06 09:17:01 +02:00
Tim Wojtulewicz
1ba2f62b4e Merge remote-tracking branch 'origin/topic/timw/configure-output-follow-up'
* origin/topic/timw/configure-output-follow-up:
  Follow-ups to configure output reformatting
2025-06-05 20:31:11 -07:00
Tim Wojtulewicz
66ba1baddf Follow-ups to configure output reformatting 2025-06-05 20:30:50 -07:00
Christian Kreibich
1dcd13a019 Fix a typo. 2025-06-05 17:51:54 -07:00
Christian Kreibich
aa4c176835 Update NEWS for Zeekygen parse-only change. 2025-06-05 17:51:49 -07:00
Christian Kreibich
fc29aae183 Remove adjustments and custom terminate() for Zeekygen invocation. 2025-06-05 17:44:15 -07:00
Christian Kreibich
c1cec7aec7 Suppress warnings on deprecated DPD scripts during Zeekygen
Also fix corresponding baseline.
2025-06-05 17:44:10 -07:00
zeek-bot
cd71dfed14 Update doc submodule [nomail] [skip ci] 2025-06-06 00:29:39 +00:00
Christian Kreibich
678a22461c Stop suppressing stdout during Zeekygen docs generation
It's no longer needed to suppress noise, and any output is now actually of
interest.
2025-06-05 17:12:16 -07:00
Christian Kreibich
ec89d6ffff Make Zeekygen docs generation (-X) imply parse-only (-a)
Nobody generates docs at startup while then moving on to regular Zeek operation,
and the generated runtime output when loading scripts/zeekygen is both noisy and
confusing.
2025-06-05 17:11:10 -07:00
Tim Wojtulewicz
e6492f7c7b Merge remote-tracking branch 'origin/topic/timw/storage-expire-contention'
* origin/topic/timw/storage-expire-contention:
  Add busy_timeout script-level option, override any busy_timeout pragma
  Handle potential contention when running sqlite expiration
  Add expiration to sqlite-cluster.btest
  Use unique_ptr to avoid needing to call sqlite3_reset manually
  Move Deferred class from ZeroMQ to util
2025-06-05 12:43:50 -07:00
Tim Wojtulewicz
be71196fa7 Add busy_timeout script-level option, override any busy_timeout pragma 2025-06-05 10:21:50 -07:00
Tim Wojtulewicz
0e5b3def84 Handle potential contention when running sqlite expiration 2025-06-05 10:21:50 -07:00
Tim Wojtulewicz
fb165c5ef1 Add expiration to sqlite-cluster.btest 2025-06-05 10:21:50 -07:00
Tim Wojtulewicz
97a2ec379e Use unique_ptr to avoid needing to call sqlite3_reset manually 2025-06-05 10:21:50 -07:00
Tim Wojtulewicz
850b20e12b Move Deferred class from ZeroMQ to util 2025-06-05 10:21:50 -07:00
Johanna Amann
c68dfdca2f Merge remote-tracking branch 'origin/topic/johanna/gh-4547'
* origin/topic/johanna/gh-4547:
  Temporarily disable pppoe-over-qinq-test for spicy-ssl
2025-06-05 18:16:45 +01:00
Johanna Amann
f8e5b90f9a Temporarily disable pppoe-over-qinq-test for spicy-ssl
The analyzer.log changes exposed a new bug in the Spicy SSL
implemenataion.

Relates to GH-4547
2025-06-05 17:28:47 +01:00
Tim Wojtulewicz
a289307e50 Merge remote-tracking branch 'origin/topic/timw/clang-20-build-warnings'
* origin/topic/timw/clang-20-build-warnings:
  Silence -Wnontrivial-memcall warning in ConnKey methods
2025-06-05 08:22:40 -07:00
Tim Wojtulewicz
badca1e604 Merge remote-tracking branch 'origin/topic/timw/update-broker'
* origin/topic/timw/update-broker:
  Update broker submodule [nomail]
2025-06-05 08:21:42 -07:00
Johanna Amann
e6755325e1 Merge remote-tracking branch 'origin/topic/johanna/new-style-analyzer-log'
* origin/topic/johanna/new-style-analyzer-log:
  NEWS entries for analyzer log changes
  Move detect-protocol from frameworks/dpd to frameworks/analyzer
  Introduce new c$failed_analyzers field
  Settle on analyzer.log for the dpd.log replacement
  dpd->analyzer.log change - rename files
  Analyzer failure logging: tweaks and test fixes
  Introduce analyzer-failed.log, as a replacement for dpd.log
  Rename analyzer.log to analyzer.debug log; move to policy
  Move dpd.log to policy script
2025-06-05 07:22:35 +01:00
Tim Wojtulewicz
62dc6ce7bc Merge remote-tracking branch 'origin/topic/timw/clang-tidy-cppcoreguidelines-fixes'
* origin/topic/timw/clang-tidy-cppcoreguidelines-fixes:
  Add some notes about missing/disabled cppcoreguildlines clang-tidy checkers
  Fix clang-tidy cppcoreguidelines-macro-usage findings (macro functions)
  Fix clang-tidy cppcoreguidelines-macro-usage findings (macros as constants)
  script_opt: Add missing virtual destructor (cppcoreguidelines-virtual-class-destructor)
2025-06-04 09:38:38 -07:00
Tim Wojtulewicz
05aa4690ad Add some notes about missing/disabled cppcoreguildlines clang-tidy checkers 2025-06-04 09:24:05 -07:00
Tim Wojtulewicz
460fe24a9a Fix clang-tidy cppcoreguidelines-macro-usage findings (macro functions) 2025-06-04 09:24:05 -07:00
Tim Wojtulewicz
ad99a6821e Fix clang-tidy cppcoreguidelines-macro-usage findings (macros as constants) 2025-06-04 09:24:05 -07:00
Tim Wojtulewicz
d6d56d330b script_opt: Add missing virtual destructor (cppcoreguidelines-virtual-class-destructor) 2025-06-04 09:24:05 -07:00
Johanna Amann
c392cda11c Merge remote-tracking branch 'origin/topic/johanna/parallelize-coverage-bare-mode-errors'
* origin/topic/johanna/parallelize-coverage-bare-mode-errors:
  Parallelize coverage/bare-mode-errors
2025-06-04 15:56:37 +01:00
Evan Typanski
14fa756d31 Merge remote-tracking branch 'origin/topic/etyp/fix-reenable-analyzer-log'
* origin/topic/etyp/fix-reenable-analyzer-log:
  Fix Spicy re-enable builtin analyzer debug message
2025-06-04 08:40:27 -04:00
Johanna Amann
c51998361c Parallelize coverage/bare-mode-errors
Currently, coverage/bare-mode-errors is one of the slowest tests in the
entire test suite. This is caused by the fact that it has to repeatedly
launch Zeek for every script that we ship. This is done sequentially.

This commit changes this test to use xargs to spawn 20 parallell
processes.
2025-06-04 13:18:05 +01:00
Johanna Amann
9466b10387 NEWS entries for analyzer log changes 2025-06-04 12:16:09 +01:00
Johanna Amann
f02e817aea Move detect-protocol from frameworks/dpd to frameworks/analyzer
detect-protocol.zeek was the last non-deprecated script left in
policy/frameworks/dpd. It was moved to policy/frameworks/analyzer. A
script that loads the script from the new location with a deprecation
warning was added.
2025-06-04 12:16:09 +01:00
Johanna Amann
58613f0313 Introduce new c$failed_analyzers field
This field is used internally to trace which analyzers already had a
violation. This is mostly used to prevent duplicate logging.

In the past, c$service_violation was used for a similar purpose -
however it has slightly different semantics. Where c$failed_analyzers
tracks analyzers that were removed due to a violation,
c$service_violation tracks violations - and doesn't care if an analyzer
was actually removed due to it.
2025-06-04 12:07:13 +01:00
赵富鹏
074faf202f Fix &ordered attribute not preserved in table initializer assignments 2025-06-04 17:07:34 +08:00
zeek-bot
fd98958b92 Update doc submodule [nomail] [skip ci] 2025-06-04 00:23:30 +00:00
Tim Wojtulewicz
0ef2710ca1 Add a missing #include needed by ZeekString on Windows 2025-06-03 15:19:22 -07:00
Tim Wojtulewicz
38ec080196 Update redis btest baselines 2025-06-03 13:37:03 -07:00
Tim Wojtulewicz
3ae9d8ba90 Merge remote-tracking branch 'origin/topic/timw/4350-redis-passwords'
* origin/topic/timw/4350-redis-passwords:
  Redis: Add support for sending AUTH commands during connection
  Redis: disconnect cleanly if INFO request fails
  Fix segfault if storage sync open_backend returns bad code
  Add ToStdString and ToStdStringView to ZeekString
2025-06-03 11:54:23 -07:00
Tim Wojtulewicz
f2aca331ec Redis: Add support for sending AUTH commands during connection 2025-06-03 11:38:38 -07:00
Tim Wojtulewicz
9f12208f57 Redis: disconnect cleanly if INFO request fails 2025-06-03 11:38:38 -07:00
Tim Wojtulewicz
0d18ce4e13 Fix segfault if storage sync open_backend returns bad code 2025-06-03 11:38:38 -07:00
Tim Wojtulewicz
d570486f36 Add ToStdString and ToStdStringView to ZeekString 2025-06-03 11:38:38 -07:00
Johanna Amann
42ba2fcca0 Settle on analyzer.log for the dpd.log replacement
This commit renames analyzer-failed.log to analyzer.log, and updates the
respective news entry.
2025-06-03 17:33:36 +01:00
Johanna Amann
130c89a0a7 dpd->analyzer.log change - rename files
To address review feedback in GH-4362: rename analyzer-failed-log.zeek
to loggig.zeek, analyzer-debug-log.zeek to debug-logging.zeek and
dpd-log.zeek to deprecated-dpd-log.zeek.

Includes respective test, NEWS, etc updates.
2025-06-03 16:32:52 +01:00
Evan Typanski
23b244367b Fix Spicy re-enable builtin analyzer debug message 2025-06-03 11:02:30 -04:00
Johanna Amann
af77a7a83b Analyzer failure logging: tweaks and test fixes
The main part of this commit are changes in tests. A lot of the tests
that previously relied on analyzer.log or dpd.log now use the new
analyzer-failed.log.

I verified all the changes and, as far as I can tell, everything
behaves as it should. This includes the external test baselines.

This change also enables logging of file and packet analyzer to
analyzer_failed.log and fixes some small behavior issues.

The analyzer_failed event is no longer raised when the removal of an
analyzer is vetoed.

If an analyzer is no longer active when an analyzer violation is raised,
currently the analyzer_failed event is raised. This can, e.g., happen
when an analyzer error happens at the very end of the connection. This
makes the behavior more similar to what happened in the past, and also
intuitively seems to make sense.

A bug introduced in the failed service logging was fixed.
2025-06-03 15:56:42 +01:00
Johanna Amann
8c814fa88c Introduce analyzer-failed.log, as a replacement for dpd.log
Analyzer-failed.log is, essentially, the replacement for dpd.log. The
name should make more sense, as it does now log analyzer failures. For
protocol analyzers specifically, these are failures that lead to the
analyzer being disabled.
2025-06-03 15:17:26 +01:00
Johanna Amann
c55e21da71 Rename analyzer.log to analyzer.debug log; move to policy
The current analyzer.log is more useful for debugging than for
operational purposes. Hence this is disabled by default, moved to a
policy script, and the log is renamed to analyzer-debug.log.

Furthermore, logging of analyzer confirmations and disabling analyzers
are now enabled by default.
2025-06-03 15:17:26 +01:00
Johanna Amann
6183c5086b Move dpd.log to policy script
This is the first phase of moving from the current dpd log to a more
modern logfile, without some of the weirdnesses that the current dpd log
contains.

Tests will not pass in the current state; this is just splitting out
functionality.
2025-06-03 15:17:26 +01:00
zeek-bot
f96ce6727f Update doc submodule [nomail] [skip ci] 2025-06-03 00:29:11 +00:00
Tim Wojtulewicz
f76a2437cd Merge remote-tracking branch 'origin/topic/timw/update-windows-ci'
* origin/topic/timw/update-windows-ci:
  Update libunistd submodule [nomail]
  Update Windows CI image to Visual Studio 2022
2025-06-02 14:53:01 -07:00
Tim Wojtulewicz
cd2514f9de Update libunistd submodule [nomail] 2025-06-02 14:52:05 -07:00
Tim Wojtulewicz
295efa7e83 Update Windows CI image to Visual Studio 2022 2025-06-02 14:52:05 -07:00
Tim Wojtulewicz
237c7da47a Merge remote-tracking branch 'origin/topic/timw/bump-opensuse-tumbleweed-docker-image'
* origin/topic/timw/bump-opensuse-tumbleweed-docker-image:
  CI: Force rebuild of opensuse tumbleweed docker image
2025-06-02 14:31:39 -07:00
Tim Wojtulewicz
aea614be56 Merge remote-tracking branch 'origin/topic/robin/gh-4501-eod-abort'
* origin/topic/robin/gh-4501-eod-abort:
  Bump Spicy to pull in fix.
2025-06-02 14:30:51 -07:00
Tim Wojtulewicz
d0f82d8e15 Merge remote-tracking branch 'origin/topic/awelzel/bump-zeekjs-0-17-1'
* origin/topic/awelzel/bump-zeekjs-0-17-1:
  Bump zeekjs to v0.17.1
2025-06-02 11:45:15 -07:00
Tim Wojtulewicz
f2b6fbe1a4 Merge remote-tracking branch 'origin/topic/bbannier/comment-fix'
* origin/topic/bbannier/comment-fix:
  Fix incorrectly copied comment [skip CI]
2025-06-02 11:44:05 -07:00
Tim Wojtulewicz
44a95a61b8 CI: Force rebuild of opensuse tumbleweed docker image
Something is off with the libhiredis package that's installed
as part of the current image, and 'zypper patch' is failing to
update it during the prepare step. Force a rebuild so the
updated package is part of the image to start with.
2025-06-02 10:40:39 -07:00
Arne Welzel
4d03f21031 Bump zeekjs to v0.17.1
b340648 version: 0.17.1
    ccd32e1 ci/docker: Use Fedora 42, retire Fedora 40
    6893431 Nodejs: Use argv.data() over &argv[0]
2025-06-02 19:05:18 +02:00
Arne Welzel
0a34b39e7a Merge remote-tracking branch 'origin/topic/awelzel/4177-4178-custom-event-metadata-part-2'
* origin/topic/awelzel/4177-4178-custom-event-metadata-part-2:
  Event: Bail on add_missing_remote_network_timestamp without add_network_timestamp
  btest/plugin: Test custom metadata publish
  NEWS: Add note about generic event metadata
  cluster: Remove deprecated Event constructor
  cluster: Remove some explicit timestamp handling
  broker/Manager: Fetch and forward all metadata from events
  Event/init-bare: Add add_missing_remote_network_timestamp logic
  cluster/Backend/DoProcessEvent: Use generic metadata, not just timestamps
  cluster/Event: Support moving args and metadata from event
  cluster/serializer/broker: Support generic metadata
  cluster/Event: Generic metadata support
  Event: Use -1.0 for undefined/unset timestamps
  cluster: Use shorter obj_desc versions
  Desc: Add obj_desc() / obj_desc_short() overloads for IntrusivePtr
2025-06-02 17:33:22 +02:00
Arne Welzel
8fc86bb4b6 Event: Bail on add_missing_remote_network_timestamp without add_network_timestamp 2025-06-02 17:31:36 +02:00
Arne Welzel
0ab53c75cd btest/plugin: Test custom metadata publish
Usage demo for plugin writers to add custom event metadata and access in
in Zeek scripts.
2025-06-02 17:31:36 +02:00
Arne Welzel
7db03a8c77 NEWS: Add note about generic event metadata 2025-06-02 17:31:36 +02:00
Arne Welzel
8e87dcbdb2 cluster: Remove deprecated Event constructor
It is now unused, ditch it. This wasn't available in an LTS release yet
and anyhow is in the detail namespace.
2025-06-02 17:31:36 +02:00
Arne Welzel
e3a83addce cluster: Remove some explicit timestamp handling
Backend::MakeClusterEvent() for now is the only place to add implicit
network timestamp metadata within the cluster component.
2025-06-02 17:31:36 +02:00
Arne Welzel
e1f70164e0 broker/Manager: Fetch and forward all metadata from events
Also use the generic metadata version for publishing, keep the
ts-based API for now, but only add timestamps when
EventMetadata::add_network_timestamp is T. I'm not sure what the
right way forward here is, maybe deprecating Broker's publish event
variations and funneling through cluster.
2025-06-02 17:31:36 +02:00
Arne Welzel
96f2d5d369 Event/init-bare: Add add_missing_remote_network_timestamp logic
Make defaulting to the local network timestamp for remote events opt-in.
2025-06-02 17:31:36 +02:00
Arne Welzel
b87109fcf1 cluster/Backend/DoProcessEvent: Use generic metadata, not just timestamps 2025-06-02 17:31:36 +02:00
Arne Welzel
4996ba88fb cluster/Event: Support moving args and metadata from event 2025-06-02 17:31:36 +02:00
Arne Welzel
46d4b5825b cluster/serializer/broker: Support generic metadata
Instead of handling just the network timestamp, support extraction of
the whole metadata vector that broker events hold.
2025-06-02 17:31:36 +02:00
Arne Welzel
71412f35b7 cluster/Event: Generic metadata support
Instead of a timestamp attribute, switch to holding a EventMetadataVectorPtr
like zeek::Event instances do. Keep the old constructor until the end of
the patch series.
2025-06-02 17:31:36 +02:00
Arne Welzel
7b4b1779bf Event: Use -1.0 for undefined/unset timestamps
This can happen if either there's no network timestamp associated with
an event, or there's currently no event being dispatched. Using 0.0
isn't great as it's the normal start timestamp before reading a network
packet. Using -1.0 gives the caller a chance to check and realize what's
going on.
2025-06-02 17:31:36 +02:00
Benjamin Bannier
0dae8b8d2d Fix incorrectly copied comment [skip CI] 2025-06-02 13:24:24 +02:00
Arne Welzel
31f51f7a87 Merge remote-tracking branch 'origin/topic/bbannier/coverity-fixes'
* origin/topic/bbannier/coverity-fixes:
  Prefer `std::move` over copy
2025-06-02 10:17:24 +02:00
Arne Welzel
e5bb6317fa Merge remote-tracking branch 'origin/topic/vern/CPP-maint.May25'
* origin/topic/vern/CPP-maint.May25:
  minor BTest maintenance updates for -O gen-C++
  fix for more robustly finding BTests to assess for -O gen-C++
  fix for -O gen-C++ dealing with type constants of unnamed compound types
2025-06-02 10:12:27 +02:00
Arne Welzel
41f04eda72 Merge remote-tracking branch 'origin/topic/awelzel/intel-indicator-hooks'
* origin/topic/awelzel/intel-indicator-hooks:
  intel/seen/manage-event-groups: Policy script for toggling intel event groups
  intel: Add indicator_inserted and indicator_removed hooks
2025-06-02 09:52:07 +02:00
Arne Welzel
0619fe2f4f intel/seen/manage-event-groups: Policy script for toggling intel event groups
Co-authored-by: Mohan Dhawan <mohan@corelight.com>
2025-06-02 09:51:14 +02:00
Arne Welzel
7eb849ddf4 intel: Add indicator_inserted and indicator_removed hooks
This change adds two new hooks to the Intel framework that can be used
to intercept added and removed indicators and their type.

These hooks are fairly low-level. One immediate use-case is to count the
number of indicators loaded per Intel::Type and enable and disable the
corresponding event groups of the intel/seen scripts.

I attempted to gauge the overhead and while it's definitely there, loading
a file with ~500k DOMAIN entries takes somewhere around ~0.5 seconds hooks
when populated via the min_data_store store mechanism. While that
doesn't sound great, it actually takes the manager on my system 2.5
seconds to serialize and Cluster::publish() the min_data_store alone
and its doing that serially for every active worker. Mostly to say that
the bigger overhead in that area on the manager doing redundant work
per worker.

Co-authored-by: Mohan Dhawan <mohan@corelight.com>
2025-06-02 09:50:48 +02:00
Benjamin Bannier
1760d99c49 Prefer std::move over copy 2025-06-02 08:45:32 +02:00
Vern Paxson
614eb8d343 minor BTest maintenance updates for -O gen-C++ 2025-05-31 12:52:44 -07:00
Vern Paxson
9117ccab12 fix for more robustly finding BTests to assess for -O gen-C++ 2025-05-31 12:50:14 -07:00
Vern Paxson
e165e64fa5 fix for -O gen-C++ dealing with type constants of unnamed compound types 2025-05-31 12:49:37 -07:00
zeek-bot
224519c11a Update doc submodule [nomail] [skip ci] 2025-05-31 00:26:58 +00:00
Tim Wojtulewicz
3282bbc429 Merge remote-tracking branch 'origin/topic/vern/ZAM-maint.May25'
* origin/topic/vern/ZAM-maint.May25:
  fix for crash when interpreting transformed ASTs that include multi-field record assignments/additions
  Remove unused ZAM compiler method
2025-05-30 13:07:01 -07:00
Tim Wojtulewicz
70bc0d9deb Merge remote-tracking branch 'origin/topic/timw/cleanup-cmake-summary-output'
* origin/topic/timw/cleanup-cmake-summary-output:
  Add utility methods to make CMake summary output nicer
2025-05-30 12:16:35 -07:00
Tim Wojtulewicz
e93242726b Add utility methods to make CMake summary output nicer 2025-05-30 11:57:43 -07:00
Tim Wojtulewicz
dc5dd8be45 Merge remote-tracking branch 'origin/topic/timw/new-ci-pr-labels'
* origin/topic/timw/new-ci-pr-labels:
  CI: Add PR label for skipping all CI jobs
  CI: Add PR label for running cluster tests
2025-05-30 10:29:37 -07:00
Tim Wojtulewicz
bc4cf14237 CI: Add PR label for skipping all CI jobs 2025-05-30 10:29:02 -07:00
Tim Wojtulewicz
e9544386fe CI: Add PR label for running cluster tests 2025-05-30 10:27:52 -07:00
Vern Paxson
dc68a62a1e fix for crash when interpreting transformed ASTs that include multi-field record assignments/additions 2025-05-30 09:44:26 -07:00
Vern Paxson
ba0b7492a7 Remove unused ZAM compiler method 2025-05-30 09:38:42 -07:00
Tim Wojtulewicz
9c290df47f Merge remote-tracking branch 'origin/topic/timw/ci-clang-tidy'
* origin/topic/timw/ci-clang-tidy:
  CI: Add new task to run clang-tidy as part of nightly builds
  CI: Update to clang 19 on ubuntu 24.04, add clang-tidy package
2025-05-30 08:39:36 -07:00
Tim Wojtulewicz
bf9813a7c6 CI: Add new task to run clang-tidy as part of nightly builds 2025-05-30 08:39:14 -07:00
Tim Wojtulewicz
dbd787a81f CI: Update to clang 19 on ubuntu 24.04, add clang-tidy package 2025-05-30 08:39:14 -07:00
Arne Welzel
f4cd92e24a Merge remote-tracking branch 'origin/topic/awelzel/4494-ts-millis-signed'
* origin/topic/awelzel/4494-ts-millis-signed:
  logging/ascii/json: Make TS_MILLIS signed, add TS_MILLIS_UNSIGNED
2025-05-30 17:24:17 +02:00
Arne Welzel
93813a5079 logging/ascii/json: Make TS_MILLIS signed, add TS_MILLIS_UNSIGNED
It seems TS_MILLIS is specifically for Elasticsearch and starting with
Elasticsearch 8.2 epoch_millis does (again?) support negative epoch_millis,
so make Zeek produce that by default.

If this breaks a given deployment, they can switch Zeek back to TS_MILLIS_UNSIGNED.

https://discuss.elastic.co/t/migration-from-es-6-8-to-7-17-issues-with-negative-date-epoch-timestamp/335259
https://github.com/elastic/elasticsearch/pull/80208

Thanks for @timo-mue for reporting!

Closes #4494
2025-05-30 17:23:29 +02:00
Tim Wojtulewicz
c387ec87be Merge remote-tracking branch 'origin/topic/timw/clang-tidy-performance-fixes'
* origin/topic/timw/clang-tidy-performance-fixes:
  Add move operations for LogWriteHeader
  Add missing setting of type in session::Key move operations
  Update .clang-tidy to have performance-* enabled with some exclusions
  Fix clang-tidy performance-inefficient-string-concatenation warnings
  Fix clang-tidy performance-unnecessary-copy-initialization warnings
  Fix clang-tidy performance-move-const-argument warnings (not move assignable/copyable)
  Fix clang-tidy performance-move-const-argument warnings (passing move to const argument)
  Fix clang-tidy performance-move-const-argument warnings (moving trivially copyable)
  Fix clang-tidy performance-move-const-argument warnings (moving const variables)
  Fix clang-tidy performance-inefficient-vector-operation warnings
  Fix clang-tidy performance-for-range-copy warnings
  Fix clang-tidy performance-faster-string-find warnings
  Fix clang-tidy performance-enum-size warnings
  Fix clang-tidy performance-avoid-endl warnings
2025-05-30 08:13:19 -07:00
Tim Wojtulewicz
6eb49a10cc Add move operations for LogWriteHeader 2025-05-30 08:12:29 -07:00
Tim Wojtulewicz
df852255c6 Add missing setting of type in session::Key move operations 2025-05-30 08:12:29 -07:00
Tim Wojtulewicz
db69773d23 Update .clang-tidy to have performance-* enabled with some exclusions 2025-05-30 08:12:29 -07:00
Tim Wojtulewicz
c609d5c90a Fix clang-tidy performance-inefficient-string-concatenation warnings 2025-05-30 08:12:29 -07:00
Tim Wojtulewicz
cb8c35748a Fix clang-tidy performance-unnecessary-copy-initialization warnings 2025-05-30 08:12:29 -07:00
Tim Wojtulewicz
909413838c Fix clang-tidy performance-move-const-argument warnings (not move assignable/copyable) 2025-05-30 08:12:29 -07:00
Tim Wojtulewicz
57c10a6ace Fix clang-tidy performance-move-const-argument warnings (passing move to const argument) 2025-05-30 08:12:29 -07:00
Tim Wojtulewicz
ad4694f529 Fix clang-tidy performance-move-const-argument warnings (moving trivially copyable) 2025-05-30 08:12:29 -07:00
Tim Wojtulewicz
144a3dee3a Fix clang-tidy performance-move-const-argument warnings (moving const variables) 2025-05-30 08:12:29 -07:00
Tim Wojtulewicz
6196950567 Fix clang-tidy performance-inefficient-vector-operation warnings 2025-05-30 08:12:29 -07:00
Tim Wojtulewicz
b8e28abb97 Fix clang-tidy performance-for-range-copy warnings 2025-05-30 08:12:29 -07:00
Tim Wojtulewicz
178d7f4cd0 Fix clang-tidy performance-faster-string-find warnings 2025-05-30 08:12:29 -07:00
Tim Wojtulewicz
f4c47d0357 Fix clang-tidy performance-enum-size warnings 2025-05-30 08:12:29 -07:00
Tim Wojtulewicz
11a1d8d506 Fix clang-tidy performance-avoid-endl warnings 2025-05-30 08:02:55 -07:00
Arne Welzel
10bfb34a8a Update doc submodule [nomail] [skip ci]
Fix botched last-minute cleanup.
2025-05-30 16:49:10 +02:00
Arne Welzel
1d241fabf4 Merge remote-tracking branch 'origin/topic/awelzel/zeekygen-field-directive'
* origin/topic/awelzel/zeekygen-field-directive:
  Bump doc submodule for ext/zeek.py modifications
  RecordType:DescribeReST: Render RecordType using zeek:field directive
2025-05-30 16:44:42 +02:00
Tim Wojtulewicz
08f335b5f6 Update broker submodule [nomail] 2025-05-30 07:30:41 -07:00
Arne Welzel
f16ebd34b3 Merge remote-tracking branch 'origin/topic/awelzel/4474-cluster-websocket-ipv6'
* origin/topic/awelzel/4474-cluster-websocket-ipv6:
  IXWebsocket: Bump to version with memset() sock addr fix
  cluster/websocket: Deprecate $listen_host, introduce $listen_addr
  cluster/websocket-ixwebsocket: Determine proper address_family
2025-05-30 11:47:55 +02:00
Arne Welzel
66fef5a9bd IXWebsocket: Bump to version with memset() sock addr fix 2025-05-30 11:02:41 +02:00
Arne Welzel
544d571089 cluster/websocket: Deprecate $listen_host, introduce $listen_addr
This only changes the script-layer API, but keeps the std::string host
in the C++ layer's ServerOptions. Mostly because the ixwebsocket library
takes host as std::string. Also, maybe at  some point we'd want to
support something scheme-based like unix:///var/run/zeek.sock and placing
that in a string could not be totally wrong.

Add tests for IPV6, too.
2025-05-30 11:02:41 +02:00
Arne Welzel
8b029d0050 cluster/websocket-ixwebsocket: Determine proper address_family
Closes #4474
2025-05-30 11:01:31 +02:00
Tim Wojtulewicz
372986f052 Update docs submodue [nomail] [skip ci] 2025-05-28 11:44:09 -07:00
Tim Wojtulewicz
2d7aad2c81 Merge remote-tracking branch 'origin/topic/timw/remove-with-bind'
* origin/topic/timw/remove-with-bind:
  Remove obsolete --with-bind configure flag
2025-05-28 08:29:50 -07:00
Arne Welzel
871e81dd6a Bump doc submodule for ext/zeek.py modifications 2025-05-28 16:18:44 +02:00
Arne Welzel
71fb301e3d RecordType:DescribeReST: Render RecordType using zeek:field directive
This is for zeek/zeek-docs#324.
2025-05-28 15:59:50 +02:00
Robin Sommer
e494fb5d19
Bump Spicy to pull in fix.
Includes a new regression test.

Closes #4501.
2025-05-28 15:50:47 +02:00
Tim Wojtulewicz
9db9861f75 Remove obsolete --with-bind configure flag 2025-05-27 17:55:49 -07:00
zeek-bot
9ffc87a90e Update doc submodule [nomail] [skip ci] 2025-05-28 00:38:27 +00:00
Tim Wojtulewicz
bca6bc70b2 Silence -Wnontrivial-memcall warning in ConnKey methods 2025-05-27 13:48:37 -07:00
Tim Wojtulewicz
88ae3ba412 Merge remote-tracking branch 'origin/topic/timw/coverity'
* origin/topic/timw/coverity:
  Add a few std::moves to fix Coverity warnings
  Fix possible memory leak in broker::Manager
  fixup! Use SCN* constants when reading into sized integer types
  from_json: Statically lookup err index in result type
  Use SCN* constants when reading into sized integer types
  Remove setting unused variable value in FTP::parse_eftp
2025-05-27 12:49:13 -07:00
Tim Wojtulewicz
e4ab1a3b1d Add a few std::moves to fix Coverity warnings 2025-05-27 12:03:45 -07:00
Tim Wojtulewicz
ff7c908460 Fix possible memory leak in broker::Manager 2025-05-27 12:03:45 -07:00
Tim Wojtulewicz
54c5a470bd fixup! Use SCN* constants when reading into sized integer types 2025-05-27 12:03:45 -07:00
Tim Wojtulewicz
a6437142ce from_json: Statically lookup err index in result type 2025-05-27 12:03:45 -07:00
Tim Wojtulewicz
1992a55798 Use SCN* constants when reading into sized integer types 2025-05-27 12:03:45 -07:00
Tim Wojtulewicz
ff4d1a4121 Remove setting unused variable value in FTP::parse_eftp 2025-05-27 12:03:45 -07:00
Tim Wojtulewicz
aaca36dc22 Merge remote-tracking branch 'origin/topic/timw/clang-tidy-bugprone-fixes'
* origin/topic/timw/clang-tidy-bugprone-fixes: (22 commits)
  Update .clang-tidy to have bugprone-* enabled with some exclusions
  Fix clang-tidy bugprone-unused-return-value warnings
  Fix clang-tidy bugprone-unsafe-functions warnings
  Fix clang-tidy bugprone-unused-local-non-trivial-variable warnings
  Fix clang-tidy bugprone-throw-keyword-missing warnings
  Fix clang-tidy bugprone-switch-missing-default-case warnings
  Fix clang-tidy bugprone-suspicious-realloc-usage warnings
  Fix clang-tidy bugprone-suspicious-include warnings
  Fix clang-tidy bugprone-suspicious-string-compare warnings
  Fix clang-tidy bugprone-suspicious-stringview-data-usage warnings
  Fix clang-tidy bugprone-string-literal-with-embedded-nul warnings
  Fix clang-tidy bugprone-parent-virtual-call warnings
  Fix clang-tidy bugprone-misplaced-widening-cast warnings
  Fix clang-tidy bugprone-inc-dec-in-conditions warnings
  Fix clang-tidy bugprone-multi-level-implicit-pointer-conversion warnings
  Fix clang-tidy bugprone-macro-parentheses warnings
  Fix clang-tidy bugprone-incorrect-roundings warnings
  Fix clang-tidy bugprone-incorrect-division warnings
  Fix clang-tidy bugprone-implicit-widening-of-multiplication-result warnings
  Remove noexcept from util::tokenize_string
  ...
2025-05-27 11:59:46 -07:00
Tim Wojtulewicz
998479258a Update .clang-tidy to have bugprone-* enabled with some exclusions 2025-05-27 11:58:27 -07:00
Tim Wojtulewicz
637a7732c0 Fix clang-tidy bugprone-unused-return-value warnings 2025-05-27 11:58:27 -07:00
Tim Wojtulewicz
ae2ff9901b Fix clang-tidy bugprone-unsafe-functions warnings 2025-05-27 11:58:27 -07:00
Tim Wojtulewicz
d2045d1834 Fix clang-tidy bugprone-unused-local-non-trivial-variable warnings 2025-05-27 11:58:27 -07:00
Tim Wojtulewicz
8bb015754a Fix clang-tidy bugprone-throw-keyword-missing warnings
This one renames the Modbus Exception binpac type to ExcResponse. clang-tidy
insisted that anything named started with Exception was actually an exception
and needed to be thrown.
2025-05-27 11:58:27 -07:00
Tim Wojtulewicz
2c2a595af5 Fix clang-tidy bugprone-switch-missing-default-case warnings 2025-05-27 11:58:27 -07:00
Tim Wojtulewicz
b20419efaf Fix clang-tidy bugprone-suspicious-realloc-usage warnings 2025-05-27 11:58:27 -07:00
Tim Wojtulewicz
f643d02bf8 Fix clang-tidy bugprone-suspicious-include warnings 2025-05-27 11:58:27 -07:00
Tim Wojtulewicz
4d60d4833e Fix clang-tidy bugprone-suspicious-string-compare warnings 2025-05-27 11:58:27 -07:00
Tim Wojtulewicz
975f24bde6 Fix clang-tidy bugprone-suspicious-stringview-data-usage warnings 2025-05-27 11:58:27 -07:00
Tim Wojtulewicz
02589c349a Fix clang-tidy bugprone-string-literal-with-embedded-nul warnings 2025-05-27 11:58:27 -07:00
Tim Wojtulewicz
74acc30258 Fix clang-tidy bugprone-parent-virtual-call warnings 2025-05-27 11:58:27 -07:00
Tim Wojtulewicz
b3de432ef2 Fix clang-tidy bugprone-misplaced-widening-cast warnings 2025-05-27 11:58:27 -07:00
Tim Wojtulewicz
184757b3db Fix clang-tidy bugprone-inc-dec-in-conditions warnings 2025-05-27 11:58:27 -07:00
Tim Wojtulewicz
d0bbc61bd4 Fix clang-tidy bugprone-multi-level-implicit-pointer-conversion warnings 2025-05-27 11:58:27 -07:00
Tim Wojtulewicz
9e83759e83 Fix clang-tidy bugprone-macro-parentheses warnings 2025-05-27 11:58:27 -07:00
Tim Wojtulewicz
1d315a3847 Fix clang-tidy bugprone-incorrect-roundings warnings 2025-05-27 11:58:27 -07:00
Tim Wojtulewicz
87f1b1a7b3 Fix clang-tidy bugprone-incorrect-division warnings 2025-05-27 11:58:27 -07:00
Tim Wojtulewicz
18983aed02 Fix clang-tidy bugprone-implicit-widening-of-multiplication-result warnings 2025-05-27 11:58:27 -07:00
Tim Wojtulewicz
bdb0fad6d5 Remove noexcept from util::tokenize_string
One instance of this method is noexcept and one isn't. The version
that is noexcept uses std::vector::emplace_back, which may throw
exceptions. Instead of adding a try/catch block, opt for just making
the two functions able to throw exceptions.

This fixes a clang-tidy bugprone-exception-escape warning.
2025-05-27 11:58:27 -07:00
Tim Wojtulewicz
dbecfb5a2a Fix clang-tidy bugprone-branch-clone warnings 2025-05-27 11:58:27 -07:00
Tim Wojtulewicz
92854e95d3 Fix clang-tidy bugprone-assignment-in-if-condition warnings 2025-05-27 11:58:27 -07:00
Johanna Amann
8ce741a7a8 Merge remote-tracking branch 'origin/topic/johanna/gh-4463'
* origin/topic/johanna/gh-4463:
  Add explicit TLS support for FTP
2025-05-27 17:47:52 +01:00
Johanna Amann
718307214e Add explicit TLS support for FTP
This is defined in RFC 4217; TLS initialized by the client sending an
`AUTH TLS` command.

Fixes GH-4463
2025-05-27 16:57:51 +01:00
Evan Typanski
9f2fb47f48 Merge remote-tracking branch 'origin/topic/etyp/redis-analyzer'
* origin/topic/etyp/redis-analyzer:
  spicy-redis: Add NEWS entry
  spicy-redis: Separate error replies from success
  spicy-redis: Cleanup scripts and tests
  spciy-redis: Bring Redis analyzer into Zeek proper
  spicy-redis: Abort parsing if server data comes first
  spicy-redis: Add recursion depth to server data
  spicy-redis: Make client data only accept bulk strings
  spicy-redis: Add dpd signature and clean pcaps
  spicy-redis: Add some commands and touch up parsing
  spicy-redis: Add some script logic for logging
  spicy-redis: Separate client/server
  spicy-redis: Touchup logging and Spicy issues
  spicy-redis: Add synchronization and pipeline support
  spicy-redis: Begin Spicy Redis analyzer
2025-05-27 10:20:00 -04:00
Evan Typanski
1b962b0fa7 spicy-redis: Add NEWS entry 2025-05-27 10:12:52 -04:00
Evan Typanski
b4429a995a spicy-redis: Separate error replies from success 2025-05-27 09:31:25 -04:00
Evan Typanski
d5b121db14 spicy-redis: Cleanup scripts and tests
- Recomputes checksums for pcaps to keep clean
- Removes some tests that had big pcaps or weren't necessary
- Cleans up scripting names and minor points
- Comments out Spicy code that causes a build failure now with a TODO to
  uncomment it
2025-05-27 09:29:13 -04:00
Evan Typanski
11777bd6d5 spciy-redis: Bring Redis analyzer into Zeek proper 2025-05-27 09:28:12 -04:00
Evan Typanski
aef9fe11dc spicy-redis: Abort parsing if server data comes first
Redis seems to only want client data first to request server data. The
DPD signature seems to pick up on some cases where server data comes
first, but is otherwise "valid" RESP. See if this helps lower FP rates.
2025-05-27 09:28:12 -04:00
Evan Typanski
90d56ce630 spicy-redis: Add recursion depth to server data 2025-05-27 09:28:12 -04:00
Evan Typanski
292241f420 spicy-redis: Make client data only accept bulk strings 2025-05-27 09:28:12 -04:00
Evan Typanski
7f28ec8bc5 spicy-redis: Add dpd signature and clean pcaps 2025-05-27 09:28:12 -04:00
Evan Typanski
f0e9f46c7c spicy-redis: Add some commands and touch up parsing 2025-05-27 09:28:12 -04:00
Evan Typanski
22bda56af3 spicy-redis: Add some script logic for logging
Also "rebrands" from RESP to Redis.
2025-05-27 09:28:12 -04:00
Evan Typanski
757cbbf902 spicy-redis: Separate client/server
This makes the parser more official and splits the client/server out
from each other. Apparently they're different enough to be separate.
2025-05-27 09:28:12 -04:00
Evan Typanski
f0f2969a66 spicy-redis: Touchup logging and Spicy issues 2025-05-27 09:28:12 -04:00
Evan Typanski
97d26a689d spicy-redis: Add synchronization and pipeline support
Also adds some command support
2025-05-27 09:28:12 -04:00
Evan Typanski
4210e62e57 spicy-redis: Begin Spicy Redis analyzer 2025-05-27 09:28:12 -04:00
Benjamin Bannier
897b1546a2 Merge branch 'topic/bbannier/bump-spicy' 2025-05-27 15:13:59 +02:00
Benjamin Bannier
2104a84e0b Do not build tests for auxil/spicy 2025-05-27 15:12:09 +02:00
Benjamin Bannier
99243b5fbe Bump auxil/spicy to latest development snapshot 2025-05-27 09:17:57 +02:00
Arne Welzel
e2e13902f3 cluster: Use shorter obj_desc versions 2025-05-26 17:53:23 +02:00
Arne Welzel
0c18ec5e5d Desc: Add obj_desc() / obj_desc_short() overloads for IntrusivePtr
When using these helpers in code, one barely has raw pointers and the
repeated `.get()` call cumbersome and noisy.
2025-05-26 16:10:48 +02:00
Arne Welzel
cef63e871e Merge remote-tracking branch 'origin/topic/awelzel/fix-no-zero-timestamp-metadata'
* origin/topic/awelzel/fix-no-zero-timestamp-metadata:
  btest: Add test for Cluster::hello zero-timestamp
  EventMgr/Enqueue: Add automatic timestamp metadata to local events, only
  cluster and broker: Propagate zero-timestamp as metadata, too.
2025-05-26 16:08:58 +02:00
Arne Welzel
277c3f5245 btest: Add test for Cluster::hello zero-timestamp 2025-05-26 16:08:27 +02:00
Arne Welzel
a9d22611d0 EventMgr/Enqueue: Add automatic timestamp metadata to local events, only
It seems less surprising if only local events receive automatic network
timestamp metadata. For remote events the automatic value will most
likely be misleading.
2025-05-26 16:08:27 +02:00
Arne Welzel
d828e08a9e cluster and broker: Propagate zero-timestamp as metadata, too.
This will be cleaned up later to just pass all contained metadata from
a cluster event to the queued event, but for now do this here, otherwise
we break some internal tests.
2025-05-26 13:37:42 +02:00
zeek-bot
ffb07ce2bd Update doc submodule [nomail] [skip ci] 2025-05-24 00:24:08 +00:00
Tim Wojtulewicz
f996f661b6 Merge remote-tracking branch 'origin/topic/timw/redis-connection-failure'
* origin/topic/timw/redis-connection-failure:
  Redis: bump version of hiredis required
  Redis: return proper error if connection fails
2025-05-23 12:13:51 -07:00
Tim Wojtulewicz
85e27afaa8 Redis: bump version of hiredis required 2025-05-23 12:13:13 -07:00
Tim Wojtulewicz
0fb4548ff0 Redis: return proper error if connection fails 2025-05-23 12:13:13 -07:00
Arne Welzel
d929392a76 Merge remote-tracking branch 'origin/topic/awelzel/4177-4178-custom-event-metadata-part-1'
* origin/topic/awelzel/4177-4178-custom-event-metadata-part-1:
  Event: Move meta after args
  Event: Use IntrusivePtr to manage obj refcount
  btest/zam: Update for new EventMetadata bifs
  broker and cluster: Switch to new Enqueue() API
  Event/zeek.bif: Add EventMetadata current() and current_values() accessors
  Event: Deprecate default network timestamp metadata
  Event: Store timestamp in metadata vector
  EventRegistry/zeek.bif/init-bare: Add event metadata infrastructure
  EventMgr: Add CurrentEvent() accessor
2025-05-23 21:02:28 +02:00
Arne Welzel
bfcb68f8e7 Event: Move meta after args 2025-05-23 19:32:50 +02:00
Arne Welzel
89402fcc1b Event: Use IntrusivePtr to manage obj refcount
Fly-by cleanup.
2025-05-23 19:32:50 +02:00
Arne Welzel
e4e9ec3e80 btest/zam: Update for new EventMetadata bifs 2025-05-23 19:32:50 +02:00
Arne Welzel
506fea3335 broker and cluster: Switch to new Enqueue() API
This is a bit intermediary. In part 2 this will deal with any metadata,
not just timestamps.
2025-05-23 19:32:50 +02:00
Arne Welzel
75aa6588fe Event/zeek.bif: Add EventMetadata current() and current_values() accessors
...and basic smoke testing.
2025-05-23 19:32:50 +02:00
Arne Welzel
53b0f0ad64 Event: Deprecate default network timestamp metadata
This deprecates the Event constructor and the ``ts`` parameter of Enqueue()
Instead, versions are introduced that take a detail::MetadataVectorPtr which
can hold the network timestamp metadata and is meant to be allocated by the
caller instead of automatically during Enqueue() or within the Event
constructor.

This also introduces a BifConst ``EventMetadata::add_network_timestamp`` to
opt-in adding network timestamps to events globally. It's disabled by
default as there are not a lot of known use cases that need this.
2025-05-23 19:32:23 +02:00
Arne Welzel
12c523f3f7 Event: Store timestamp in metadata vector
This removes the ts attribute from Event and instead allocates a vector for
storing metadata. By default, adds the network time as a TimeVal. Later
patches will make the allocation of the vector optional by introducing a
different constructor so that users that are not interested in network
timestamp metadata do not take the allocation hit.

Moving the explicit ``ts`` out of the event is done in order to treat it
just as generic metadata, too. However, the Time() accessor is adapted to
lookup the value from the metadata vector instead.
2025-05-23 19:32:23 +02:00
Arne Welzel
cc7dc60c1e EventRegistry/zeek.bif/init-bare: Add event metadata infrastructure
Introduce a new EventMetadata module and members on EventMgr to register
event metadata types.
2025-05-23 19:31:58 +02:00
Arne Welzel
fc96c81c70 EventMgr: Add CurrentEvent() accessor
Avoid proliferation of accessors on EventMgr.
2025-05-23 19:31:06 +02:00
Tim Wojtulewicz
57b618ee4a Merge remote-tracking branch 'origin/topic/timw/remove-findclangtidy'
* origin/topic/timw/remove-findclangtidy:
  Remove FindClangTidy.cmake, update cmake submodule
2025-05-23 08:32:13 -07:00
Tim Wojtulewicz
b091f5b5c3 Remove FindClangTidy.cmake, update cmake submodule 2025-05-23 08:30:48 -07:00
zeek-bot
7110a8b838 Update doc submodule [nomail] [skip ci] 2025-05-23 00:16:11 +00:00
Tim Wojtulewicz
bb17d9e4d6 Merge remote-tracking branch 'origin/topic/timw/sqlite-cluster-test-followup'
* origin/topic/timw/sqlite-cluster-test-followup:
  SQLite: Add TODO note about possibly using sqlite3_busy_timeout
  SQLite: Fix typo in variable name causing pragmas not to retry on busy
  SQLite: Use tableval iteration instead of ToMap for pragmas
  SQLite: Fix logging/error messages around executing pragmas
2025-05-22 16:55:20 -07:00
Tim Wojtulewicz
8a27b894b6 SQLite: Add TODO note about possibly using sqlite3_busy_timeout 2025-05-22 10:23:17 -07:00
Tim Wojtulewicz
25f144381c SQLite: Fix typo in variable name causing pragmas not to retry on busy 2025-05-22 10:23:17 -07:00
Tim Wojtulewicz
57d797e087 SQLite: Use tableval iteration instead of ToMap for pragmas 2025-05-22 10:22:40 -07:00
Tim Wojtulewicz
384ea046b3 SQLite: Fix logging/error messages around executing pragmas 2025-05-22 10:22:40 -07:00
zeek-bot
0864048c3f Update doc submodule [nomail] [skip ci] 2025-05-22 00:15:56 +00:00
Tim Wojtulewicz
25dd1a2702 Disable sqlite-cluster btest
This test is being flaky on some platforms and still having problems
with executing pragmas at startup. Disable it for now until it can be
fixed.
2025-05-21 15:42:29 -07:00
Tim Wojtulewicz
6b104f3e22 Merge remote-tracking branch 'origin/topic/timw/fix-sqlite-btest-output'
* origin/topic/timw/fix-sqlite-btest-output:
  Update baseline of sqlite-basic btest after recent changes
2025-05-21 12:47:16 -07:00
Tim Wojtulewicz
0c7ad126d6 Update baseline of sqlite-basic btest after recent changes 2025-05-21 11:01:54 -07:00
Tim Wojtulewicz
1862e66097 Merge remote-tracking branch 'origin/topic/timw/sqlite-cluster-test'
* origin/topic/timw/sqlite-cluster-test:
  SQLite: Move integrity_check to pragma table
  SQLite: Add backend option for pragma timeout
  SQLite: Rename tuning_params to pragma_commands, move running pragmas to utility method
  SQLite: Retry pragma statements at startup to avoid contention
  SQLite: Check for locked database as well as busy databases
  SQLite: Fix some string-sizing issues
  SQLite: Run pragmas on connection before creating table
  SQLite: Add busy_timeout pragma to default options
  Prefix sqlite-based btests with sqlite- to match redis tests
  Add sqlite cluster storage btest
2025-05-21 09:41:15 -07:00
Tim Wojtulewicz
a58128a45c SQLite: Move integrity_check to pragma table 2025-05-21 09:38:27 -07:00
Tim Wojtulewicz
78dffb1d6f SQLite: Add backend option for pragma timeout 2025-05-21 09:38:27 -07:00
Tim Wojtulewicz
f0e7b78554 SQLite: Rename tuning_params to pragma_commands, move running pragmas to utility method 2025-05-21 09:38:27 -07:00
Tim Wojtulewicz
53cb3c3681 SQLite: Retry pragma statements at startup to avoid contention 2025-05-21 09:38:27 -07:00
Tim Wojtulewicz
227d24b64d SQLite: Check for locked database as well as busy databases 2025-05-21 09:38:27 -07:00
Tim Wojtulewicz
1bff4c9537 SQLite: Fix some string-sizing issues 2025-05-21 09:38:27 -07:00
Tim Wojtulewicz
ac064bd6af SQLite: Run pragmas on connection before creating table 2025-05-21 09:38:27 -07:00
Tim Wojtulewicz
26cc6d4e7b SQLite: Add busy_timeout pragma to default options 2025-05-21 09:38:27 -07:00
Tim Wojtulewicz
e91421a8de Prefix sqlite-based btests with sqlite- to match redis tests 2025-05-21 09:38:27 -07:00
Tim Wojtulewicz
41bddae59f Add sqlite cluster storage btest 2025-05-21 09:38:27 -07:00
Arne Welzel
891338194f Merge remote-tracking branch 'origin/topic/awelzel/fixup-detect-sql-injection-zeekygen-comment'
* origin/topic/awelzel/fixup-detect-sql-injection-zeekygen-comment:
  http/detect-sql-injection: Fix zeekygen comment
  btest/coverage/test-all-policy-zeekygen: Load test-all-policy with zeekygen enabled
2025-05-21 13:39:07 +02:00
Arne Welzel
8d588a10a9 http/detect-sql-injection: Fix zeekygen comment
Discarded extraneous Zeekygen comment: $src field; and always provides a victim IP address in the $dst field.
2025-05-21 11:49:48 +02:00
Arne Welzel
aabd1e3825 btest/coverage/test-all-policy-zeekygen: Load test-all-policy with zeekygen enabled
There should not be warnings produced. The default ZEEK_DISABLE_ZEEKYGEN=1
setting in the btest configuration hid some issues previously.
2025-05-21 11:49:12 +02:00
zeek-bot
7d54a58a76 Update doc submodule [nomail] [skip ci] 2025-05-21 00:15:25 +00:00
Tim Wojtulewicz
c596556036 Merge remote-tracking branch 'origin/topic/timw/3913-parse-port-invalid-read'
* origin/topic/timw/3913-parse-port-invalid-read:
  Add extra input files to ftp fuzzer corpus
  Use bool instead of int flag in FTP analyzer's parse_eftp method
  Fix undefined behavior in FTP analyzer's parse_port method
  Fix invalid-read in FTP analyzer's parse_port method
2025-05-20 12:02:18 -07:00
Arne Welzel
ec744024d3 Merge remote-tracking branch 'origin/topic/awelzel/btest-cluster-layout-replacement'
* origin/topic/awelzel/btest-cluster-layout-replacement:
  btest remaining: Use generic cluster-layout.zeek
  btest/frameworks/logging: Use generic cluster-layout.zeek
  btest/files/x509: Use generic cluster-layout.zeek
  btest/frameworks/notice: Use generic cluster-layout.zeek
  btest/policy: Use generic cluster-layout.zeek
  btest/frameworks/intel: Use generic cluster-layout.zeek
  btest/frameworks/sumstats: Use generic cluster-layout.zeek
  btest/frameworks/cluster: Use generic cluster-layout.zeek
  btest/frameworks/config: Use generic cluster-layout.zeek
  btest/broker: Use generic cluster-layout.zeek
  btest/cluster: Use generic cluster-layout.zeek
  testing/btest/Files: Add generic broker/cluster-layout.zeek
2025-05-20 20:30:47 +02:00
Arne Welzel
00eabb6cbb btest remaining: Use generic cluster-layout.zeek 2025-05-20 20:30:01 +02:00
Arne Welzel
9365f71965 btest/frameworks/logging: Use generic cluster-layout.zeek 2025-05-20 20:30:01 +02:00
Arne Welzel
6c00c05249 btest/files/x509: Use generic cluster-layout.zeek 2025-05-20 20:30:01 +02:00
Arne Welzel
d7b5955e5e btest/frameworks/notice: Use generic cluster-layout.zeek 2025-05-20 20:30:01 +02:00
Arne Welzel
2a3f2d0004 btest/policy: Use generic cluster-layout.zeek
Catch-all for cluster scripts in policy directory.
2025-05-20 20:30:01 +02:00
Arne Welzel
00a12a4cc5 btest/frameworks/intel: Use generic cluster-layout.zeek 2025-05-20 20:30:01 +02:00
Arne Welzel
4dec63936e btest/frameworks/sumstats: Use generic cluster-layout.zeek 2025-05-20 20:30:01 +02:00
Arne Welzel
0a06a77c69 btest/frameworks/cluster: Use generic cluster-layout.zeek 2025-05-20 20:30:01 +02:00
Arne Welzel
e114b0e371 btest/frameworks/config: Use generic cluster-layout.zeek 2025-05-20 20:30:01 +02:00
Arne Welzel
f9ff396acf btest/broker: Use generic cluster-layout.zeek 2025-05-20 20:30:01 +02:00
Arne Welzel
a15df5fc11 btest/cluster: Use generic cluster-layout.zeek 2025-05-20 20:30:01 +02:00
Arne Welzel
b3f53dc455 testing/btest/Files: Add generic broker/cluster-layout.zeek
This is a cluster-layout.zeek template that can be copied into a testing
directory if needed. The idea is that a developer sets environment
variables within their btest and the Cluster::nodes variable is
implicitly extended by appropriate nodes.

For example, using @TEST-PORT BROKER_LOGGER1_PORT will add an appropriate
logger-1 node to Cluster::nodes, based on the existence of the
BROKER_LOGGER1_PORT environment variable.
2025-05-20 20:30:01 +02:00
Tim Wojtulewicz
9ae16a3db3 Add extra input files to ftp fuzzer corpus 2025-05-20 10:58:32 -07:00
Tim Wojtulewicz
517dfff529 Use bool instead of int flag in FTP analyzer's parse_eftp method 2025-05-20 10:58:32 -07:00
Tim Wojtulewicz
c0b09665b9 Fix undefined behavior in FTP analyzer's parse_port method 2025-05-20 10:58:32 -07:00
Tim Wojtulewicz
8596671dd5 Fix invalid-read in FTP analyzer's parse_port method 2025-05-20 10:58:32 -07:00
Arne Welzel
906b91dca8 Merge remote-tracking branch 'origin/topic/vern/http-sqli-replacement'
* origin/topic/vern/http-sqli-replacement:
  site/local: Switch to detect-sql-injection
  Add a revised script for detecting HTTP SQL injection, deprecate original
2025-05-20 16:26:13 +02:00
Arne Welzel
c687a24503 site/local: Switch to detect-sql-injection 2025-05-20 16:24:28 +02:00
Vern Paxson
dcd14f7a16 Add a revised script for detecting HTTP SQL injection, deprecate original 2025-05-20 16:24:20 +02:00
zeek-bot
a694781bad Update doc submodule [nomail] [skip ci] 2025-05-20 00:25:51 +00:00
Tim Wojtulewicz
ddeecabc1e Merge remote-tracking branch 'origin/topic/awelzel/event-trace-fix-operator-equals'
* origin/topic/awelzel/event-trace-fix-operator-equals:
  EventTrace: Fix operator==() UBSAN downcast error
2025-05-19 12:33:08 -07:00
Arne Welzel
1ed38e7342 EventTrace: Fix operator==() UBSAN downcast error
New test triggered the following error:

    runtime error: downcast of address 0x57021a323ea0 which does not point to an object of type 'const FileVal' 0x57021a323ea0: note: object is of type 'zeek::FuncVal'
2025-05-19 20:48:18 +02:00
Christian Kreibich
fdecfba6b4 Merge branch 'smoot-improve-from_json' of github.com:/stevesmoot/zeek
* 'smoot-improve-from_json' of github.com:/stevesmoot/zeek:
  update baseline for zam
  Update src/zeek.bif
  Change from_json to return an error rather than print it.
2025-05-19 11:06:29 -07:00
Arne Welzel
eb15997cc3 Merge remote-tracking branch 'origin/topic/awelzel/event-trace-mgr-destructor-fclose'
* origin/topic/awelzel/event-trace-mgr-destructor-fclose:
  btest/core: Add event-trace test
  zeek-setup: Free event_trace_mgr after generating trace
  EventTraceMgr: Rename etm to event_trace_mgr
  EventTraceMgr: Move fclose() to destructor
2025-05-19 20:02:12 +02:00
Tim Wojtulewicz
e21fb9c9c7 Update cmake submodule 2025-05-19 10:54:10 -07:00
Tim Wojtulewicz
cc79afd24f Merge remote-tracking branch 'origin/topic/timw/include-cleanup-part-2'
* origin/topic/timw/include-cleanup-part-2:
  Remove unnecessary #includes in script_opt
  Remove unnecessary #includes in telemetry and supervisor
  Remove unnecessary #includes in cluster/broker/iosource/probabilistic/session
  Remove unnecessary #includes in zeekygen and base plugin files
  Remove unnecessary #includes in input/logging/threading
  Remove unnecessary #includes in analyzer/packet analyzer/file analyzer source files
  Remove unnecessary #includes in analyzer/packet analyzer/file analyzer headers
  Remove unnecessary #includes in base files in repo
2025-05-19 10:26:05 -07:00
Tim Wojtulewicz
12356a6393 Remove unnecessary #includes in script_opt 2025-05-19 10:25:05 -07:00
Tim Wojtulewicz
0e47fa10c6 Remove unnecessary #includes in telemetry and supervisor 2025-05-19 10:25:05 -07:00
Tim Wojtulewicz
8b992320cb Remove unnecessary #includes in cluster/broker/iosource/probabilistic/session 2025-05-19 10:25:05 -07:00
Tim Wojtulewicz
17101da6b3 Remove unnecessary #includes in zeekygen and base plugin files 2025-05-19 10:25:05 -07:00
Tim Wojtulewicz
e3c4b1fd58 Remove unnecessary #includes in input/logging/threading 2025-05-19 10:25:05 -07:00
Tim Wojtulewicz
79301c4691 Remove unnecessary #includes in analyzer/packet analyzer/file analyzer source files 2025-05-19 10:25:05 -07:00
Tim Wojtulewicz
456c1fa42c Remove unnecessary #includes in analyzer/packet analyzer/file analyzer headers 2025-05-19 10:25:05 -07:00
Tim Wojtulewicz
896e41c794 Remove unnecessary #includes in base files in repo 2025-05-19 09:50:23 -07:00
Tim Wojtulewicz
224be5a951 Merge remote-tracking branch 'origin/topic/timw/rename-ci-github-labels'
* origin/topic/timw/rename-ci-github-labels:
  Rename CI-related github labels for PRs
2025-05-19 09:44:10 -07:00
Tim Wojtulewicz
e72572bf32 Rename CI-related github labels for PRs 2025-05-19 09:41:27 -07:00
Arne Welzel
000cc50813 btest/core: Add event-trace test 2025-05-19 18:23:08 +02:00
Arne Welzel
eeb08f6ba8 zeek-setup: Free event_trace_mgr after generating trace
While it'd be destructed due to being a global unique_ptr, force
it to happen right after generating the trace.
2025-05-19 18:10:36 +02:00
Arne Welzel
5bcf6bec52 EventTraceMgr: Rename etm to event_trace_mgr
Mostly to avoid having new maintainers/developers knowing about yet
another abbreviation.
2025-05-19 18:10:36 +02:00
Arne Welzel
1465e390a2 EventTraceMgr: Move fclose() to destructor
Coverity complains about a missing fclose() in a non-existing
destructor. Also sprinkle in a strerror() call for fopen() to
provide a bit of a hint what might have gone wrong.
2025-05-19 18:10:32 +02:00
zeek-bot
bf30cf7997 Update doc submodule [nomail] [skip ci] 2025-05-17 00:27:23 +00:00
Tim Wojtulewicz
9683e88795 Merge remote-tracking branch 'origin/topic/timw/include-cleanup-part-1'
* origin/topic/timw/include-cleanup-part-1:
  Remove including <cinttypes> from util.h
  Remove telemetry #includes from OpaqueVal.h
  Reduce includes in plugin/Component.h
  Remove zeek/Stats.h include from NetVar.h
  Include StmtBase/StmtEnums in Func.h instead of Stmt.h
  Use modern names for standard headers
  Remove fix for CentOS 7 from TCP_Flags.h
  Fix usage of std::string in http analyzer
  Reorder top section of net_util.h to batch includes together
  Use quotes instead of <> for zeek includes
  Fix Obj.h include in IntrusivePtr.h to have full path
2025-05-16 10:27:46 -07:00
Tim Wojtulewicz
e618d00326 Remove including <cinttypes> from util.h 2025-05-16 10:14:37 -07:00
Tim Wojtulewicz
174bf09d77 Remove telemetry #includes from OpaqueVal.h 2025-05-16 10:14:37 -07:00
Tim Wojtulewicz
c659592773 Reduce includes in plugin/Component.h 2025-05-16 10:14:37 -07:00
Tim Wojtulewicz
ff9f0f7a5c Remove zeek/Stats.h include from NetVar.h 2025-05-16 10:14:37 -07:00
Tim Wojtulewicz
ca3002d745 Include StmtBase/StmtEnums in Func.h instead of Stmt.h
This requires changes in lots of other files that were depending on Func.h
to provide that include for them.
2025-05-16 10:14:36 -07:00
Tim Wojtulewicz
ad50443590 Use modern names for standard headers 2025-05-16 10:14:36 -07:00
Tim Wojtulewicz
4b2ed67eaf Remove fix for CentOS 7 from TCP_Flags.h 2025-05-16 10:14:36 -07:00
Tim Wojtulewicz
3197bb7f59 Fix usage of std::string in http analyzer 2025-05-16 10:14:36 -07:00
Tim Wojtulewicz
661b230f23 Reorder top section of net_util.h to batch includes together 2025-05-16 10:14:36 -07:00
Tim Wojtulewicz
648f0f0623 Use quotes instead of <> for zeek includes 2025-05-16 10:14:36 -07:00
Tim Wojtulewicz
499db5dd70 Fix Obj.h include in IntrusivePtr.h to have full path 2025-05-16 10:14:36 -07:00
Arne Welzel
4691e2c51b Merge remote-tracking branch 'origin/topic/vern/event-trace-on-exit'
* origin/topic/vern/event-trace-on-exit:
  Generate --event-trace output explicitly rather than in EventTraceMgr destructor
2025-05-16 13:40:04 +02:00
Vern Paxson
f5c1a32d8d Generate --event-trace output explicitly rather than in EventTraceMgr destructor 2025-05-15 13:00:17 -07:00
Tim Wojtulewicz
6833088cde Merge remote-tracking branch 'origin/topic/timw/disallow-blind-searching-for-krb5-on-macos'
* origin/topic/timw/disallow-blind-searching-for-krb5-on-macos:
  Require non-system version of libkrb5 on macOS
2025-05-15 12:15:57 -07:00
Tim Wojtulewicz
663281e05f Require non-system version of libkrb5 on macOS 2025-05-15 11:24:51 -07:00
Arne Welzel
e40aac30f4 Merge remote-tracking branch 'origin/topic/awelzel/bump-ixwebsocket-11.4.6'
* origin/topic/awelzel/bump-ixwebsocket-11.4.6:
  IXWebSocket: Point at upstream, bump to v11.4.6
2025-05-15 16:44:30 +02:00
Arne Welzel
4911d34a1d IXWebSocket: Point at upstream, bump to v11.4.6 2025-05-15 16:37:09 +02:00
Johanna Amann
9d3e39581e Merge branch 'topic/jgras/pop3-stls-dpd' of https://github.com/J-Gras/zeek
* 'topic/jgras/pop3-stls-dpd' of https://github.com/J-Gras/zeek:
  Add STLS command to POP3 DPD signature
2025-05-15 10:23:43 +01:00
zeek-bot
adc0937bf5 Update doc submodule [nomail] [skip ci] 2025-05-15 00:14:11 +00:00
Jan Grashoefer
84cc4b890d Add STLS command to POP3 DPD signature 2025-05-14 16:37:25 +02:00
zeek-bot
734fd62325 Update doc submodule [nomail] [skip ci] 2025-05-14 00:15:11 +00:00
Arne Welzel
2255fa23b8 Merge remote-tracking branch 'origin/topic/vern/zam-aggr-change-in-loop'
* origin/topic/vern/zam-aggr-change-in-loop:
  fix for ZAM optimization when an aggregate is modified inside of a loop
2025-05-13 19:50:56 +02:00
Tim Wojtulewicz
5aa6734042 Merge remote-tracking branch 'origin/topic/timw/allow-macos-libkrb5'
* origin/topic/timw/allow-macos-libkrb5:
  Allow macOS to search for libkrb5, but disallow system version of library
2025-05-13 10:03:55 -07:00
Tim Wojtulewicz
051c191f63 Allow macOS to search for libkrb5, but disallow system version of library 2025-05-13 10:03:26 -07:00
Arne Welzel
8f60d37ad0 Merge remote-tracking branch 'origin/topic/awelzel/4440-websocket-pong-timeout'
* origin/topic/awelzel/4440-websocket-pong-timeout:
  btest/cluster/websocket: Update tests for new event signature
  cluster/websocket: Propagate code and reason to websocket_client_lost()
  cluster/websocket: Support configurable ping interval
  IXWebSocket: Bump to improve O^2 rxbuf erase()
2025-05-13 18:58:54 +02:00
Arne Welzel
6d2bd93f1f btest/cluster/websocket: Update tests for new event signature 2025-05-13 18:26:03 +02:00
Arne Welzel
a61aff010f cluster/websocket: Propagate code and reason to websocket_client_lost()
This allows to get visibility into the reason why ixwebsocket or the
client decided to disconnect.

Closed #4440
2025-05-13 18:26:03 +02:00
Arne Welzel
aaddeb19ad cluster/websocket: Support configurable ping interval
Primarily for testing purposes and maybe the hard-coded 5 seconds is too
aggressive for some deployments, so makes sense for it to be
configurable.
2025-05-13 18:26:03 +02:00
Tim Wojtulewicz
912356deac Merge remote-tracking branch 'origin/topic/bbannier/fix-spicy-main'
* origin/topic/bbannier/fix-spicy-main:
  Fix clang-tidy `bugprone-inc-dec-in-conditions` report in Spicy plugins glue compiler
  Fix clang-tidy `performance-enum-size` reports in Spicy plugin's glue compiler
  Remove unneeded copies in Spicy plugin glue compiler
  Adjust for renamed function flavor in Spicy development version
2025-05-12 11:33:54 -07:00
Vern Paxson
da689f1835 fix for ZAM optimization when an aggregate is modified inside of a loop 2025-05-09 15:01:55 -07:00
Arne Welzel
6b6c3dbbb7 Merge remote-tracking branch 'origin/topic/justin/file_analysis_speedup'
* origin/topic/justin/file_analysis_speedup:
  speed up file analysis, remove IncrementByteCount
2025-05-09 17:25:55 +02:00
Benjamin Bannier
24071118eb Fix clang-tidy bugprone-inc-dec-in-conditions report in Spicy plugins glue compiler 2025-05-09 16:58:22 +02:00
Justin Azoff
7f350587b0 speed up file analysis, remove IncrementByteCount
Avoid creating and recreating count objects for each chunk of file
analyzed.  This replaces counts inside of records with c++ uint64_ts.

On a pcap containing a 100GB file download this gives a 9% speedup

    Benchmark 1 (3 runs): zeek-master/bin/zeek -Cr http_100g_zeroes.pcap tuning/json-logs frameworks/files/hash-all-files
      measurement          mean ± σ            min … max           outliers         delta
      wall_time           102s  ± 1.23s      101s  …  103s           0 ( 0%)        0%
      peak_rss            108MB ±  632KB     107MB …  109MB          0 ( 0%)        0%
      cpu_cycles          381G  ±  862M      380G  …  382G           0 ( 0%)        0%
      instructions        663G  ± 5.16M      663G  …  663G           0 ( 0%)        0%
      cache_references   1.03G  ±  109M      927M  … 1.15G           0 ( 0%)        0%
      cache_misses       12.3M  ±  587K     11.7M  … 12.9M           0 ( 0%)        0%
      branch_misses      1.23G  ± 2.10M     1.22G  … 1.23G           0 ( 0%)        0%
    Benchmark 2 (3 runs): zeek-file_analysis_speedup/bin/zeek -Cr http_100g_zeroes.pcap tuning/json-logs frameworks/files/hash-all-files
      measurement          mean ± σ            min … max           outliers         delta
      wall_time          92.9s  ± 1.85s     91.8s  … 95.1s           0 ( 0%)        -  9.0% ±  3.5%
      peak_rss            108MB ±  393KB     108MB …  109MB          0 ( 0%)          +  0.1% ±  1.1%
      cpu_cycles          341G  ±  695M      341G  …  342G           0 ( 0%)        - 10.4% ±  0.5%
      instructions        605G  ±  626M      605G  …  606G           0 ( 0%)        -  8.7% ±  0.2%
      cache_references    831M  ± 16.9M      813M  …  846M           0 ( 0%)        - 19.6% ± 17.2%
      cache_misses       12.4M  ± 1.48M     11.4M  … 14.1M           0 ( 0%)          +  0.3% ± 20.8%
      branch_misses      1.02G  ± 3.45M     1.02G  … 1.02G           0 ( 0%)        - 16.8% ±  0.5%
2025-05-09 10:50:04 -04:00
Arne Welzel
2041306772 IXWebSocket: Bump to improve O^2 rxbuf erase()
Part of #4440
2025-05-09 16:38:36 +02:00
Benjamin Bannier
37b095f39b Fix clang-tidy performance-enum-size reports in Spicy plugin's glue compiler 2025-05-09 16:08:14 +02:00
Benjamin Bannier
9355512adc Remove unneeded copies in Spicy plugin glue compiler 2025-05-09 16:08:14 +02:00
Benjamin Bannier
fbe8dbce5e Adjust for renamed function flavor in Spicy development version
With zeek/spicy#2048 the flavor for functions was renamed from
`Standard` to `Function`. This patch adapts the code for that while
still allowing using earlier Spicy versions.
2025-05-09 16:08:14 +02:00
Arne Welzel
20ada619c5 Updating submodules binpac, broker and zeek-aux [nomail] 2025-05-09 09:52:20 +02:00
zeek-bot
b629b6bfe6 Update doc submodule [nomail] [skip ci] 2025-05-09 00:23:30 +00:00
Tim Wojtulewicz
957098af1c Merge remote-tracking branch 'origin/topic/bbannier/bump-spicy'
* origin/topic/bbannier/bump-spicy:
  Bump auxil/spicy to latest development snapshot
2025-05-08 15:14:37 -07:00
Christian Kreibich
8d79429555 Merge branch 'topic/christian/fix-broker-peering-overflows-metric'
* topic/christian/fix-broker-peering-overflows-metric:
  Bugfix: accurately track Broker buffer overflows w/ multiple peerings
2025-05-08 15:07:39 -07:00
Tim Wojtulewicz
2c17c85f55 Merge branch 'topic/timw/switch-broker-error-to-error'
* topic/timw/switch-broker-error-to-error:
  Downgrade broker clone FatalError to an Error
2025-05-08 13:47:06 -07:00
Tim Wojtulewicz
e00942c021 Downgrade broker clone FatalError to an Error 2025-05-08 13:46:21 -07:00
Benjamin Bannier
abbc4f23b8 Bump auxil/spicy to latest development snapshot 2025-05-08 21:54:15 +02:00
Arne Welzel
7583651bec Merge remote-tracking branch 'origin/topic/awelzel/ci-fedora-42'
* origin/topic/awelzel/ci-fedora-42:
  probabilistic/BitVector: Add include <cstdint>
  Bump spicy to fix build with GCC 15.1
  CI: Drop fedora-40
  CI: Add fedora-42
2025-05-08 13:19:30 +02:00
Arne Welzel
f80abe9d45 probabilistic/BitVector: Add include <cstdint> 2025-05-08 10:37:32 +02:00
Arne Welzel
43c20f41da Bump spicy to fix build with GCC 15.1 2025-05-08 10:37:32 +02:00
Arne Welzel
368a38a050 CI: Drop fedora-40
Still 3 weeks to go, but not quite seeing why we should support 3
different Fedora releases with Zeek 7.2.
2025-05-08 10:37:32 +02:00
Arne Welzel
aacc484543 CI: Add fedora-42
This ships with gcc 15.1.1 and Python 3.13.3
2025-05-08 10:37:29 +02:00
Arne Welzel
60efc7741d Merge branch 'gcc15' of https://github.com/i2z1/zeek
* 'gcc15' of https://github.com/i2z1/zeek:
  Include cstdint header to support uint8_t/uint64_t in GCC 15+
2025-05-08 09:25:28 +02:00
Christian Kreibich
738ce1c235 Bugfix: accurately track Broker buffer overflows w/ multiple peerings
When a node restarts or a peering between two nodes starts over for other
reasons, the internal tracking in the Broker manager resets its state (since
it's per-peering), and thus the message overflow counter. The script layer was
unaware of this, and threw errors when trying to reset the corresponding counter
metric down to zero at sync time.

We now track past buffer overflows via a separate epoch table, using Broker peer
ID comparisons to identify new peerings, and set the counter to the sum of past
and current overflows.

I considered just making this a gauge, but it seems more helpful to be able to
look at a counter to see whether any messages have ever been dropped over the
lifetime of the node process.

As an aside, this now also avoids repeatedly creating the labels vector,
re-using the same one for each metric.

Thanks to @pbcullen for identifying this one!
2025-05-07 17:27:38 -07:00
zeek-bot
42365b85f0 Update doc submodule [nomail] [skip ci] 2025-05-08 00:14:52 +00:00
Tim Wojtulewicz
1dfbd33929 Merge remote-tracking branch 'origin/topic/timw/storage-timeout-option'
* origin/topic/timw/storage-timeout-option:
  Move options to redis backend options instead of module-level options
  Add operation_timeout and command_timeout storage backend options
2025-05-07 15:39:35 -07:00
Tim Wojtulewicz
fd10dd015f Move options to redis backend options instead of module-level options 2025-05-07 15:38:58 -07:00
Tim Wojtulewicz
824b91216f Add operation_timeout and command_timeout storage backend options 2025-05-07 15:38:58 -07:00
Tim Wojtulewicz
507974a1d8 Merge remote-tracking branch 'origin/topic/christian/news-fix'
* origin/topic/christian/news-fix:
  Fix Broker metrics naming bugs that snuck in w/ last-minute renaming [skip ci]
2025-05-07 14:09:52 -07:00
i2z1
c0da0642b1
Include cstdint header to support uint8_t/uint64_t in GCC 15+ 2025-05-07 22:42:01 +03:00
Christian Kreibich
6657e4efbd Fix Broker metrics naming bugs that snuck in w/ last-minute renaming [skip ci] 2025-05-07 12:32:43 -07:00
Tim Wojtulewicz
6f8924596f Merge remote-tracking branch 'origin/topic/johanna/fix-failed-service-logging'
* origin/topic/johanna/fix-failed-service-logging:
  Fix policy/protocols/conn/failed-service-logging.zeek
2025-05-07 10:29:54 -07:00
Tim Wojtulewicz
8096388904 Update opt.ZAM-bif-tracking baseline 2025-05-07 09:12:56 -07:00
Arne Welzel
8089f5bed4 Merge remote-tracking branch 'origin/topic/awelzel/more-terminate-while-queueing-hardening'
* origin/topic/awelzel/more-terminate-while-queueing-hardening:
  btest/cluster/generic/publish-any: Apply Christian's fix from broker/publish-any
  wstest/terminate-while-queueing: Patch close_socket()
2025-05-07 17:24:04 +02:00
Arne Welzel
3ec3205074 btest/cluster/generic/publish-any: Apply Christian's fix from broker/publish-any 2025-05-07 17:18:01 +02:00
Tim Wojtulewicz
d7b31f5b44 Merge remote-tracking branch 'origin/topic/timw/storage-is-connected-bif'
* origin/topic/timw/storage-is-connected-bif:
  Add Storage::is_connected BIF
  Move cast_handle from storage-async.bif to BackendHandleVal static method
2025-05-07 08:16:59 -07:00
Tim Wojtulewicz
58ee8d3c5c Add Storage::is_connected BIF 2025-05-07 08:13:16 -07:00
Tim Wojtulewicz
cbc41e298d Move cast_handle from storage-async.bif to BackendHandleVal static method 2025-05-07 08:13:16 -07:00
Arne Welzel
82731992d9 wstest/terminate-while-queueing: Patch close_socket()
I believe there's a bug/usage issue in the websockets library
where during send(), EOF is detected and stored, but the receiving
thread is then discarding the last received frame. Avoid the bug
by replacing the close_socket() implementation of the websockets
library just for that test and leave detecting the EOF condition
to the receiving thread.
2025-05-07 16:33:54 +02:00
Arne Welzel
135acc7c6d Merge remote-tracking branch 'origin/topic/awelzel/fix-flaky-terminate-while-queueing'
* origin/topic/awelzel/fix-flaky-terminate-while-queueing:
  cluster/websocket: Stop and wait for reply thread during Terminate()
2025-05-07 13:22:13 +02:00
Arne Welzel
ca02316671 cluster/websocket: Stop and wait for reply thread during Terminate()
The terminate-while-queueing test added for #4428 failed spuriously
indicating that sometimes WebSocket clients receive code 1000 instead of 1001.
This happens if the ixwebsocket server is shutdown before the reply thread had a
chance to process queued close messages.

Fix by signaling and waiting for the dispatcher's reply thread to terminate
before returning from Terminate().
2025-05-07 12:45:01 +02:00
zeek-bot
ac1230fcbe Update doc submodule [nomail] [skip ci] 2025-05-07 00:15:52 +00:00
Steve Smoot
53f2f6ec57 update baseline for zam 2025-05-06 15:11:12 -07:00
Tim Wojtulewicz
1da414ec3d Update paraglob submodule [nomail] 2025-05-06 13:19:49 -07:00
Johanna Amann
f293d5a852 Fix policy/protocols/conn/failed-service-logging.zeek
In GH-4422 it was pointed out that the protocols/conn/failed-service-logging.zeek
policy script only works when
`DPD::track_removed_services_in_connection=T` is set.

This was caused by a logic error in the script. This commit fixes this
logic error and introduces an additional test that checks that
failed-service-logging works even when the option is not set to true.
2025-05-06 13:37:12 +01:00
Arne Welzel
3be7a9ce91 Merge remote-tracking branch 'origin/topic/awelzel/double-commented-btest-lines'
* origin/topic/awelzel/double-commented-btest-lines:
  testing/btest: Fix double commented @TEST- lines
2025-05-06 14:21:03 +02:00
Arne Welzel
4afb0ffeeb Merge remote-tracking branch 'origin/topic/awelzel/4420-simeon-breaking-websockets'
* origin/topic/awelzel/4420-simeon-breaking-websockets:
  Websocket: Close onloop during Terminate()
  OnLoop: notify_all() instead of notify_one()
2025-05-06 14:20:38 +02:00
Arne Welzel
bb06af601f Websocket: Close onloop during Terminate()
Terminate() is called when Zeek shuts down. If WebSocket client threads
were blocked in QueueForProcessing() due to reaching queue limits, these
previously would not exit QueueForProcessing() and instead block
indefinitely, resulting in the ixwebsocket library blocking and its
garbage collection thread running at 100%. Not great.

Closing the onloop instance will unblock the WebSocket client threads
for a timely shutdown.

Closes #4420
2025-05-06 14:19:08 +02:00
Arne Welzel
0e327a0c12 testing/btest: Fix double commented @TEST- lines
sed -i 's/^# # @/# @/g'
2025-05-06 14:06:29 +02:00
Arne Welzel
6ebec6dde7 OnLoop: notify_all() instead of notify_one()
There might be more than one thread blocked waiting for room in the
queue, ensure they all wake up when shutting down.
2025-05-06 12:23:08 +02:00
zeek-bot
e986caddf0 Update doc submodule [nomail] [skip ci] 2025-05-06 00:16:07 +00:00
Smoot
daaec62b4a
Update src/zeek.bif
Co-authored-by: Tim Wojtulewicz <timwoj@gmail.com>
2025-05-05 14:57:09 -07:00
Tim Wojtulewicz
0393e4b84a Merge remote-tracking branch 'XueSongTap/master'
* XueSongTap/master:
  Add baseline for find_first test, update comments, and reorder function imports
  Add find_first string function
2025-05-05 13:40:40 -07:00
Tim Wojtulewicz
f9aa9a430d Merge remote-tracking branch 'origin/topic/timw/storage-check-redis-server-version'
* origin/topic/timw/storage-check-redis-server-version:
  Add commands to the static methods for the Redis implementation
  Redis: Check server version when connecting
2025-05-05 11:12:09 -07:00
Tim Wojtulewicz
dda319fd53 Add commands to the static methods for the Redis implementation 2025-05-05 11:10:06 -07:00
Tim Wojtulewicz
ecd603516f Redis: Check server version when connecting 2025-05-05 10:49:37 -07:00
Tim Wojtulewicz
58d71d2fa3 Merge remote-tracking branch 'origin/topic/timw/storage-redis-expire-string-view'
* origin/topic/timw/storage-redis-expire-string-view:
  Use std::string_view in Redis::DoExpire to avoid copies
2025-05-05 10:44:51 -07:00
Tim Wojtulewicz
df9b396ee6 Use std::string_view in Redis::DoExpire to avoid copies 2025-05-05 10:44:06 -07:00
Arne Welzel
50ac8d1468 Merge remote-tracking branch 'origin/topic/awelzel/4405-quic-fragmented-crypto'
* origin/topic/awelzel/4405-quic-fragmented-crypto:
  Bump external/zeek-testing
  QUIC: Extract reset_crypto() function
  QUIC: Rename ConnectionIDInfo to Context
  QUIC: Switch initial_destination_conn_id to optional
  QUIC: Use initial destination conn_id for decryption
  QUIC: Handle CRYPTO frames across multiple INITIAL packets
  QUIC: Do not consume EncryptedLongPacketPayload
  QUIC: Fix ACK frame parsing
2025-05-05 14:40:59 +02:00
Arne Welzel
8fd3cbf7cc Bump external/zeek-testing 2025-05-05 14:34:38 +02:00
Arne Welzel
39d0610ce1 QUIC: Extract reset_crypto() function 2025-05-05 14:34:38 +02:00
Arne Welzel
c19e79246f QUIC: Rename ConnectionIDInfo to Context
Lets just call it what it is given that it contains more than just
connection IDs.
2025-05-05 14:34:38 +02:00
Arne Welzel
fd29b48803 QUIC: Switch initial_destination_conn_id to optional 2025-05-05 14:34:38 +02:00
Arne Welzel
fe89a521d1 QUIC: Use initial destination conn_id for decryption
Ensure the client side also uses the initial destination connection ID
for decryption purposes instead of the one from the current long header
packet. PCAP from local WiFi hotspot.
2025-05-05 14:34:11 +02:00
Arne Welzel
ae90524027 QUIC: Handle CRYPTO frames across multiple INITIAL packets
Instead of sending the accumulated CRYPTO frames after processing an
INITIAL packet, add logic to determine the total length of the TLS
Client or Server Hello (by peeking into the first 4 byte). Once all
CRYPTO frames have arrived, flush the reassembled data to the TLS
analyzer at once.
2025-05-05 14:34:11 +02:00
Arne Welzel
e459d96fb6 QUIC: Do not consume EncryptedLongPacketPayload
The payload is already consumed within the InitialPacket unit. Consuming
it again resulted in UDP datagrams with multiple packets to ignore
the remaining packets in the same UDP datagram. The baseline changes
showing I being followed by a new H indicates that the INITIAL packet
was followed by a HANDSHAKE packet, but previously Zeek discarded
these.
2025-05-05 14:34:11 +02:00
zeek-bot
823abe2d90 Update doc submodule [nomail] [skip ci] 2025-05-03 00:12:50 +00:00
yexiaochuan
fd7045e274 Add baseline for find_first test, update comments, and reorder function imports 2025-05-02 11:51:45 +08:00
Arne Welzel
d655c64e0b Merge remote-tracking branch 'origin/topic/awelzel/event-publish-hook'
* origin/topic/awelzel/event-publish-hook:
  NEWS: Add HookPublishEvent() note
  btest/plugin: Test for PublishEventHook()
  broker and cluster: Wire up HookPublishEvent
  plugin: Add HookPublishEvent hook
2025-04-30 17:57:46 +02:00
Arne Welzel
48d965f85c NEWS: Add HookPublishEvent() note 2025-04-30 17:26:33 +02:00
Arne Welzel
0bf3417d4c btest/plugin: Test for PublishEventHook() 2025-04-30 17:26:33 +02:00
Arne Welzel
53236a184a broker and cluster: Wire up HookPublishEvent 2025-04-30 17:26:33 +02:00
Arne Welzel
621fd2ab39 plugin: Add HookPublishEvent hook 2025-04-30 17:26:33 +02:00
Arne Welzel
f8b75426ee Merge remote-tracking branch 'origin/topic/awelzel/bif-tracking-no-zeromq'
* origin/topic/awelzel/bif-tracking-no-zeromq:
  ZAM-bif-tracking: Remove ZeroMQ dependency
2025-04-30 17:23:22 +02:00
Arne Welzel
90eb22ce73 ZAM-bif-tracking: Remove ZeroMQ dependency
Vern didn't have ZeroMQ installed and the test was skipped for him.
Generally would recommend anyone working on core Zeek to install
libzmq-dev or the equivalent for their environment, but until it is a
real required dependency, loosen the requirements on the test.
2025-04-30 17:08:21 +02:00
Arne Welzel
f63677fcd5 QUIC: Fix ACK frame parsing
Later tests will exercise this.
2025-04-30 15:54:42 +02:00
Tim Wojtulewicz
e56de061f9 Merge remote-tracking branch 'origin/topic/vern/zam-inlining-temps'
* origin/topic/vern/zam-inlining-temps:
  fixed incorrect ZAM optimization of expressions seen in single-statement inlined functions
2025-04-29 17:50:39 -07:00
Vern Paxson
d2762fb247 fixed incorrect ZAM optimization of expressions seen in single-statement inlined functions 2025-04-29 14:29:07 -07:00
yexiaochuan
6c240dc0bb Add find_first string function 2025-04-30 00:15:34 +08:00
Tim Wojtulewicz
2cf8497bf7 Merge remote-tracking branch 'origin/topic/timw/update-ct-ca-lists'
* origin/topic/timw/update-ct-ca-lists:
  External tests: add removed logs to CT list to prevent baseline changes
  Update Mozilla CA list and CT list to NSS 3.110
2025-04-29 08:53:04 -07:00
Arne Welzel
d5e1dc27c6 Merge branch 'topic/mohan/intel-event-groups' of https://github.com/Mohan-Dhawan/zeek
* 'topic/mohan/intel-event-groups' of https://github.com/Mohan-Dhawan/zeek:
  coalesce smtp handlers for ADDR
  Add fine-grained groups for Intel events
2025-04-29 15:00:58 +02:00
Mohan Dhawan
36c4d112c8
coalesce smtp handlers for ADDR 2025-04-29 16:30:31 +05:30
Arne Welzel
5bf660a9ce Merge remote-tracking branch 'origin/topic/awelzel/cluster-coverity-fixes'
* origin/topic/awelzel/cluster-coverity-fixes:
  broker/WebSocketShim: Check RegisterFd() return
  cluster/OnLoop: Fix coverity report about proc accessed without lock
2025-04-28 19:41:10 +02:00
Arne Welzel
540baa89af Merge remote-tracking branch 'origin/topic/awelzel/3045-no-holes-in-vectors'
* origin/topic/awelzel/3045-no-holes-in-vectors:
  broker/Data/data_to_val: Fail on vectors/lists with holes
2025-04-28 18:24:25 +02:00
Arne Welzel
7092db6318 broker/Data/data_to_val: Fail on vectors/lists with holes
Instead of simply removing holes from vectors or lists when converting
from Val to Broker format, error out as the receiver has no chance to
reconstruct where the hole might have been.

We could encode holes with broker::none, but this will put unnecessary
burden on language bindings and users due to the potential optionality.
Think a std::vector<uint64_t> that technically needs to be a
std::vector<std::optional<uint64_t>> to represent optional elements
properly.

Closes #3045
2025-04-28 18:23:37 +02:00
Johanna Amann
28ec4e2f2a External tests: add removed logs to CT list to prevent baseline changes 2025-04-28 16:42:52 +01:00
Arne Welzel
d02588d25c broker/WebSocketShim: Check RegisterFd() return 2025-04-28 16:24:25 +02:00
Arne Welzel
4101efed4f cluster/OnLoop: Fix coverity report about proc accessed without lock
Coverity complains proc is set under a lock, but accessed in Process()
without a lock. Fix this by setting it in Close() also without locking.
The proc member should only ever be accessed my the main thread.
2025-04-28 16:23:08 +02:00
Tim Wojtulewicz
b9b268bd86 Merge remote-tracking branch 'origin/topic/timw/use-after-move'
* origin/topic/timw/use-after-move:
  Fix use-after-move in recent broker changes
2025-04-25 16:11:56 -07:00
Tim Wojtulewicz
f8d2f30cec Fix use-after-move in recent broker changes 2025-04-25 13:48:14 -07:00
Tim Wojtulewicz
223c5ab955 Start of 8.0.0 development 2025-04-25 11:59:08 -07:00
Tim Wojtulewicz
aefcae2e2e Update docs submodule [nomail] [skip ci] 2025-04-25 11:10:16 -07:00
Tim Wojtulewicz
82bf555f7d Merge branch 'topic/timw/4218-lowercase-http'
* topic/timw/4218-lowercase-http:
  Ignore case when matching prefix in http analyzer
2025-04-25 10:33:39 -07:00
Kshitiz Bartariya
40935c31b1 Ignore case when matching prefix in http analyzer 2025-04-25 10:33:11 -07:00
Tim Wojtulewicz
4f65b89edf Merge remote-tracking branch 'origin/topic/timw/seven-two-news'
* origin/topic/timw/seven-two-news:
  Updates for the various Broker changes
  Add versions of bundled dependencies
  Fix a few typos.
  Additional user contributions for NEWS
  NEWS addition for cluster backends
  NEWS additions for 7.2
  Reformat 7.2 NEWS entries for consistent line lengths
2025-04-25 10:25:12 -07:00
Christian Kreibich
fee65e83ee Updates for the various Broker changes 2025-04-25 10:24:07 -07:00
Tim Wojtulewicz
3d584011a0 Add versions of bundled dependencies 2025-04-25 10:24:07 -07:00
Christian Kreibich
3dbb5b98f3 Fix a few typos. 2025-04-25 10:24:07 -07:00
Christian Kreibich
03e4d084b3 Additional user contributions for NEWS
Beyond PRs these also include (non-trivial, non-support) Github issues -- bug
reports, feature requests, etc.
2025-04-25 10:24:07 -07:00
Arne Welzel
8295c35f4b NEWS addition for cluster backends 2025-04-25 10:24:07 -07:00
Tim Wojtulewicz
b41e07ae0f NEWS additions for 7.2 2025-04-25 10:24:07 -07:00
Tim Wojtulewicz
ad4fa22889 Reformat 7.2 NEWS entries for consistent line lengths 2025-04-25 10:24:07 -07:00
Christian Kreibich
ebd0207352 Merge branch 'topic/christian/broker-tuning'
* topic/christian/broker-tuning:
  Lower listen/connect retry intervals in Broker and the cluster framework to 1sec
  Bump cluster testsuite
  Switch Broker's default backpressure policy to drop_oldest, bump buffer sizes
  Deprecate Broker::congestion_queue_size and stop using it internally
2025-04-25 10:23:55 -07:00
Christian Kreibich
68fadd0464 Lower listen/connect retry intervals in Broker and the cluster framework to 1sec
The former defaults (30sec, 1min) can slow down cluster startup and recovery
considerably, and other systems have more aggressive intervals still.
2025-04-25 10:22:35 -07:00
Christian Kreibich
7540d48fd5 Bump cluster testsuite
This pulls in an update for the backpressure disconnect tests, which now need to
set the policy explicitly.
2025-04-25 10:22:35 -07:00
Christian Kreibich
841a40ff88 Switch Broker's default backpressure policy to drop_oldest, bump buffer sizes
At every site where we've dug into backpressure disconnect findings, it has been
the case that the default values were too small. 8192, so 4x the old default,
suffices at every site to drown out premature disconnects.

With metrics now available for the send buffers regardless of backpressure
overflow policy, this also switches the default from "disconnect" to
"drop_oldest" (for both peers and websockets), meaning that peerings remain
untouched but the oldest queued message simply gets dropped when a new message
is enqueued. With this policy, the number of backpressure overflows is then
simply the count of discarded messages, something that users can tune to see
drop to zero in everyday use.  Another benefit is that marginal overflows cause
less message loss than when an entire buffer's worth (plus potentially more
in-flight messages) gets thrown out with a disconnect.
2025-04-25 10:22:35 -07:00
Christian Kreibich
5008f586ea Deprecate Broker::congestion_queue_size and stop using it internally
Since a reorg in the Broker library (commit b04195183) that revamped flow
control and that we pulled in with Zeek 5.0, this setting hasn't done
anything. Broker's endpoint::make_subscriber() and
endpoint::make_status_subscriber() take a queue size argument (with a default
value) that simply gets dropped in the eventual subscriber::make() call. See:

b041951835 (diff-5c0d2baa7981caeb6a4080708ddca6ad929746d10c73d66598e46d7c2c03c8deL34-R178)
2025-04-25 10:22:35 -07:00
Christian Kreibich
c1a5f70df8 Merge branch 'topic/christian/broker-backpressure-metrics'
* topic/christian/broker-backpressure-metrics:
  Add basic btest to verify that Broker peering telemetry is available.
  Add cluster framework telemetry for Broker's send-buffer use
  Add peer buffer update tracking to the Broker manager's event_observer
  Rename the Broker manager's LoggerAdapter
  Avoid race in the cluster/broker/publish-any btest
2025-04-25 10:04:09 -07:00
Christian Kreibich
35ab9d5c80 Add basic btest to verify that Broker peering telemetry is available. 2025-04-25 09:15:17 -07:00
Christian Kreibich
88a0cda8ca Add cluster framework telemetry for Broker's send-buffer use
This hooks into Telemetry::sync() to update Broker-level metrics tracking the
peerings' send buffer state. We do this in the cluster framework so we can label
the resulting metrics with Zeek cluster node names, not Broker's endpoint IDs.
2025-04-25 09:14:33 -07:00
Tim Wojtulewicz
6f52bdd29a Merge remote-tracking branch 'origin/topic/timw/clang-tidy-highway-hash'
* origin/topic/timw/clang-tidy-highway-hash:
  Skip linting on highwayhash and src/3rdparty files
2025-04-25 06:41:16 -07:00
Tim Wojtulewicz
c4613cf573 Merge remote-tracking branch 'origin/topic/timw/storage-framework-script-docs-updates'
* origin/topic/timw/storage-framework-script-docs-updates:
  Minor changes to storage framework script docs
2025-04-25 06:40:54 -07:00
Evan Typanski
154ee7720e Merge remote-tracking branch 'origin/topic/etyp/spicy-bump'
* origin/topic/etyp/spicy-bump:
  Bump Spicy
2025-04-25 08:41:02 -04:00
Evan Typanski
e98aae8b5f Bump Spicy 2025-04-25 13:07:02 +02:00
Arne Welzel
a852ecf913 Merge remote-tracking branch 'origin/topic/awelzel/backend-ready-callback-logic'
* origin/topic/awelzel/backend-ready-callback-logic:
  btest/cluster/websocket: Move no-subscriptions test
  cluster/websocket: Leverage ReadyToPublishCallback()
  cluster/zeromq: Implement DoReadyToPublishCallback()
  cluster/Backend: Add ReadyToPublishCallback() API
2025-04-25 10:06:36 +00:00
Arne Welzel
43a1bab960 btest/cluster/websocket: Move no-subscriptions test
...and also add one for broker.
2025-04-25 10:01:23 +00:00
Arne Welzel
2cd2a2b8a6 cluster/websocket: Leverage ReadyToPublishCallback()
Change WebSocket client handling to return only when the ready to
publish callback has been invoked.
2025-04-25 09:57:06 +00:00
Arne Welzel
643b926625 cluster/zeromq: Implement DoReadyToPublishCallback()
The ZeroMQ heuristic for "ready to publish" is to create an unique and
ephemeral subscription using the XSUB socket and observe it arrive on the
XPUB socket. At this point, visibility into other node's subscriptions
is provided.
2025-04-25 09:57:06 +00:00
Arne Welzel
e7a876da35 cluster/Backend: Add ReadyToPublishCallback() API
Provide a mechanism to allow a cluster backend report when it is ready
for publish operations. This is primarily useful for ZeroMQ which has
sender-side filtering and is only really ready for publishing when it
has learned about subscriptions from other nodes.
2025-04-25 09:57:06 +00:00
Arne Welzel
b0ecc131d0 Merge remote-tracking branch 'origin/topic/awelzel/comment-out-broker-websocket-shim-two-endpoint-tests'
* origin/topic/awelzel/comment-out-broker-websocket-shim-two-endpoint-tests:
  broker/WebSocketShim/tests: Comment out two endpoint tests
  broker/WebSocketShim/tests: Replace hard-coded timeout values with vars
2025-04-25 09:03:14 +02:00
Christian Kreibich
f5fbad23ff Add peer buffer update tracking to the Broker manager's event_observer
This implements basic tracking of each peering's current fill level, the maximum
level over a recent time interval (via a new Broker::buffer_stats_reset_interval
tunable, defaulting to 1min), and the number of times a buffer overflows. For
the disconnect policy this is the number of depeerings, but for drop_newest and
drop_oldest it implies the number of messages lost.

This doesn't use "proper" telemetry metrics for a few reasons: this tracking is
Broker-specific, so we need to track each peering via endpoint_ids, while we
want the metrics to use Cluster node name labels, and the latter live in the
script layer. Using broker::endpoint_id directly as keys also means we rely on
their ability to hash in STL containers, which should be fast.

This does not track the buffer levels for Broker "clients" (as opposed to
"peers"), i.e. WebSockets, since we currently don't have a way to name these,
and we don't want to use ephemeral Broker IDs in their telemetry.

To make the stats accessible to the script layer the Broker manager (via a new
helper class that lives in the event_observer) maintains a TableVal mapping
Broker IDs to a new BrokerPeeringStats record. The table's members get updated
every time that table is requested. This minimizes new val instantiation and
allows the script layer to customize the BrokerPeeringStats record by redefing,
updating fields, etc. Since we can't use Zeek vals outside the main thread, this
requires some care so all table updates happen only in the Zeek-side table
updater, PeerBufferState::GetPeeringStatsTable().
2025-04-24 22:47:18 -07:00
Christian Kreibich
23554280e0 Rename the Broker manager's LoggerAdapter
This is about to do more than just log handling, so this renames it simply to
Observer, reflecting the fact that it implements broker::event_observer.
2025-04-24 13:09:10 -07:00
Christian Kreibich
89780514fa Avoid race in the cluster/broker/publish-any btest
On very busy machines the hardwired scheduling of the ping batches could move
around among the arriving pongs, causing baseline deviations. We now wait for
each batch to complete before triggering the next one.
2025-04-24 13:09:10 -07:00
Tim Wojtulewicz
3ab83a3f74 Minor changes to storage framework script docs 2025-04-24 11:11:08 -07:00
Mohan Dhawan
8314b18092
Add fine-grained groups for Intel events 2025-04-24 23:24:40 +05:30
Arne Welzel
63a75c26c4 broker/WebSocketShim/tests: Comment out two endpoint tests
Running the remote tests on a loaded system results in timeouts, even
after bumping the tiemouts to 10 seconds. Comment them out for now.
2025-04-24 19:19:58 +02:00
Arne Welzel
8030ecf893 broker/WebSocketShim/tests: Replace hard-coded timeout values with vars 2025-04-24 19:19:58 +02:00
Arne Welzel
69a1ad2c3d Merge remote-tracking branch 'origin/topic/awelzel/cluster-fix-tsan-zeromq-do-terminate'
* origin/topic/awelzel/cluster-fix-tsan-zeromq-do-terminate:
  NEWS: Add entry about WebSocket client events
  btest/cluster: Testing cleanup
  cluster/websocket: Raise websocket_client_lost() after terminate
  cluster/ThreadedBackend: Invoke onloop->Process() during DoTerminate()
  cluster/ThreadedBackend: Remove Process()
  zeromq: Call super class DoTerminate() after stopping thread
2025-04-24 14:04:11 +02:00
Arne Welzel
7513d0ef1b NEWS: Add entry about WebSocket client events 2025-04-24 09:50:04 +02:00
Arne Welzel
2a6beae50b btest/cluster: Testing cleanup 2025-04-24 09:35:53 +02:00
Arne Welzel
63723cd9e3 cluster/websocket: Raise websocket_client_lost() after terminate
Just in case events are created during backend->Terminate(). These
should come before the Cluster::websocket_client_lost() event.
2025-04-24 09:35:20 +02:00
Arne Welzel
eb2eaee284 cluster/ThreadedBackend: Invoke onloop->Process() during DoTerminate()
Also, document how to use ThreadedBackend's DoTerminate()
2025-04-24 09:35:20 +02:00
Arne Welzel
85a2694cb2 cluster/ThreadedBackend: Remove Process()
This must have been left-over from before OnLoopProcess existed. It
wasn't called or used anymore.
2025-04-24 09:35:20 +02:00
Arne Welzel
63d31d7d9f zeromq: Call super class DoTerminate() after stopping thread
The internal ZeroMQ thread would call QueueForProcessing() thereby
accessing the onloop member. As ThreadedBackend::DoTerminate() unsets it,
this was a) reported as a data race by TSAN and b) potentially caused
missed events that were still to be queued.
2025-04-24 09:35:20 +02:00
Arne Welzel
79c4fdb237 Merge remote-tracking branch 'origin/topic/awelzel/websocket-empty-subscriptions'
* origin/topic/awelzel/websocket-empty-subscriptions:
  cluster/websocket: Short-circuit clients without subscriptions
  cluster/websocket: Factor out active subscription handling
2025-04-24 08:17:46 +02:00
Arne Welzel
23f0370e91 cluster/websocket: Short-circuit clients without subscriptions 2025-04-24 08:14:56 +02:00
Arne Welzel
47206d6a8a cluster/websocket: Factor out active subscription handling 2025-04-24 08:14:56 +02:00
zeek-bot
dee6f1421a Update doc submodule [nomail] [skip ci] 2025-04-24 00:26:49 +00:00
Steve Smoot
9ef579b09e Change from_json to return an error rather than print it. 2025-04-23 15:56:12 -07:00
Tim Wojtulewicz
4e5207b7f5 Skip linting on highwayhash and src/3rdparty files 2025-04-23 12:21:21 -07:00
Tim Wojtulewicz
8054547712 Merge remote-tracking branch 'origin/topic/timw/no-islower-before-toupper'
* origin/topic/timw/no-islower-before-toupper:
  Statically lookup field offsets for connection values in UDP and ICMP analyzers
  Skip calling islower before toupper
2025-04-23 12:15:03 -07:00
Tim Wojtulewicz
c2d8bc0620 Statically lookup field offsets for connection values in UDP and ICMP analyzers 2025-04-23 12:14:02 -07:00
Tim Wojtulewicz
928b648f93 Skip calling islower before toupper 2025-04-23 12:12:36 -07:00
Tim Wojtulewicz
cb35da08bc Update Mozilla CA list and CT list to NSS 3.110 2025-04-23 10:41:19 -07:00
Tim Wojtulewicz
a26f380fff Merge remote-tracking branch 'origin/topic/timw/update-all-submodules'
* origin/topic/timw/update-all-submodules:
  Updating submodule(s) [nomail]
2025-04-23 10:40:47 -07:00
Tim Wojtulewicz
023d69f929 Updating submodule(s) [nomail] 2025-04-23 10:40:07 -07:00
Arne Welzel
c27d74b2f9 Merge remote-tracking branch 'origin/topic/awelzel/copying-3rdparty-update'
* origin/topic/awelzel/copying-3rdparty-update:
  COPYING-3rdparty: Add some missing submodules [skip ci]
2025-04-23 17:18:40 +02:00
Tim Wojtulewicz
985d6b06fe Merge remote-tracking branch 'origin/topic/robin/bump-spicy'
* origin/topic/robin/bump-spicy:
  Bump Spicy.
2025-04-23 08:10:52 -07:00
Tim Wojtulewicz
ef943a29ec Merge remote-tracking branch 'origin/topic/neverlord/broker-store-crash'
* origin/topic/neverlord/broker-store-crash:
  Fix crash related to Broker stores
2025-04-23 08:08:11 -07:00
Dominik Charousset
b23869a2cd Fix crash related to Broker stores 2025-04-23 08:07:35 -07:00
Arne Welzel
68bc6111ed Merge remote-tracking branch 'origin/topic/awelzel/fix-listen-websocket-ubsan-port-count-confusion'
* origin/topic/awelzel/fix-listen-websocket-ubsan-port-count-confusion:
  cluster/cluster.bif: Fix CountVal casted to PortVal
2025-04-23 15:55:59 +02:00
Arne Welzel
dc428b2da2 cluster/cluster.bif: Fix CountVal casted to PortVal
Thanks UBSAN!
2025-04-23 15:48:15 +02:00
Arne Welzel
2b7b42e4df Merge remote-tracking branch 'origin/topic/awelzel/no-more-ubuntu-20.04'
* origin/topic/awelzel/no-more-ubuntu-20.04:
  CI: No more Ubuntu 20.04 [skip ci]
2025-04-23 15:08:06 +02:00
Arne Welzel
99f36ce01a CI: No more Ubuntu 20.04 [skip ci]
Ubuntu 20.04's default Python doesn't deal well with the type annotations
used in btest/Files/wstest.py. Given that it's about to be EOL, just remove it.
2025-04-23 15:05:23 +02:00
Arne Welzel
f6fae00122 COPYING-3rdparty: Add some missing submodules [skip ci] 2025-04-23 14:57:51 +02:00
Arne Welzel
3b80630996 Merge remote-tracking branch 'origin/topic/awelzel/cluster-broker-hub-websocket-support'
* origin/topic/awelzel/cluster-broker-hub-websocket-support: (24 commits)
  Add NEWS entry for WebSocket functionality
  btest/cluster: Add broker logging test for sanity
  broker/WebSocketShim: Add tests for endpoint, hubs and subscribers
  broker: Deprecate NodeID(), use SetNodeId()
  cluster/Backend: Do not inline Init()
  cluster: Add Backend::SetNodeId()
  cluster/websocket: Make websocket dispatcher queue size configurable
  cluster/zeromq: Attempt publish during termination
  broker/main: Reference Cluster::publish() for auto_publish() deprecation
  broker/main: Deprecate Broker::listen_websocket()
  cluster/websocket: Remove comment about broker
  btest/cluster/websocket: Add tests using broker
  btest/cluster/websocket: Move ZeroMQ test and use wstest.py
  btest/files: Introduce wstest.py
  cluster/websocket: Special case broker backend for shim usage
  broker: Add WebSocketShim backend
  broker/Manager: Add MakeHub() and ReleaseHub()
  Bump broker submodule
  cluster/Backend: Add ProcessError()
  cluster/Backend: Rename EnqueueLocalEvent() to ProcessLocalEvent()
  ...
2025-04-23 14:29:33 +02:00
Arne Welzel
74f171801c Add NEWS entry for WebSocket functionality 2025-04-23 14:27:43 +02:00
Arne Welzel
f2e60fdaff btest/cluster: Add broker logging test for sanity
Not very related to the PR, but created to help provoke an issue
with the broker changes.
2025-04-23 14:27:43 +02:00
Arne Welzel
7acedd18d0 broker/WebSocketShim: Add tests for endpoint, hubs and subscribers
These are really testing broker functionality, mostly added to ensure
the behavior is as expected by the WebSocketShim functionality.
2025-04-23 14:27:43 +02:00
Arne Welzel
cb243e2d28 broker: Deprecate NodeID(), use SetNodeId() 2025-04-23 14:27:43 +02:00
Arne Welzel
bfb033622f cluster/Backend: Do not inline Init() 2025-04-23 14:27:43 +02:00
Arne Welzel
a90a41a8b5 cluster: Add Backend::SetNodeId() 2025-04-23 14:27:43 +02:00
Arne Welzel
011029addc cluster/websocket: Make websocket dispatcher queue size configurable
Limit the number WebSocket events queued from external clients to
dispatcher instances to produce back pressure to the clients if
Zeek's IO loop is overloaded.
2025-04-23 14:27:43 +02:00
Arne Welzel
6bd624d9b2 cluster/zeromq: Attempt publish during termination
Explicitly notify the internal thread about the shutdown via the
inproc socket pair. This ensures that the internal thread processes
all previous messages on the inproc socket before terminating.

This fixes the scenario where a backend is created, a few messages published
and then immediately terminated as can be done with WebSocket clients.
Previously, some of the messages published might have still been in the
inproc socket's queue and were simply discarded.

Adds the same test for Broker and ZeroMQ backends.
2025-04-23 14:27:43 +02:00
Arne Welzel
ab25e5d24b broker/main: Reference Cluster::publish() for auto_publish() deprecation
In hindsight, this is the better thing to do and with Zeek 7.2 we should
be confident enough that it'll work.
2025-04-23 14:27:43 +02:00
Arne Welzel
a7423104e1 broker/main: Deprecate Broker::listen_websocket()
Optimistically deprecate Broker::listen_websocket() and promote
Cluster::listen_websocket() instead.
2025-04-23 14:27:43 +02:00
Arne Welzel
b9569cb06f cluster/websocket: Remove comment about broker 2025-04-23 14:27:43 +02:00
Arne Welzel
0c8f52664d btest/cluster/websocket: Add tests using broker
Add tests to verify Cluster::listen_websocket() with the Broker backend
is functional.
2025-04-23 14:27:43 +02:00
Arne Welzel
3319615c65 btest/cluster/websocket: Move ZeroMQ test and use wstest.py
Adapt the test to be the same as Broker, to have "expected" behavior.
2025-04-23 14:27:43 +02:00
Arne Welzel
1191f6b66d btest/files: Introduce wstest.py
This adds a minimal helper library for reusing some of the code to
test WebSocket client access to Zeek using Python.
2025-04-23 14:27:43 +02:00
Arne Welzel
193350483e cluster/websocket: Special case broker backend for shim usage
When Cluster::backend is configured with CLUSTER_BACKEND_BROKER, switch
WebSocketClients to CLUSTER_BACKEND_BROKER_WEBSOCKET_SHIM instead.

Instead of the special case, we could also add something to Backend
called NewWebSocketBackend(), but if it only affects broker, I think
the special case is okay for now.
2025-04-23 14:27:43 +02:00
Arne Welzel
76c508f001 broker: Add WebSocketShim backend
This adds a cluster backend implementation using broker's hub primitive
to connect WebSocket clients with the local broker endpoint for pub/sub
functionality.
2025-04-23 14:27:43 +02:00
Arne Welzel
591e3400d4 broker/Manager: Add MakeHub() and ReleaseHub()
These are used by WebSocket clients to create broker::hub instances
2025-04-23 14:27:43 +02:00
Arne Welzel
c9d7418a23 Bump broker submodule 2025-04-23 14:27:43 +02:00
Arne Welzel
3d3b7a0759 cluster/Backend: Add ProcessError()
Allow backends to pass errors to a strategy. Locally, these raise
Cluster::Backend::error() events that are logged to the reporter
as errors.
2025-04-23 14:19:08 +02:00
Arne Welzel
fcc0f45c57 cluster/Backend: Rename EnqueueLocalEvent() to ProcessLocalEvent() 2025-04-23 14:19:08 +02:00
Arne Welzel
f8ef5addaa cluster/Backend: Rename HandleRemoteEvent() to ProcessEvent()
...also add Backend::ProcessEvent() for backends to trigger event
processing without needing to use ProcessEventMessage().
2025-04-23 14:19:08 +02:00
Arne Welzel
390a4fc1bb cluster/websocket: Fix websocket_client_added id value 2025-04-23 14:19:08 +02:00
Arne Welzel
6c44bfa3fb broker: Include log event identifier in stderr output 2025-04-23 14:19:08 +02:00
Arne Welzel
ba5dcb1d84 cluster/websocket: Debug output fixes 2025-04-23 14:19:08 +02:00
Robin Sommer
e6700670fb
Bump Spicy. 2025-04-23 12:24:10 +02:00
Tim Wojtulewicz
b8382a126c Update zeek-aux submodule [nomail] 2025-04-22 21:06:43 -07:00
zeek-bot
b42f9b49d3 Update doc submodule [nomail] [skip ci] 2025-04-23 00:14:55 +00:00
Tim Wojtulewicz
b8587c4fa9 Merge remote-tracking branch 'origin/topic/timw/upgrade-cares-to-1.34.5'
* origin/topic/timw/upgrade-cares-to-1.34.5:
  Update c-ares to v1.34.5 and vcpkg to a version that includes it
2025-04-22 08:44:37 -07:00
Christian Kreibich
ed161692dd Merge branch 'topic/christian/gh4318-track-broker-peerings'
* topic/christian/gh4318-track-broker-peerings:
  Use Broker peering directionality when re-peering after backpressure overflows
  Expand Broker APIs to allow tracking directionality of peering establishment
2025-04-21 17:21:03 -07:00
Christian Kreibich
549e678dff Use Broker peering directionality when re-peering after backpressure overflows
This avoids creating pointless connection reattempts to ephemeral TCP
client-side ports, which have been cluttering up the Broker logs since 7.1.
2025-04-21 14:08:42 -07:00
Christian Kreibich
b430d5235c Expand Broker APIs to allow tracking directionality of peering establishment
This provides ways to figure out for a given peer, or a given address/port pair,
whether the local node originally established the peering.
2025-04-21 14:08:42 -07:00
Tim Wojtulewicz
d59f6014b8 Update broker submodule [nomail] 2025-04-18 12:36:28 -07:00
Tim Wojtulewicz
ee64cf0863 Update c-ares to v1.34.5 and vcpkg to a version that includes it 2025-04-18 12:03:16 -07:00
Tim Wojtulewicz
953c039603 Merge remote-tracking branch 'origin/topic/timw/test-cmake-krb5-fixes'
* origin/topic/timw/test-cmake-krb5-fixes:
  Use longer path when including krb5.h to match the cmake lookup
  Update cmake submodule for krb5 fixes [nomail]
2025-04-18 11:36:26 -07:00
Tim Wojtulewicz
90f0fae7cc Use longer path when including krb5.h to match the cmake lookup 2025-04-18 11:35:54 -07:00
Tim Wojtulewicz
ce0a6931df Update cmake submodule for krb5 fixes [nomail] 2025-04-18 11:35:54 -07:00
Tim Wojtulewicz
b808967d1f Merge remote-tracking branch 'origin/topic/bbannier/bump-spicy'
* origin/topic/bbannier/bump-spicy:
  Bump auxil/spicy to latest development snapshot
2025-04-17 17:48:53 -07:00
Benjamin Bannier
5fea3eced6 Bump auxil/spicy to latest development snapshot 2025-04-17 20:30:10 +02:00
Tim Wojtulewicz
89d22f6133 Merge branch 'topic/timw/clang-tidy-iwyu-for-all-targets'
* topic/timw/clang-tidy-iwyu-for-all-targets:
  Update src/3rdparty submodule to disable clang-format
  Disable linting for files generated by bison
  Make sure clang-tidy and iwyu are added to all targets
2025-04-17 09:29:11 -07:00
Tim Wojtulewicz
94d742d314 Update src/3rdparty submodule to disable clang-format 2025-04-17 09:26:55 -07:00
Tim Wojtulewicz
7111d6a143 Disable linting for files generated by bison
These files will report lots of findings in the code that we have no
control over.
2025-04-17 09:26:55 -07:00
Tim Wojtulewicz
64e2fccc2b Make sure clang-tidy and iwyu are added to all targets 2025-04-17 09:26:55 -07:00
Tim Wojtulewicz
ce7ef3ce6a Merge remote-tracking branch 'origin/topic/timw/include-zeekjs-in-docs-by-default'
* origin/topic/timw/include-zeekjs-in-docs-by-default:
  Add libnode-dev to docs github runner, update docs to include ZeekJS
2025-04-17 08:59:41 -07:00
Tim Wojtulewicz
586a4fc4c5 Add libnode-dev to docs github runner, update docs to include ZeekJS 2025-04-17 08:58:54 -07:00
Arne Welzel
0cb5ec735a Merge remote-tracking branch 'origin/topic/awelzel/btest-no-bare-at-test'
* origin/topic/awelzel/btest-no-bare-at-test:
  pre-commit: Ensure testing files have @TEST lines commented
  testing/btest/*js: Comment all @TEST lines
  testing/btest/*test: Comment all @TEST lines
  testing/btest/*evt: Comment all @TEST lines
  testing/btest/*zeek: Comment all @TEST lines
2025-04-17 16:57:08 +02:00
Arne Welzel
dde478db6d pre-commit: Ensure testing files have @TEST lines commented 2025-04-17 16:30:23 +02:00
Arne Welzel
51f504b38f testing/btest/*js: Comment all @TEST lines 2025-04-17 16:30:23 +02:00
Arne Welzel
86249db2a3 testing/btest/*test: Comment all @TEST lines 2025-04-17 16:30:23 +02:00
Arne Welzel
6617da5bbd testing/btest/*evt: Comment all @TEST lines 2025-04-17 16:30:23 +02:00
Arne Welzel
85b8c8866b testing/btest/*zeek: Comment all @TEST lines 2025-04-17 16:30:23 +02:00
Arne Welzel
2f0be32f5f Merge branch 'topic/jgras/shutdown-session-clear' of https://github.com/J-Gras/zeek
* 'topic/jgras/shutdown-session-clear' of https://github.com/J-Gras/zeek:
  Remove finish_run()
  Deprecate session manager's Done()
  Clear sessions when session manager is done
2025-04-17 15:20:42 +02:00
Jan Grashoefer
7e2f33c9ee Remove finish_run() 2025-04-17 14:38:21 +02:00
Tim Wojtulewicz
9dc57225c8 Merge remote-tracking branch 'origin/topic/bbannier/ixwebsocket-warnings'
* origin/topic/bbannier/ixwebsocket-warnings:
  Suppress warnings from compilation of external ixwebsocket dependency
2025-04-16 15:41:05 -07:00
Tim Wojtulewicz
63837a44ed Update docs submodule [nomail] [skip ci] 2025-04-16 13:53:02 -07:00
Benjamin Bannier
d3d49727ee Suppress warnings from compilation of external ixwebsocket dependency
Clang warns about declared but unused parameters somewhere in the guts of
IXWebSocket (internal code, not its headers). We are not interested in
this or similar warnings since we do not control this code, so suppress
all warnings for this target.
2025-04-16 20:42:14 +02:00
Arne Welzel
a2a535d0c9 Merge remote-tracking branch 'origin/topic/awelzel/4275-ldap-gss-spnego-auth-miss'
* origin/topic/awelzel/4275-ldap-gss-spnego-auth-miss:
  ldap: Clean up from code review
  ldap: Add Sicily Authentication constants
  ldap: Only switch into MS_KRB5 mode if responseToken exists
2025-04-16 09:40:05 +02:00
zeek-bot
e24be6ba3f Update doc submodule [nomail] [skip ci] 2025-04-16 00:15:39 +00:00
Arne Welzel
b8e573a3b9 ldap: Clean up from code review
Co-authored-by: Benjamin Bannier <benjamin.bannier@corelight.com>
2025-04-15 20:10:56 +02:00
Arne Welzel
07bf7f8b18 ldap: Add Sicily Authentication constants
The aduser1-ntlm.pcap contains bindRequest messages using Microsoft AD
specific Sicily Authentication [1]. Add the entries to the enum so we
don't log undefined for these and also check the NTLMSSP signature.

[1] https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-adts/8b9dbfb2-5b6a-497a-a533-7e709cb9a982
2025-04-15 20:10:56 +02:00
Arne Welzel
ff58be2f36 ldap: Only switch into MS_KRB5 mode if responseToken exists
If the server doesn't include a responseToken within negTokenResp,
assume there won't be signing or sealing happening on the
connection. Don't switch into MS_KRB5 mode.

Closes #4275
2025-04-15 20:10:52 +02:00
Jan Grashoefer
124f2a7d28 Deprecate session manager's Done() 2025-04-15 18:55:56 +02:00
Arne Welzel
ee5ebc1b2a Merge remote-tracking branch 'origin/topic/awelzel/bump-websocket-ixwewbsocket'
* origin/topic/awelzel/bump-websocket-ixwewbsocket:
  IXWebSocket: Bump to latest upstream master
2025-04-15 18:31:55 +02:00
Tim Wojtulewicz
4472d600e5 Merge remote-tracking branch 'origin/topic/timw/enable-krb5-on-not-linux'
* origin/topic/timw/enable-krb5-on-not-linux:
  CI: Add krb5 to FreeBSD
  Switch libkrb5 check to exclude only Darwin
2025-04-15 08:58:06 -07:00
Jan Grashoefer
013dc2010f Clear sessions when session manager is done
It looks like there is no reason to keep sessions in the map beyond the
point where the session manager is considered done. This hopefully
simplifies the shutdown control flow a tiny bit.
2025-04-15 14:23:03 +02:00
zeek-bot
349fdccfb3 Update doc submodule [nomail] [skip ci] 2025-04-15 00:26:29 +00:00
Tim Wojtulewicz
22a8c35734 CI: Add krb5 to FreeBSD 2025-04-14 15:15:05 -07:00
Tim Wojtulewicz
2f48229f28 Switch libkrb5 check to exclude only Darwin 2025-04-14 14:58:08 -07:00
Tim Wojtulewicz
6ecb8f0f5f Merge remote-tracking branch 'origin/topic/timw/storage-serialization'
* origin/topic/timw/storage-serialization:
  Add STORAGE_ prefixes for backends and serializers
  Add versioning to JSON serializer
  Remove unnecessary includes in Val.h
  Move byte_buffer types from cluster and storage into util
  Remove unnecessary <array> and <memory> includes from util.h
  Mark storage classes as final where appropriate
  Add JSON storage serializer, use with existing backends/tests
  Make ValFromJSON return zeek::expected instead of a variant
  Ground work for pluggable storage serializers
2025-04-14 10:12:29 -07:00
Tim Wojtulewicz
cb1ef47a31 Add STORAGE_ prefixes for backends and serializers 2025-04-14 10:11:13 -07:00
Tim Wojtulewicz
9593db1974 Add versioning to JSON serializer 2025-04-14 10:11:13 -07:00
Tim Wojtulewicz
dbb3144e2d Remove unnecessary includes in Val.h 2025-04-14 10:11:13 -07:00
Tim Wojtulewicz
1169fcf2a2 Move byte_buffer types from cluster and storage into util 2025-04-14 10:11:13 -07:00
Tim Wojtulewicz
40b75cb809 Remove unnecessary <array> and <memory> includes from util.h 2025-04-14 10:11:13 -07:00
Tim Wojtulewicz
98bd85b805 Mark storage classes as final where appropriate 2025-04-14 10:11:13 -07:00
Tim Wojtulewicz
88786a28a2 Add JSON storage serializer, use with existing backends/tests 2025-04-14 10:11:13 -07:00
Arne Welzel
26d56a3732 IXWebSocket: Bump to latest upstream master
The PR for the threading issue was merged. Still keeping the submodule
to point at our own fork as I have a hunch there might be more.
2025-04-14 19:03:12 +02:00
Tim Wojtulewicz
201d4508e6 Make ValFromJSON return zeek::expected instead of a variant 2025-04-14 10:02:35 -07:00
Tim Wojtulewicz
e545fe8256 Ground work for pluggable storage serializers 2025-04-14 10:02:35 -07:00
Arne Welzel
faac36f4cd Merge remote-tracking branch 'origin/topic/awelzel/bump-zeekjs-0-17-0'
* origin/topic/awelzel/bump-zeekjs-0-17-0:
  Bump zeekjs to v0.17.0
2025-04-14 18:59:13 +02:00
Arne Welzel
ffaeeb6b12 Bump zeekjs to v0.17.0
fc005a5 Plugin: Drop unneeded zeekjs.bif.h
    cbf737f Plugin: Remove unneeded zeek::Args copy
    2129feb Plugin/Nodejs: Remove intermediate Event instance
    5de78b4 Ignore the typescript test.
    550a0f3 Force users to specify to Node that they want to run typescript.
    7a44aad Add a test for typescript support.
    cda2d69 Begin support for the Node's new experimental typescript support
2025-04-14 17:43:29 +02:00
Tim Wojtulewicz
c4d0273ffa Update bifcl submodule [nomail] 2025-04-14 08:11:51 -07:00
Arne Welzel
c2e039f14d Merge remote-tracking branch 'origin/topic/awelzel/generic-metadata-pre-work'
* origin/topic/awelzel/generic-metadata-pre-work:
  cluster/Backend: Add name and lookup component tag
  cluster/Event: Hide members behind accessors
  cluster/PublishEvent:: Make event non-const
  broker/Manager: Re-use broker serializer for conversion
  EventMgr: Add Dispatch() with handler and args
  plugin/Manager: Fix MetaHookPre and MetaHookPost using HOOK_CALL_FUNCTION
2025-04-13 17:16:46 +02:00
Arne Welzel
f1ae944c9c Merge branch 'topic/jgras/fix-future-event-ts' of https://github.com/J-Gras/zeek
* 'topic/jgras/fix-future-event-ts' of https://github.com/J-Gras/zeek:
  Prevent event timestamps set to future
2025-04-11 15:17:11 +02:00
Jan Grashoefer
3858a2920e Prevent event timestamps set to future
For scheduled events, the event timestamp is the intended timestamp. If
we force timer expiration, the timestamp might be in the future. Today,
this happens on shutdown. This change guarantees that event timestamps
are never set beyond network time.
2025-04-11 13:06:33 +02:00
Robin Sommer
75b3bca7de
Bump Spicy. 2025-04-11 13:00:30 +02:00
Robin Sommer
6bf6e695b5
Merge remote-tracking branch 'origin/topic/robin/gh-4301-with-spicy'
* origin/topic/robin/gh-4301-with-spicy:
  Fix `--with-spicy`.
2025-04-11 12:59:29 +02:00
Robin Sommer
a2f4588a15
Merge remote-tracking branch 'origin/topic/robin/gh-3522-spicy-docs-state'
* origin/topic/robin/gh-3522-spicy-docs-state:
  Spicy: Document lifetime semantics of Zeek analyzers created from Spicy.
2025-04-11 12:59:05 +02:00
Arne Welzel
3946856f06 cluster/Backend: Add name and lookup component tag
This adds two new accessors on Backend, Name() and Tag() that can
be used for introspection of a Backend instance.
2025-04-11 10:01:30 +02:00
Arne Welzel
214629e054 cluster/Event: Hide members behind accessors 2025-04-11 09:58:07 +02:00
Arne Welzel
90f94ff4f2 cluster/PublishEvent:: Make event non-const
We want to introduce a hook that can modify the cluster event instances, so
need to pass around a non-const version of it.
2025-04-11 09:58:07 +02:00
Arne Welzel
c4a48baeda broker/Manager: Re-use broker serializer for conversion 2025-04-11 09:58:07 +02:00
Arne Welzel
0e027fa4e3 EventMgr: Add Dispatch() with handler and args
Allow users to call event_mgr.Dispatch(handler, args) instead of
constructing the Event instance themselves. Deprecate the old API
and replace users.

There's a subtle change that net_done() may be propagated via
auto_publish() now, but that still needs opt-in from script land
and likely no one did that, or else they'd expected to have it
work anyhow.
2025-04-11 09:58:07 +02:00
Arne Welzel
6d97d5526a plugin/Manager: Fix MetaHookPre and MetaHookPost using HOOK_CALL_FUNCTION 2025-04-11 09:58:07 +02:00
Arne Welzel
3b478ddc0a Merge remote-tracking branch 'origin/topic/awelzel/make-files-x509-files-test-deterministic'
* origin/topic/awelzel/make-files-x509-files-test-deterministic:
  btest/files/x509/files: Sort analyzers in baseline
2025-04-10 15:47:52 +02:00
Arne Welzel
2f6c31df89 btest/files/x509/files: Sort analyzers in baseline
This test is very sensitive to new enum values that perturb the final
order of the output. Listing the commits that modify that file in the
past clearly shows changes to the baseline happen when a new component
with an enum value is introduced.

    40f04d4ccf broker: Add WebSocketShim backend
    51836d08ae protocol: Add StreamEvent analyzer
    fdde1e9841 cluster/serializer: Add binary-serialization-format
    6fb73aa9da broker: Add shim plugin adding a backend component
    85ca59484b postgresql: Initial parser implementation
    efc2681152 WebSocket: Introduce new analyzer and log
    ...

That's just distraction. Point fix the test to sort the analyzers before
writing the final log line.

I've previously attempted this in a more complete fashion in PR #3365
(issue #3364), but seems this direct fix might just make more sense.
2025-04-10 15:02:44 +02:00
Robin Sommer
9db73415cd
Spicy: Document lifetime semantics of Zeek analyzers created from Spicy.
Closes #3522.
2025-04-10 12:17:05 +02:00
Robin Sommer
ee674e3d80
Fix --with-spicy.
Closes #4301.
2025-04-10 11:03:49 +02:00
Tim Wojtulewicz
f74f5d2734 Merge remote-tracking branch 'origin/topic/timw/revert-unreachable'
* origin/topic/timw/revert-unreachable:
  Revert addition of std::unreachable
2025-04-09 11:12:05 -07:00
Arne Welzel
c0f2ba468d Merge remote-tracking branch 'origin/topic/awelzel/4312-paper-over-flakiness-through-sleep'
* origin/topic/awelzel/4312-paper-over-flakiness-through-sleep:
  btest/brokerstore-attr-persistence-clone: Add BTEST_BG_RUN_SLEEP=1
2025-04-09 18:11:42 +02:00
Arne Welzel
fa7ffaf8c1 btest/brokerstore-attr-persistence-clone: Add BTEST_BG_RUN_SLEEP=1
This test has become flaky after #4295. It hasn't been failing regularly
enough locally to make it approachable. Annotate with
BTEST_BG_RUN_SLEEP=1 to revert to pre #4295 behavior, hopefully
fixing the flakiness as a side-effect.
2025-04-09 18:10:35 +02:00
Tim Wojtulewicz
58fb91315e Revert addition of std::unreachable
After further testing with the fuzzer corpus, std::unreachable isn't
necessary here. It's fine to just let the default case break to fix
the Coverity warning.
2025-04-09 08:39:47 -07:00
Tim Wojtulewicz
f3568d148f Merge branch 'topic/timw/coverity-fixes'
* topic/timw/coverity-fixes:
  Add move assignment operator to ZeekString, which already had a move constructor
  Don't initialize telemetry listener at all if ZEEKCTL_CHECK_CONFIG is set
  Avoid extra temporary strings in concatenation
  Use const auto references to avoid some copies
  Clean up initialization of TunnelEncapsulation to use default member values
  Remove some unnecessary std::move calls in broker::Manager
  Avoid divide-by-zero in CardinalityCounter::Size
  Minor fixes in POP3 analyzer based on flycheck warnings
  More std::move changes based on Coverity findings
  Fix a potential memory leak in Debug function
2025-04-08 11:31:10 -07:00
Tim Wojtulewicz
637ea28653 Add move assignment operator to ZeekString, which already had a move constructor 2025-04-08 11:01:21 -07:00
Tim Wojtulewicz
4f0d18f45f Don't initialize telemetry listener at all if ZEEKCTL_CHECK_CONFIG is set 2025-04-08 11:01:21 -07:00
Tim Wojtulewicz
5c47533653 Avoid extra temporary strings in concatenation 2025-04-08 11:01:21 -07:00
Tim Wojtulewicz
f7495831a2 Use const auto references to avoid some copies 2025-04-08 11:01:21 -07:00
Tim Wojtulewicz
739efc79be Clean up initialization of TunnelEncapsulation to use default member values 2025-04-08 11:01:21 -07:00
Tim Wojtulewicz
9091fe5c99 Remove some unnecessary std::move calls in broker::Manager 2025-04-08 11:01:21 -07:00
Tim Wojtulewicz
bf82f8afc1 Avoid divide-by-zero in CardinalityCounter::Size 2025-04-08 11:01:21 -07:00
Tim Wojtulewicz
bde2dec685 Minor fixes in POP3 analyzer based on flycheck warnings
This also adds an implementation of unreachable() to use for default
cases where it shouldn't ever actually cause the default.
2025-04-08 11:01:21 -07:00
Tim Wojtulewicz
34ee136a3c More std::move changes based on Coverity findings 2025-04-08 11:01:21 -07:00
Tim Wojtulewicz
2390625732 Fix a potential memory leak in Debug function 2025-04-08 11:01:21 -07:00
Tim Wojtulewicz
718dc19345 Merge remote-tracking branch 'origin/topic/bbannier/bump-spicy'
* origin/topic/bbannier/bump-spicy:
  Bump pre-commit hooks
  Bump auxil/spicy to latest development snapshot
2025-04-08 11:00:56 -07:00
Tim Wojtulewicz
290c813373 Updating CHANGES and VERSION. 2025-04-08 11:00:38 -07:00
Tim Wojtulewicz
30d2642272 Merge remote-tracking branch 'origin/topic/timw/4281-unconditionally-forward-out-of-snap'
* origin/topic/timw/4281-unconditionally-forward-out-of-snap:
  Make SNAP analyzer use both OUI and protocol for forwarding
  Change packet analyzer identifiers to be 64-bit
2025-04-08 10:59:15 -07:00
Benjamin Bannier
8aa45c6476 Bump pre-commit hooks 2025-04-08 15:12:21 +02:00
Benjamin Bannier
eb55ea13b2 Bump auxil/spicy to latest development snapshot 2025-04-08 15:12:21 +02:00
zeek-bot
14d91efb71 Update doc submodule [nomail] [skip ci] 2025-04-05 00:14:59 +00:00
Arne Welzel
94b1ce8c15 Merge remote-tracking branch 'origin/topic/awelzel/set-val-on-ids-for-enums'
* origin/topic/awelzel/set-val-on-ids-for-enums:
  broker/main: Adapt enum values to agree with comm.bif
  btest/plugin: Add plugin testing enum identifiers
  Var/add_type: Do not clone EnumType when declared for the first time
  type/id/zeekygen: Add EnumVal to enum identifiers
2025-04-04 18:37:06 +02:00
Arne Welzel
6bc36e8cf8 broker/main: Adapt enum values to agree with comm.bif
Logic to detect this error already existed, but due to enum identifiers
not having a value set, it never triggered before.

Should probably backport this one.
2025-04-04 15:36:42 +02:00
Arne Welzel
cb610bdea2 btest/plugin: Add plugin testing enum identifiers
This plugin has a generic name, but for now just tests the API around
enum types and enum vals at InitPostScript() time.
2025-04-04 15:36:42 +02:00
Arne Welzel
ab87ba9786 Var/add_type: Do not clone EnumType when declared for the first time
EnumType receives the name into its constructor. Even for the  first declaration
the name is not empty and instead the same as the identifier's name. Due to that,
add_type() previously took the else path and created a shallow clone of the
initial type instead of using it. This lead to buggy behavior where enum value
identifiers declared within an enum's first body have a different TypePtr
associated than the one that is found via `zeek:🆔:find_type()`. It also
means that enum identifiers added via redef later would have a different
TypePtr than those in the initial pointer.
2025-04-04 15:36:42 +02:00
Arne Welzel
18597ea49c type/id/zeekygen: Add EnumVal to enum identifiers
Provide a direct way to go from a zeek🆔:ID value to EnumVal without
needing to go through the type.
2025-04-04 15:36:07 +02:00
Arne Welzel
f0ccd5c7f8 Merge remote-tracking branch 'origin/topic/awelzel/4323-traverse-all-stmt-nil-fix'
* origin/topic/awelzel/4323-traverse-all-stmt-nil-fix:
  Traverse: Do not short-circuit traverse_all() if stmts is nullptr
2025-04-03 13:11:30 +02:00
Arne Welzel
513eede34e Traverse: Do not short-circuit traverse_all() if stmts is nullptr
Since commit 0a813a53c7,
zeek::detail::stmts is set to a nullptr when before it was usually
an empty list of statements. This caused traverse_all() to be
short-circuited unless global statements were available.

Fixes #4323
2025-04-03 12:19:34 +02:00
Johanna Amann
37be65dfd0 Merge remote-tracking branch 'origin/topic/johanna/remove-bind-library-check'
* origin/topic/johanna/remove-bind-library-check:
  Remove unnecessary check for bind library.

Closes GH-432t log9
2025-04-03 10:53:21 +01:00
Tim Wojtulewicz
8d71420d09 Merge remote-tracking branch 'origin/topic/timw/enum-val-lookup-speedup'
* origin/topic/timw/enum-val-lookup-speedup:
  Some minor c++ modernization in EnumType methods
  Avoid O(n) search in EnumType::Lookup
2025-04-02 16:36:08 -07:00
Tim Wojtulewicz
08101eb372 Some minor c++ modernization in EnumType methods 2025-04-02 16:35:42 -07:00
Tim Wojtulewicz
c22e54604f Avoid O(n) search in EnumType::Lookup 2025-04-02 16:35:42 -07:00
Johanna Amann
5624359f30 Remove unnecessary check for bind library.
This has not been required since we switched to c-ares and breaks builds
on Fedora Rawhide.

Fixes GH-4329
2025-04-02 18:32:19 +01:00
Robin Sommer
28fd2a7a7a
Merge remote-tracking branch 'origin/topic/robin/spicy-typeinfo-switch'
* origin/topic/robin/spicy-typeinfo-switch:
  Spicy: Rework code for converting Spicy values to Zeek values.
2025-04-02 18:50:09 +02:00
Robin Sommer
000ed528dc
Spicy: Rework code for converting Spicy values to Zeek values.
The logic was template-based so far, which wasn't great because: (1)
conceptually, it models the Spicy types at the wrong layer (C++ rather
than HILTI types), and (2) stopped working with some recent Spicy
updates (which we have temporarily reverted in the meantime to keep
Zeek working).

The new code is based on HILTI's runtime type information and the
corresponding introspection API, pretty much like `spicy-dump` works
as well. This is the recommended approach for working with HILTI
values, and generally much cleaner.

This is on top of https://github.com/zeek/zeek/pull/4300.
2025-04-02 17:45:19 +02:00
Robin Sommer
af46322152
Merge remote-tracking branch 'origin/topic/robin/new-tuple'
* origin/topic/robin/new-tuple:
  Spicy: Port over to Spicy's new tuple representation.
2025-04-02 14:53:26 +02:00
Robin Sommer
94ddd7f411
Spicy: Port over to Spicy's new tuple representation.
Includes a fix for supporting CMake 4.0.
2025-04-02 14:14:26 +02:00
zeek-bot
71305b0009 Update doc submodule [nomail] [skip ci] 2025-04-02 00:14:44 +00:00
Tim Wojtulewicz
b1cd502a96 Merge remote-tracking branch 'origin/topic/timw/add-ignore-docs-annotation'
* origin/topic/timw/add-ignore-docs-annotation:
  Add comment annotation to disable copying redef value into docs
2025-04-01 12:58:31 -07:00
Tim Wojtulewicz
55e458c5f7 Add comment annotation to disable copying redef value into docs 2025-04-01 10:23:55 -07:00
zeek-bot
b1bb4e72c5 Update doc submodule [nomail] [skip ci] 2025-04-01 00:29:33 +00:00
Arne Welzel
363fbd9e28 Merge remote-tracking branch 'origin/topic/awelzel/fix-canon-name-builtin-plugins'
* origin/topic/awelzel/fix-canon-name-builtin-plugins:
  CI: Upgrade zeekctl task to Debian 12
  Bump cmake submodule
  CI: Add external plugins to builtin plugins task
2025-03-31 18:59:47 +02:00
Arne Welzel
14697ea6ba Merge remote-tracking branch 'origin/topic/neverlord/broker-logging'
* origin/topic/neverlord/broker-logging:
  Integrate review feedback
  Hook into Broker logs via its new API
2025-03-31 18:53:43 +02:00
Christian Kreibich
f068f0da4f Merge branch 'topic/christian/quic-history-u'
* topic/christian/quic-history-u:
  Add "U" to QUIC history docstrings and expand version string docs
2025-03-31 09:37:19 -07:00
Benjamin Bannier
06e41cec3a Merge remote-tracking branch 'origin/topic/bbannier/warning-arg-counting' 2025-03-31 15:08:18 +02:00
Arne Welzel
4f8a6a1dfc Merge remote-tracking branch 'origin/topic/awelzel/4177-4178-custom-event-metadata-prework'
* origin/topic/awelzel/4177-4178-custom-event-metadata-prework:
  Event/EventMgr: protected to private
  EventHandler: Deprecate Call(args, no_remote, ts), add Call(args)
  EventHandler: Header cleanup
  EventMgr: Do not cache current event attributes
  EventMgr: Drop src_val
  Event: Header cleanup
2025-03-31 14:22:17 +02:00
Arne Welzel
dfa2d96d22 CI: Upgrade zeekctl task to Debian 12 2025-03-31 14:19:21 +02:00
Arne Welzel
e269b34df1 Bump cmake submodule 2025-03-31 14:19:21 +02:00
Arne Welzel
c45625b909 CI: Add external plugins to builtin plugins task
This clones a few external plugins to include them in a build. Except
for zeek-kafka, the others are maintained by the Zeek project.

Closes #3535
2025-03-31 14:19:18 +02:00
Benjamin Bannier
b1ddf9e476 Use one-based index in warning message
This was surfacing a zero-based counter to users which was confusing.
2025-03-28 14:09:11 +01:00
zeek-bot
92d2d0c6b8 Update doc submodule [nomail] [skip ci] 2025-03-28 00:23:27 +00:00
Tim Wojtulewicz
edbe8f0831 Merge remote-tracking branch 'origin/topic/timw/pass-tags-for-storage-events'
* origin/topic/timw/pass-tags-for-storage-events:
  Make storage events take a tag for the backend instead of a string
  Add move constructor to Tag class
2025-03-27 16:12:53 -07:00
Tim Wojtulewicz
32ae8f4eaa Make storage events take a tag for the backend instead of a string 2025-03-27 16:12:24 -07:00
Tim Wojtulewicz
989e4adf90 Add move constructor to Tag class 2025-03-27 16:12:24 -07:00
Tim Wojtulewicz
ed47eedd6a Merge remote-tracking branch 'origin/topic/timw/storage-timeout-testing'
* origin/topic/timw/storage-timeout-testing:
  Fix handling of timeout conditions from storage backends
  Reformat plugin.storage btest to be more consistent with other storage tests
2025-03-27 14:10:39 -07:00
Tim Wojtulewicz
85701e4514 Fix handling of timeout conditions from storage backends 2025-03-27 13:52:11 -07:00
Tim Wojtulewicz
046f32a6df Reformat plugin.storage btest to be more consistent with other storage tests 2025-03-27 13:52:11 -07:00
Christian Kreibich
98c203b8cb Add "U" to QUIC history docstrings and expand version string docs
Looks like we overlooked documenting "U" in zeek/zeek#3526 .
2025-03-27 13:29:40 -07:00
Christian Kreibich
656e88eaa8 Merge branch 'topic/christian/unexperimental-quic-histories'
* topic/christian/unexperimental-quic-histories:
  Remove "experimental" from the QUIC history field's comment string [skip ci]
2025-03-27 12:41:03 -07:00
Arne Welzel
2f9b1e21bd Event/EventMgr: protected to private
These classes are final, so deriving isn't possible. No reason to have
protected members.
2025-03-27 19:23:47 +01:00
Arne Welzel
f7425b805d EventHandler: Deprecate Call(args, no_remote, ts), add Call(args)
The ts parameter was only added to Call() for the Broker::auto_publish()
functionality and propagating the network timestamp. By now, the auto-publish
functionality is deprecated, so it'd be good to cleanup that signature. There
won't be any need for no_remote in the future either.

Allow users to just use Call() instead.
2025-03-27 19:23:47 +01:00
Arne Welzel
b535f03382 EventHandler: Header cleanup 2025-03-27 19:23:47 +01:00
Arne Welzel
7dadbb0c1d EventMgr: Do not cache current event attributes
Avoid proliferation of various members on EventMgr by storing the
pointer of the current event instead.

This subtly changes the behavior of some builtin functions as they would
have returned the prior event's data when executed outside of event
draining (e.g. C++ level hook invocations), but I think that's actually
for the better.
2025-03-27 19:23:30 +01:00
Arne Welzel
bef923ebeb EventMgr: Drop src_val
This is a left over and hasn't been used since a while.
2025-03-27 11:16:31 +01:00
Arne Welzel
277e6d4129 Event: Header cleanup 2025-03-27 11:16:29 +01:00
Christian Kreibich
2199cb1ddd Remove "experimental" from the QUIC history field's comment string [skip ci]
We're unlikely to fundamentally change (or remove) this field at this point, and
some users wondered whether we might do so, given the labeling.
2025-03-26 14:03:52 -07:00
Arne Welzel
acab4236e2 Merge remote-tracking branch 'origin/topic/awelzel/zeromq-no-fprintf-at-overload'
* origin/topic/awelzel/zeromq-no-fprintf-at-overload:
  cluster/zeromq: Improve XPUB stall behavior, add a metric
2025-03-26 14:24:02 +01:00
Arne Welzel
bfffc8dac8 cluster/zeromq: Improve XPUB stall behavior, add a metric
Instead of fprintf, track the number of occurrences via a metric and
change the sleep loop to a blocking send instead.
2025-03-26 14:23:09 +01:00
Arne Welzel
cd9b37e4a5 Merge remote-tracking branch 'origin/topic/awelzel/4309-telemetry-collect-calbacks'
* origin/topic/awelzel/4309-telemetry-collect-calbacks:
  telemetry: Run callbacks at collect time
2025-03-26 14:08:40 +01:00
Arne Welzel
c3c6ee5a2b telemetry: Run callbacks at collect time
Calling collect_metrics() from a script would not invoke metric
callbacks, resulting in most of the process metrics to be zero
when a Zeek process isn't scraped via Prometheus.

Fixes #4309
2025-03-26 12:07:27 +01:00
Tim Wojtulewicz
195b87b873 Make SNAP analyzer use both OUI and protocol for forwarding 2025-03-24 15:20:50 -07:00
Tim Wojtulewicz
e5d628548b Change packet analyzer identifiers to be 64-bit 2025-03-24 15:19:33 -07:00
Arne Welzel
33d7e5a7bf Merge remote-tracking branch 'origin/topic/awelzel/zeromq-unsubscription-visibility'
* origin/topic/awelzel/zeromq-unsubscription-visibility:
  cluster/OnLoop: Add metric for queue stalling instead of fprintf
  btest/cluster/websocket: ZeroMQ backend test
  cluster/OnLoop: Switch to condition variable
  cluster/zeromq: Fix node_topic() and nodeid_topic()
  cluster/websocket: Fix null deref at WebSocket server shutdown
  btest/cluster/websocket: Harden multi-client tests
  cluster/zeromq: Fix unsubscription visibility
2025-03-24 19:46:20 +01:00
Arne Welzel
52143a5712 cluster/OnLoop: Add metric for queue stalling instead of fprintf 2025-03-24 19:44:08 +01:00
Arne Welzel
50b26fcea8 btest/cluster/websocket: ZeroMQ backend test
This test ensures that WebSocket clients connected to the same node see
each other's messages.
2025-03-24 18:36:52 +01:00
Arne Welzel
387237e9c2 cluster/OnLoop: Switch to condition variable
The busy polling wasn't clever and usually resulted in delays. For now,
switch to mutex/condition variable and log an error if the timeouts are
immense.
2025-03-24 18:36:45 +01:00
Arne Welzel
2963c49f27 cluster/zeromq: Fix node_topic() and nodeid_topic()
Due to prefix matching, worker-1's node_topic() also matched worker-10,
worker-11, etc. Suffix the node topic with a `.`. The original implementation
came from NATS, where subjects are separated by `.`.

Adapt nodeid_topic() for consistency.
2025-03-24 18:36:26 +01:00
Arne Welzel
26441e0c24 cluster/websocket: Fix null deref at WebSocket server shutdown
WebSocket clients that connected with the wrong URL do not have
a backend attached. If a dispatcher is terminated while these
clients are still connected, a null deref would happen.

This was found while running all cluster/websocket tests in a loop
for a long time, tickling a segfault during the bad-url test.
2025-03-24 18:36:26 +01:00
Arne Welzel
888af244b2 btest/cluster/websocket: Harden multi-client tests
These test were very sensible to the speed at which ZeroMQ distributes
subscriptions in the cluster and showed to be unreliably when testing with
zeek/btest#113.

The main fix here is to have individual WebSocket clients subscribe to unique
topics, e.g /test/client-0 and /test/client-1, instead of just a shared topic.

This ensures the WebSocket handshake completes only when they observed their
own subscriptions and not prematurely when observing the shared topic.

This seems mainly relevant for tests: In the real world one shouldn't
rely on subscription visibility - you miss messages if you're too late
to the party.
2025-03-24 18:36:26 +01:00
Arne Welzel
3885871e7d cluster/zeromq: Fix unsubscription visibility
When two workers connect to zeek.cluster.worker, the central ZeroMQ
proxy would not propagate unsubscription information to other nodes
once they both left. Set ZMQ_XPUB_VERBOSER on the proxies XPUB socket
for visibility.
2025-03-24 18:36:16 +01:00
zeek-bot
6045c8ee64 Update doc submodule [nomail] [skip ci] 2025-03-22 00:15:29 +00:00
Tim Wojtulewicz
bc38dbcc99 Merge remote-tracking branch 'origin/topic/timw/storage-framework-followup'
* origin/topic/timw/storage-framework-followup:
  Redis: Handle other errors from requests, fix KEY_EXISTS for put operations
  SQLite: handle existing keys when overwrite=F correctly
  Remove unnecessary type aliases from storage btests
  Avoid thread-leak in scripts.base.frameworks.file-analysis.bifs.enable-disable btest
  Fix data-race with calling DBG_LOG from a separate thread
  Fix data-race with ReturnCode objects in Sqlite::DoExpire
  Fix data race with calling run_state::network_time from a separate thread
  Add NEWS entry for Storage, reduce CHANGES spam
  Fix Coverity findings in the SQLite backend
  Remove inclusion of non-existent expected-lite path during dynamic plugin builds
  Squash code from OperationResultCallback into ResultCallback
  Add hiredis to generate-docs workflow to enable Redis backend
2025-03-21 11:57:17 -07:00
Tim Wojtulewicz
855c530b64 Redis: Handle other errors from requests, fix KEY_EXISTS for put operations 2025-03-21 11:56:27 -07:00
Tim Wojtulewicz
3d7fcfb428 SQLite: handle existing keys when overwrite=F correctly 2025-03-21 11:56:27 -07:00
Tim Wojtulewicz
ba9cf1e4db Remove unnecessary type aliases from storage btests 2025-03-21 11:56:27 -07:00
Tim Wojtulewicz
d5ebaf476d Avoid thread-leak in scripts.base.frameworks.file-analysis.bifs.enable-disable btest
This btest uses the exit() BIF to shut down, which immediately calls
::exit() and kills Zeek without doing any shutdown. This will sometimes
leave the thread running the storage manager, which causes TSan to
complain about a thread leak. Switch to use the terminate() BIF instead
which cleanly shuts down all of Zeek.
2025-03-21 11:56:27 -07:00
Tim Wojtulewicz
78267c382c Fix data-race with calling DBG_LOG from a separate thread 2025-03-21 11:56:27 -07:00
Tim Wojtulewicz
a67e138d4e Fix data-race with ReturnCode objects in Sqlite::DoExpire 2025-03-21 11:56:27 -07:00
Tim Wojtulewicz
8b9fe48f13 Fix data race with calling run_state::network_time from a separate thread 2025-03-21 11:56:27 -07:00
Tim Wojtulewicz
458bf762f1 Add NEWS entry for Storage, reduce CHANGES spam 2025-03-21 11:56:27 -07:00
Tim Wojtulewicz
0929cf507f Fix Coverity findings in the SQLite backend 2025-03-21 11:56:27 -07:00
Tim Wojtulewicz
e505135507 Remove inclusion of non-existent expected-lite path during dynamic plugin builds 2025-03-21 11:55:12 -07:00
Tim Wojtulewicz
e5b06367f7 Squash code from OperationResultCallback into ResultCallback 2025-03-21 11:44:39 -07:00
Tim Wojtulewicz
cd66b32428 Add hiredis to generate-docs workflow to enable Redis backend 2025-03-21 11:44:39 -07:00
Arne Welzel
0a6429d447 Merge remote-tracking branch 'origin/topic/awelzel/btest-bg-run-sleep-0'
* origin/topic/awelzel/btest-bg-run-sleep-0:
  testing/btest: Remove btest-bg-run sleep 1
2025-03-21 09:45:15 +01:00
Arne Welzel
32d7cec549 testing/btest: Remove btest-bg-run sleep 1
Bump to the latest btest master version and set BTEST_BG_RUN_SLEEP
environment variable and to 0. This makes btest-bg-run return
immediately instead of delaying by 1 second.
2025-03-20 10:11:12 +01:00
zeek-bot
1c598df53b Update doc submodule [nomail] [skip ci] 2025-03-20 00:14:12 +00:00
Tim Wojtulewicz
0b590c575e Merge remote-tracking branch 'origin/topic/awelzel/allow-terminate-processing-from-non-main-thread'
* origin/topic/awelzel/allow-terminate-processing-from-non-main-thread:
  util: Fix terminate_processing() called from non-main thread
2025-03-19 12:47:48 -07:00
Tim Wojtulewicz
38484b6dc6 Merge remote-tracking branch 'origin/topic/vern/CPP-maint.Mar25'
* origin/topic/vern/CPP-maint.Mar25:
  minor baseline updates for -O gen-C++
  -O gen-C++ support for pattern-to-pattern comparison
  -O gen-C++ support for pattern vector comparisons
  -O gen-C++ support for type expressions
2025-03-19 12:46:52 -07:00
Vern Paxson
fb43bc63cd minor baseline updates for -O gen-C++ 2025-03-19 12:46:15 -07:00
Tim Wojtulewicz
ba28dfe87e Merge remote-tracking branch 'origin/topic/timw/run-macos-ci-tests-as-root'
* origin/topic/timw/run-macos-ci-tests-as-root:
  CI: Run btests on macOS under sudo
2025-03-19 11:58:55 -07:00
Arne Welzel
f4d7243365 Merge remote-tracking branch 'origin/topic/awelzel/bump-zeekjs-0-16-0'
* origin/topic/awelzel/bump-zeekjs-0-16-0:
  Bump zeekjs to v0.16.0
2025-03-19 19:57:16 +01:00
Tim Wojtulewicz
d989d1fc0e CI: Run btests on macOS under sudo 2025-03-19 10:56:45 -07:00
Christian Kreibich
637baefd2c Merge branch 'topic/christian/is_valid_subnet'
* topic/christian/is_valid_subnet:
  Minor typo/markup fixes in NEWS.
  Add is_valid_subnet BiF
  Add btests for has_valid_octets() and normalize_mac()
2025-03-19 10:11:02 -07:00
Johanna Amann
7626039635 Merge remote-tracking branch 'origin/topic/johanna/ssh-server-banners-can-be-wild'
* origin/topic/johanna/ssh-server-banners-can-be-wild:
  SSH analyzer - tiny aesthetic fixes
  SSH: make banner parsing more robust
  SSH: split banner into client/server parts
2025-03-19 15:31:35 +00:00
Johanna Amann
19a070080f SSH analyzer - tiny aesthetic fixes
No functional changes. Addresses feedback of GH-4289
2025-03-19 10:38:03 +00:00
Arne Welzel
5f9018879d Bump zeekjs to v0.16.0
8edcd88 version: 0.16.0
    9ec0b25 Executor: Allow compilation with GCC 11.2
    2760b4f Node.js: Install uv_timer to imitate being alive
2025-03-19 09:45:47 +01:00
Christian Kreibich
283b140e6a Minor typo/markup fixes in NEWS. 2025-03-18 20:25:49 -07:00
Yacin Nadji
8b83c2995a Add is_valid_subnet BiF
Also includes consistency tweak for is_valid_ip() plus test cases.
2025-03-18 20:25:32 -07:00
Christian Kreibich
7ba9609992 Add btests for has_valid_octets() and normalize_mac()
These functions reside in base/utils/addrs.zeek and were not tested. We don't
use has_valid_octets() anywhere right now, normalize_mac() is used in the RADIUS
analyzer, and addr_to_uri() is used in the signatures/dpd.zeek tests.
2025-03-18 20:21:43 -07:00
zeek-bot
d7cc409fd5 Update doc submodule [nomail] [skip ci] 2025-03-19 00:36:02 +00:00
Tim Wojtulewicz
cb5e3d0054 Merge remote-tracking branch 'origin/topic/timw/vntag-in-vlan'
* origin/topic/timw/vntag-in-vlan:
  Add analyzer registration from VLAN to VNTAG
2025-03-18 11:52:19 -07:00
Tim Wojtulewicz
43faea880b Add analyzer registration from VLAN to VNTAG 2025-03-18 11:51:27 -07:00
Tim Wojtulewicz
d9af6d0270 Update src/3rdparty submodule [nomail] 2025-03-18 11:47:50 -07:00
Tim Wojtulewicz
e92f41e737 Updating CHANGES and VERSION. 2025-03-18 11:44:38 -07:00
Tim Wojtulewicz
75fef4b2cf Merge remote-tracking branch 'origin/topic/timw/storage-framework'
* origin/topic/timw/storage-framework: (52 commits)
  Update docs submodule [nomail]
  Cleanup/update comments across the storage C++ files
  Split storage.bif file into events/sync/async, add more comments
  Update comments in script files, run zeek-format on all of them
  Allow sync methods to be called from when conditions, add related btest
  Redis: Handle disconnection correctly via callback
  Redis: Fix sync erase, add btest for it
  Remove default argument for callbacks, reorder function arguments
  Remove file-local expire_running variable
  Pass network time down to Expire()
  Add IN_PROGRESS return code, handle for async backends
  Store sqlite3_stmts directly instead of looking up from a map
  Reduce code duplication in storage.bif
  Add OperationResult::MakeVal, use it to reduce some code duplication
  Rearrange visibility of Backend methods, add DoPoll/DoExpire, add return comments
  Implement Storage::backend_opened and Storage::backend_lost events
  SQLite: expand expiration test
  SQLite: Handle other return values from sqlite3_step
  Redis: Fix thread-contention issues with Expire(), add more tests
  Change how redis-server is run during btests, removing redis.conf
  ...
2025-03-18 11:43:48 -07:00
Tim Wojtulewicz
6fa2202826 Update docs submodule [nomail] 2025-03-18 10:25:14 -07:00
Tim Wojtulewicz
8bca6a8594 Cleanup/update comments across the storage C++ files 2025-03-18 10:20:34 -07:00
Tim Wojtulewicz
c7015e8250 Split storage.bif file into events/sync/async, add more comments 2025-03-18 10:20:34 -07:00
Tim Wojtulewicz
f40947f6ac Update comments in script files, run zeek-format on all of them 2025-03-18 10:20:34 -07:00
Tim Wojtulewicz
d0741c8001 Allow sync methods to be called from when conditions, add related btest 2025-03-18 10:20:34 -07:00
Tim Wojtulewicz
a40db844eb Redis: Handle disconnection correctly via callback 2025-03-18 10:20:34 -07:00
Tim Wojtulewicz
b067a6e588 Redis: Fix sync erase, add btest for it 2025-03-18 10:20:34 -07:00
Tim Wojtulewicz
e6f1eea1b7 Remove default argument for callbacks, reorder function arguments 2025-03-18 10:20:34 -07:00
Tim Wojtulewicz
605973497f Remove file-local expire_running variable 2025-03-18 10:20:34 -07:00
Tim Wojtulewicz
ebefb21c53 Pass network time down to Expire() 2025-03-18 10:20:34 -07:00
Tim Wojtulewicz
c7503654e8 Add IN_PROGRESS return code, handle for async backends 2025-03-18 10:20:34 -07:00
Tim Wojtulewicz
60aa987e06 Store sqlite3_stmts directly instead of looking up from a map 2025-03-18 10:20:34 -07:00
Tim Wojtulewicz
44c6e32ae7 Reduce code duplication in storage.bif 2025-03-18 10:20:34 -07:00
Tim Wojtulewicz
ad224d9a3b Add OperationResult::MakeVal, use it to reduce some code duplication 2025-03-18 10:20:34 -07:00
Tim Wojtulewicz
99160f8fcd Rearrange visibility of Backend methods, add DoPoll/DoExpire, add return comments 2025-03-18 10:20:34 -07:00
Tim Wojtulewicz
cc7b2dc890 Implement Storage::backend_opened and Storage::backend_lost events 2025-03-18 10:20:34 -07:00
Tim Wojtulewicz
a99a13dc4c SQLite: expand expiration test 2025-03-18 10:20:33 -07:00
Tim Wojtulewicz
ac4aef2d94 SQLite: Handle other return values from sqlite3_step 2025-03-18 10:20:33 -07:00
Tim Wojtulewicz
cca1d4f988 Redis: Fix thread-contention issues with Expire(), add more tests 2025-03-18 10:20:33 -07:00
Tim Wojtulewicz
b81e876ec8 Change how redis-server is run during btests, removing redis.conf 2025-03-18 10:20:33 -07:00
Tim Wojtulewicz
9ed3e33f97 Completely rework return values from storage operations 2025-03-18 10:20:33 -07:00
Tim Wojtulewicz
8ddda016ff Update some btests due to timing changes 2025-03-18 10:20:33 -07:00
Tim Wojtulewicz
e766af7322 Split sync/async handling into the BIF methods 2025-03-18 10:20:33 -07:00
Tim Wojtulewicz
c247de8ec3 Redis: Rework everything to only use async mode 2025-03-18 10:20:33 -07:00
Tim Wojtulewicz
40f60f26b3 Run expiration on a separate thread 2025-03-18 10:20:33 -07:00
Tim Wojtulewicz
cad48cebd4 Pass network-time-based expiration time to backends instead of an interval 2025-03-18 10:20:33 -07:00
Tim Wojtulewicz
a485b1d237 Make backend options a record, move actual options to be sub-records 2025-03-18 10:20:33 -07:00
Tim Wojtulewicz
64f3969434 Always register backend for expiration, check for open during loop 2025-03-18 10:20:33 -07:00
Tim Wojtulewicz
28951dccf1 Split sync and async into separate script-land namespaces 2025-03-18 10:20:33 -07:00
Tim Wojtulewicz
e8074c40d4 Remove Backend::SupportsAsync 2025-03-18 09:32:34 -07:00
Tim Wojtulewicz
42ad5bbf7d Add btest that uses a Redis backend in a cluster 2025-03-18 09:32:34 -07:00
Tim Wojtulewicz
f1a7376e0a Return generic result for get operations that includes error messages 2025-03-18 09:32:34 -07:00
Tim Wojtulewicz
4695060d75 Allow opening and closing backends to be async 2025-03-18 09:32:34 -07:00
Tim Wojtulewicz
ea87c773cd Redis: Support non-native expiration when reading traces 2025-03-18 09:32:34 -07:00
Tim Wojtulewicz
08bebaa426 Redis: Add btests for the redis backend 2025-03-18 09:32:34 -07:00
Tim Wojtulewicz
52d94b781a Redis: Force storage sync mode when reading pcaps, default to async mode 2025-03-18 09:32:34 -07:00
Tim Wojtulewicz
31e146b16d Redis: Add new backend 2025-03-18 09:32:34 -07:00
Tim Wojtulewicz
6289eb8e15 SQLite: Fix some issues with expiration, including in the btest 2025-03-18 09:32:34 -07:00
Tim Wojtulewicz
6bc5f70236 SQLite: Add additional btests, which also cover general storage functionality
- New erase/overwrite tests
- Change existing sqlite-basic test to use async
- Test passing bad keys to validate backend type checking
- New test for compound keys and values
2025-03-18 09:32:34 -07:00
Tim Wojtulewicz
b2bcb19b22 SQLite: Add pragma integrity_check 2025-03-18 09:32:34 -07:00
Tim Wojtulewicz
3e8ff836aa SQLite: Add tuning options to configuration 2025-03-18 09:32:34 -07:00
Tim Wojtulewicz
ec49f5d550 SQLite: Handle automated expiration 2025-03-18 09:32:34 -07:00
Tim Wojtulewicz
e95784db16 SQLite: Store/lookup prepared statements instead of recreating 2025-03-18 09:32:34 -07:00
Tim Wojtulewicz
9d1eef3fbc Add basic SQLite storage backend 2025-03-18 09:32:34 -07:00
Tim Wojtulewicz
7ad6a05f5b Add infrastructure for asynchronous storage operations 2025-03-18 09:32:34 -07:00
Tim Wojtulewicz
d07d27453a Add infrastructure for automated expiration of storage entries
This is used for backends that don't support expiration natively.
2025-03-18 09:32:34 -07:00
Tim Wojtulewicz
8dee733a7d Change args to Storage::put to be a record
The number of args being passed to the put() methods was getting to be
fairly long, with more on the horizon. Changing to a record means simplifying
things a little bit.
2025-03-18 09:32:34 -07:00
Tim Wojtulewicz
69d940533d Pass key/value types for validation when opening backends 2025-03-18 09:32:34 -07:00
Tim Wojtulewicz
2ea0f3e70a Lay out initial parts for the Storage framework
This includes a manager, component manager, BIF and script code, and
parts to support new storage backend plugins.
2025-03-18 09:32:34 -07:00
Tim Wojtulewicz
3d6e7c85b0 DebugLogger: add stream for storage 2025-03-18 09:32:34 -07:00
Tim Wojtulewicz
e2b9e81c53 plugin: Add component enum for storage backends 2025-03-18 09:32:34 -07:00
Tim Wojtulewicz
aeedd25cff Add martinmoene/expected-lite as a submodule 2025-03-18 09:32:34 -07:00
Johanna Amann
6023c8b906 SSH: make banner parsing more robust
This change revamps SSH banner parsing.  The previous behavior was both
a bit too strict in some regards, and too permissive in other.

Specifically, clients are now required to send a line starting with
"SSH-" as the first line.  This is in line with the RFC, as well with
observed behavior. This also prevents the creation of `ssh.log` for
non-SSH traffic on port 22.

For the server side, we now accept text before the SSH banner. This
previously led to a protocol violation but is allowed by the spec.

New tests are added to cover these cases.
2025-03-18 16:19:33 +00:00
Robin Sommer
3d25328204
Merge remote-tracking branch 'origin/topic/robin/gh-4250-vec-allocator'
* origin/topic/robin/gh-4250-vec-allocator:
  Spicy: Fix passing vectors to Zeek.
2025-03-18 09:08:50 +01:00
Robin Sommer
993e1a6562
Merge remote-tracking branch 'origin/topic/robin/gh-zeek-4238-spicy-bump'
* origin/topic/robin/gh-zeek-4238-spicy-bump:
  Bump `cmake` submodule.
  Bump Spicy.
  [Spicy] Add missing `to_string` overload.
2025-03-18 09:07:16 +01:00
zeek-bot
189fd0b071 Update doc submodule [nomail] [skip ci] 2025-03-18 00:14:00 +00:00
Tim Wojtulewicz
43f108bb71 Merge remote-tracking branch 'origin/topic/timw/ci-macos-sequoia'
* origin/topic/timw/ci-macos-sequoia:
  ci/init-external-repo.sh: Use regex to match macos cirrus task
  CI: Change macOS runner to Sequoia
2025-03-17 11:55:27 -07:00
Arne Welzel
919176873e ci/init-external-repo.sh: Use regex to match macos cirrus task 2025-03-17 10:48:59 +01:00
Tim Wojtulewicz
46edc829cf CI: Change macOS runner to Sequoia 2025-03-14 18:29:52 -07:00
zeek-bot
8a4041b776 Update doc submodule [nomail] [skip ci] 2025-03-13 00:13:10 +00:00
Johanna Amann
629f2bd03a SSH: split banner into client/server parts
This is prepatatory work and should not lead to functional changes.
Client and server banners can be quite different in practice.
2025-03-12 15:06:31 +00:00
Robin Sommer
33fba2476e
Bump cmake submodule. 2025-03-12 14:34:02 +01:00
Robin Sommer
16ff7f69c2
Bump Spicy.
This includes a fix to adapt to Spicy-side changes.
2025-03-12 13:59:32 +01:00
Robin Sommer
859ec00bd9
[Spicy] Add missing to_string overload.
Spicy now requires this.
2025-03-12 13:59:30 +01:00
Arne Welzel
1b655836be Merge remote-tracking branch 'origin/topic/awelzel/ci-generate-docs-run-pre-commit'
* origin/topic/awelzel/ci-generate-docs-run-pre-commit:
  github/generate-docs: Run pre-commit
  cluster/backends/zeromq: Fix rst link in docs
2025-03-12 13:11:18 +01:00
Arne Welzel
e489b322e5 github/generate-docs: Run pre-commit
...it's a bit unfortunate that we cannot use the action for this. It's
because ./doc is a submodule and not the main repo.
2025-03-12 12:06:49 +01:00
Arne Welzel
cc0c48423d cluster/backends/zeromq: Fix rst link in docs 2025-03-12 10:11:25 +01:00
zeek-bot
f15281ab64 Update doc submodule [nomail] [skip ci] 2025-03-12 00:15:42 +00:00
Arne Welzel
bb58148c64 Merge remote-tracking branch 'origin/topic/awelzel/4136-cluster-websocket-support'
* origin/topic/awelzel/4136-cluster-websocket-support:
  ci/opensuse-tumpleweed: Bust cache
  ci/macos/prepare: Install python@3 explicitly
  cluster/websocket: Implement WebSocket server
  cluster/websocket: Add IXWebsocket submodule
  ci/alpine: Install openssl package for testing
  ci: Install websockets from pip for all distros
  auxil/libunistd: Bump for ssize_t typedef
  auxil/broker: Bump to latest master version
  cluster/zeromq: Catch log_push.send() exception
  cluster/zeromq: Catch exceptions as const zmq::error_t&
  cluster/zeromq: No assert on inproc handling
  cluster/zeromq: Support configuring IO threads for proxy thread
  cluster/zeromq: Move variable lookups from DoInit() to DoInitPostScript()
  cluster/zeromq: Handle EINTR at shutdown
  cluster/zeromq: Queue one message at a time
  cluster/Backend: Queue a single message only
  cluster/zeromq: Adapt for OnLoopProcess changes
  cluster/ThreadedBackend: Switch to OnLoopProcess
  cluster/OnLoop: Introduce helper template class
  serializer/broker: Expose to_broker_event() and to_zeek_event()
2025-03-11 10:51:09 +01:00
Arne Welzel
81acc4509d ci/opensuse-tumpleweed: Bust cache
Got a build failure because the old container images had python3-devel
for Python3.11 or something older, but then prepare.sh would install
Python 3.13 and Zeek's configure failing due to trying to find the
devel headers from python313-devel which wasn't installed by prepare.sh
2025-03-11 10:18:20 +01:00
Arne Welzel
70f5430e7c ci/macos/prepare: Install python@3 explicitly
It seems Homebrew's Python 3.12 doesn't install default symlinks or
python3 symlinks[1]. I believe this results in prepare.sh using the
system's Python rather than Homebrew's. Install python@3 explicitly
to put the symlinks in place.

[1] https://stackoverflow.com/a/77655631
2025-03-11 09:51:01 +01:00
zeek-bot
a62b7ffe4d Update doc submodule [nomail] [skip ci] 2025-03-11 00:14:11 +00:00
Arne Welzel
db28ff04e2 Merge remote-tracking branch 'origin/topic/awelzel/javascript-separate-thread'
* origin/topic/awelzel/javascript-separate-thread:
  btest/javascript: Add file_sniff() and file_state_remove() test
  Bump zeekjs to v0.15.0
2025-03-10 19:42:36 +01:00
Arne Welzel
e2b65acc6d btest/javascript: Add file_sniff() and file_state_remove() test
Using file_state_remove() or file_sniff() would previously crash with the
spicy-zip file analyzer. We don't have spicy-zip here, so it's not a
proper reproducer, but still makes sense to test these events.
2025-03-10 19:15:06 +01:00
Arne Welzel
cf154e02dd Bump zeekjs to v0.15.0
f5ff7c4 version: 0.15.0
    2a48143 docker/fedora: Bust cache and ensure sqlite-libs is updated
    05e5f57 Executor: Unblock SIGTERM in thread
    46496b9 Instance: Remove unsued variable
    c3b3c86 Instance: Offload JavaScript invocations to executor thread
    09e311f Introduce Executor helper

Mainly, run JavaScript on a separate thread for interoperability with
Spicy fiber stacks.

Closes #4239
2025-03-10 19:14:45 +01:00
Arne Welzel
6032741868 cluster/websocket: Implement WebSocket server 2025-03-10 17:07:30 +01:00
Arne Welzel
1e757b2b59 cluster/websocket: Add IXWebsocket submodule 2025-03-10 17:07:30 +01:00
Arne Welzel
0b49eac057 ci/alpine: Install openssl package for testing 2025-03-10 17:07:30 +01:00
Arne Welzel
9f768d1896 ci: Install websockets from pip for all distros
The cluster/websocket tests were developed against websockets 14.2,
but Ubuntu and Alpine ship too old versions. Switch to installing
the latest version from pip instead, so we don't need to bother making
tests compatible with very old Python packages shipped by distributions.
2025-03-10 17:07:30 +01:00
Arne Welzel
91eb2786be auxil/libunistd: Bump for ssize_t typedef 2025-03-10 17:07:30 +01:00
Arne Welzel
3a0216728c auxil/broker: Bump to latest master version 2025-03-10 17:07:30 +01:00
Arne Welzel
eb1f9f9a42 cluster/zeromq: Catch log_push.send() exception 2025-03-10 17:07:30 +01:00
Arne Welzel
b82dcfafa4 cluster/zeromq: Catch exceptions as const zmq::error_t& 2025-03-10 17:07:30 +01:00
Arne Welzel
8a1abfa8ef cluster/zeromq: No assert on inproc handling
This might happen if we didn't succeed in completely sending a multipart
message and stop early.
2025-03-10 17:07:30 +01:00
Arne Welzel
aad512c616 cluster/zeromq: Support configuring IO threads for proxy thread 2025-03-10 17:07:30 +01:00
Arne Welzel
ba7b605a97 cluster/zeromq: Move variable lookups from DoInit() to DoInitPostScript() 2025-03-10 17:07:30 +01:00
Arne Welzel
540d9da5ef cluster/zeromq: Handle EINTR at shutdown
Read ::signal_val and early exit a DoPublish() in case termination
happened while blocked in inproc.send()
2025-03-10 17:07:30 +01:00
Arne Welzel
94ec3af2b0 cluster/zeromq: Queue one message at a time
Queueing multiple messages can easily overload the IO loop without
creating any backpressure.
2025-03-10 17:07:30 +01:00
Arne Welzel
09ccb2e250 cluster/Backend: Queue a single message only
The ZeroMQ backend would accumulate multiple messages and enqueue them
all at once. However, as this could potentially result in huge batches
of events being queued into the event loop at once, switch to a one
message at a time model. If there's too many messages queued already,
OnLoop::QueueForProcessing() will block the ZeroMQ thread until
there's room available again.
2025-03-10 17:07:30 +01:00
Arne Welzel
827eccb732 cluster/zeromq: Adapt for OnLoopProcess changes 2025-03-10 17:07:30 +01:00
Arne Welzel
23405194a0 cluster/ThreadedBackend: Switch to OnLoopProcess 2025-03-10 17:07:30 +01:00
Arne Welzel
5dee77e6f2 cluster/OnLoop: Introduce helper template class 2025-03-10 17:07:30 +01:00
Arne Welzel
273a6ec1f3 serializer/broker: Expose to_broker_event() and to_zeek_event()
This is useful for reuse by WebSocket clients that use
the JSON v1 encoding.
2025-03-10 17:06:16 +01:00
Tim Wojtulewicz
e8d91c8227 Merge remote-tracking branch 'origin/topic/timw/ci-macos-upgrade-pip'
* origin/topic/timw/ci-macos-upgrade-pip:
  CI: Unconditionally upgrade pip on macOS
2025-03-10 08:29:04 -07:00
Tim Wojtulewicz
1b260333fd CI: Unconditionally upgrade pip on macOS 2025-03-10 08:09:41 -07:00
Tim Wojtulewicz
8ed503314d Merge remote-tracking branch 'origin/topic/timw/fix-double-to-docs'
* origin/topic/timw/fix-double-to-docs:
  Fix return types in docs for double_to_count and double_to_int
2025-03-10 06:11:56 -07:00
Tim Wojtulewicz
036eb94dff Fix return types in docs for double_to_count and double_to_int 2025-03-10 06:10:21 -07:00
Arne Welzel
679575d6b2 util: Fix terminate_processing() called from non-main thread
The current raise(SIGTERM) sends a signal to the calling thread. If
terminate_processing() is called from a non-main thread and that thread
was created at InitPostScript() time when SIGTERM is blocked, or has
blocked SIGTERM manually, terminate_processing() has no effect.

Switching to kill(getpid(), SIGTERM) guarantees that a thread that doesn't
block the signal (minimally the main thread) will run the handler.
2025-03-09 13:51:00 +01:00
Tim Wojtulewicz
574514b04c Update bifcl submodule [nomail] 2025-03-07 12:14:20 -07:00
Vern Paxson
e1a859c31b -O gen-C++ support for pattern-to-pattern comparison 2025-03-07 10:32:15 -08:00
Evan Typanski
c8f8bbaccb Merge remote-tracking branch 'origin/topic/etyp/print-type-const'
* origin/topic/etyp/print-type-const:
  Fix printing type constants like `double`
2025-03-07 13:14:22 -05:00
Tim Wojtulewicz
62a3119678 Merge remote-tracking branch 'origin/topic/timw/iwyu-clang-tidy'
* origin/topic/timw/iwyu-clang-tidy:
  Fix indentation in .clang-tidy
  Remove existing hand-written clang-tidy setup
  Add ability to enable iwyu and clang-tidy at configure time
2025-03-07 11:02:39 -07:00
Tim Wojtulewicz
bb6b44901b Fix indentation in .clang-tidy 2025-03-07 11:00:44 -07:00
Tim Wojtulewicz
36c1a3ca4a Remove existing hand-written clang-tidy setup 2025-03-07 11:00:44 -07:00
Tim Wojtulewicz
c1dd1e991e Add ability to enable iwyu and clang-tidy at configure time 2025-03-07 11:00:44 -07:00
Vern Paxson
f48f3af79a -O gen-C++ support for pattern vector comparisons 2025-03-07 09:55:15 -08:00
Vern Paxson
9f5fba7003 -O gen-C++ support for type expressions 2025-03-07 09:21:09 -08:00
Evan Typanski
4237239325 Fix printing type constants like double
Fixes #4268
2025-03-07 11:54:04 -05:00
zeek-bot
1d1ca92662 Update doc submodule [nomail] [skip ci] 2025-03-07 00:21:23 +00:00
Tim Wojtulewicz
81f7e77801 Merge remote-tracking branch 'origin/topic/timw/4266-tunnel-ip-proto'
* origin/topic/timw/4266-tunnel-ip-proto:
  Set ip_proto when creating new tunnel encapsulations
2025-03-06 16:42:03 -07:00
Johanna Amann
ae62209e78 Merge remote-tracking branch 'origin/topic/johanna/coc_contributing'
* origin/topic/johanna/coc_contributing:
  Add code of conduct and contributing to repo.
2025-03-06 17:24:32 +00:00
Tim Wojtulewicz
479c4be08b Set ip_proto when creating new tunnel encapsulations 2025-03-06 09:25:03 -07:00
Johanna Amann
6fcd02b3a4 Merge remote-tracking branch 'origin/topic/johanna/gh-4251-discussion'
* origin/topic/johanna/gh-4251-discussion:
  Add two protocol mismatch testcases
  Remove violating t panalyzer from services field again
2025-03-06 13:12:51 +00:00
Johanna Amann
c161b8dffe Add code of conduct and contributing to repo. 2025-03-06 13:11:17 +00:00
zeek-bot
901903f230 Update doc submodule [nomail] [skip ci] 2025-03-06 00:14:42 +00:00
Arne Welzel
86fd9c4e0d Merge remote-tracking branch 'origin/topic/awelzel/4216-no-more-parse-time-dns-resolutions'
* origin/topic/awelzel/4216-no-more-parse-time-dns-resolutions:
  ZAM: bif-tracking updates for blocking_lookup_hostname()
  scan.l: Deprecate DNS resolutions of hostname literals
  input/zeek-setup: Track parse_only globally
  zeek.bif: Introduce blocking_lookup_hostname()
  btest/dns_mgr: Update run-dnsmasq, use --host-record
2025-03-05 19:24:28 +01:00
Arne Welzel
3b7bbb2651 ZAM: bif-tracking updates for blocking_lookup_hostname() 2025-03-05 19:23:08 +01:00
Arne Welzel
715c309b03 scan.l: Deprecate DNS resolutions of hostname literals
This also skips DNS lookups when running with zeek --parse-only.

Closes #4216 #4219
2025-03-05 19:23:08 +01:00
Arne Welzel
e14f54b474 input/zeek-setup: Track parse_only globally
For easier access in scan.l
2025-03-05 19:23:08 +01:00
Arne Welzel
376913b509 zeek.bif: Introduce blocking_lookup_hostname()
As a replacement for host literal DNS resolutions.
2025-03-05 19:22:57 +01:00
Arne Welzel
7eec3859fa btest/dns_mgr: Update run-dnsmasq, use --host-record
Using dnsmasq --address covers an entire domain, so dns.example.com
AAAA queries would also return IPv6 addresses for example.com

Instead, this was always meant to use host entries.
2025-03-05 12:39:15 +01:00
zeek-bot
3595f50f16 Update doc submodule [nomail] [skip ci] 2025-03-05 00:17:11 +00:00
Christian Kreibich
c2a7da0044 Update zeekctl submodule to pull in testsuite fix for metrics port 2025-03-04 12:53:17 -08:00
Tim Wojtulewicz
8f0236448b Merge remote-tracking branch 'origin/topic/timw/reformat-cpp-code-in-bison-and-flex-files'
* origin/topic/timw/reformat-cpp-code-in-bison-and-flex-files:
  Reformat embedded C++ code in bison/flex files
2025-03-04 09:34:06 -07:00
Tim Wojtulewicz
61cd5779f2 Reformat embedded C++ code in bison/flex files 2025-03-04 09:33:30 -07:00
Tim Wojtulewicz
a2a30f2a2b Merge remote-tracking branch 'origin/topic/timw/iptunnel-coverity-findings'
* origin/topic/timw/iptunnel-coverity-findings:
  Fix Coverity findings from recent IPTunnel dumping changes
2025-03-04 08:53:04 -07:00
Johanna Amann
2daf692c95 Add two protocol mismatch testcases
These traces contain different protocols being used by originator/responder.

Traces from GH-4251
2025-03-04 15:38:20 +00:00
Johanna Amann
b8c135d7cb Remove violating analyzer from services field again
This reverts some of the recent DPD changes; specifically violations
trigger removal from the services field, again, by default.

Discussion in GH-4521
2025-03-04 15:10:49 +00:00
Johanna Amann
dfa011a3ee Merge remote-tracking branch 'origin/topic/johanna/gh-4237'
* origin/topic/johanna/gh-4237:
  RDP: cookie is optional
2025-03-04 13:41:18 +00:00
Johanna Amann
72ea7fc06c RDP: cookie is optional
Fixes GH-4237
2025-03-04 13:38:01 +00:00
Arne Welzel
5cb25fd2e8 testing/external: Fix commit-hash.zeek-testing-private
update-changes mishap :-(
2025-03-04 14:36:02 +01:00
Arne Welzel
548a12813a Merge branch 'master' of https://github.com/markoverholser/zeek
* 'master' of https://github.com/markoverholser/zeek:
  Update zeek.bif documentation for to_count and to_int
2025-03-04 12:07:22 +01:00
Arne Welzel
3bec357ace Merge remote-tracking branch 'origin/topic/timw/bifs-tocount-zam-baseline'
* origin/topic/timw/bifs-tocount-zam-baseline:
  CI: Add release-build ZAM task for baseline checks during PRs
  Fix language/assert btest baselines for to_count/to_int changes
  Update the bifs.to_count baseline for ZAM
2025-03-04 12:06:24 +01:00
Arne Welzel
a3a08fa0f3 Merge remote-tracking branch 'origin/topic/awelzel/2311-load-plugin-bare-mode'
* origin/topic/awelzel/2311-load-plugin-bare-mode:
  scan.l: Fix @load-plugin scripts loading
  scan.l: Extract switch_to() from load_files()
  ScannedFile: Allow skipping canonicalization
2025-03-04 09:43:53 +01:00
Arne Welzel
ab99f8e233 scan.l: Fix @load-plugin scripts loading
For a plugin loaded via @load-plugin, create a YY_BUFFER_STATE holding
the required loads for the implicitly loaded files. In loaded scripts,
this generated file will show up with a path of the shared object file
of the plugin with the __preload__.zeek and __load__.zeek files loaded
by it.

Closes #2311
2025-03-04 09:35:00 +01:00
Robin Sommer
b77faa765a
Spicy: Fix passing vectors to Zeek.
We missed the allocator argument for the C++-side conversion
template, which let vector's of certain types not compile.

Closes #4250.
2025-03-04 09:24:03 +01:00
Benjamin Bannier
60bd08ca1a Merge remote-tracking branch 'origin/topic/bbannier/bump-pre-commit-hooks' [skip CI] 2025-03-04 09:13:11 +01:00
Benjamin Bannier
5d44073b94 Bump pre-commit hooks 2025-03-04 08:14:26 +01:00
Tim Wojtulewicz
19d22ad53b Fix Coverity findings from recent IPTunnel dumping changes 2025-03-03 19:14:29 -07:00
Tim Wojtulewicz
a86a9e2cc0 CI: Add release-build ZAM task for baseline checks during PRs 2025-03-03 15:51:29 -07:00
Tim Wojtulewicz
daaf3142bf Merge remote-tracking branch 'origin/topic/bbannier/cmake-format-zeek-add-analyzer'
* origin/topic/bbannier/cmake-format-zeek-add-analyzer:
  Always break lines when formatting `spicy_add_analyzer`
  Fix formatting of `zeek_add_plugin`
2025-03-03 10:47:14 -07:00
Benjamin Bannier
e768cee88c Always break lines when formatting spicy_add_analyzer 2025-03-03 11:24:20 +01:00
Benjamin Bannier
7c456538b4 Fix formatting of zeek_add_plugin 2025-03-03 11:23:09 +01:00
Tim Wojtulewicz
6de81160b6 Fix language/assert btest baselines for to_count/to_int changes 2025-02-28 20:21:57 -07:00
Tim Wojtulewicz
eb015801bd Update the bifs.to_count baseline for ZAM 2025-02-28 20:21:57 -07:00
zeek-bot
d3d7c54686 Update doc submodule [nomail] [skip ci] 2025-03-01 00:13:44 +00:00
Arne Welzel
d079a2b9a8 scan.l: Extract switch_to() from load_files() 2025-02-28 17:56:17 +01:00
Arne Welzel
2a8040039a ScannedFile: Allow skipping canonicalization 2025-02-28 17:55:36 +01:00
zeek-bot
31b5f763cf Update doc submodule [nomail] [skip ci] 2025-02-27 00:13:27 +00:00
zeek-bot
2e4da3223a Update doc submodule [nomail] [skip ci] 2025-02-26 00:13:08 +00:00
Mark Overholser
3acbb55513 Update zeek.bif documentation for to_count and to_int 2025-02-25 15:18:12 -06:00
Tim Wojtulewicz
3c16b0720a Merge remote-tracking branch 'origin/topic/timw/few-btest-jobs-for-zam-ci-tasks'
* origin/topic/timw/few-btest-jobs-for-zam-ci-tasks:
  CI: Use the right variable for the number of test jobs for zeekctl_debian11_task tasks
  CI: Use fewer btest jobs for ZAM tasks
2025-02-25 07:30:00 -07:00
zeek-bot
6f2e91aec3 Update doc submodule [nomail] [skip ci] 2025-02-25 00:13:44 +00:00
Tim Wojtulewicz
66e3232dcc Merge remote-tracking branch 'markoverholser/master'
* markoverholser/master:
  Fix incorrect syntax for static_cast in to_count that I introduced in a previous merge
  Update baselines after changes to to_count and to_int
  fix to_count in zeek.bif to resolve conflict from bbanier's adjustment to static casting of the return from strtoull
  Fix tests in to_count to reflect appropriate function; add tests for 0x-formatted hex values for to_count and to_int
  update BIFs to_int() and to_count() to accept optional 'base' argument; allows more more exotic conversions from hex, octal, binary
  Fixes #4076; update BIFs to_int() and to_count() to accept optional 'base' argument for more easy conversions of strings representing (for example) hexadecimal, octal, or binary numbers
2025-02-24 11:38:11 -07:00
Tim Wojtulewicz
3dd1d37f9d CI: Use the right variable for the number of test jobs for zeekctl_debian11_task tasks 2025-02-24 11:18:13 -07:00
Tim Wojtulewicz
b5b0c5c996 CI: Use fewer btest jobs for ZAM tasks
The ZAM tasks are being killed due to OOM issues on Cirrus while
running btests. Use fewer jobs try to avoid that.
2025-02-24 11:17:10 -07:00
Mark Overholser
165e753439 Fix incorrect syntax for static_cast in to_count that I introduced in a previous merge 2025-02-24 11:02:13 -06:00
Arne Welzel
58babca824 geneve/functions.bif: Fix :zeek:see directive, take two 2025-02-24 15:06:58 +01:00
Arne Welzel
8da219c61a geneve/functions.bif: Fix :zeek:see directive 2025-02-24 15:05:06 +01:00
Mark Overholser
362f083351 Update baselines after changes to to_count and to_int 2025-02-23 16:34:20 -06:00
Mark Overholser
eeaeaaeb16 fix to_count in zeek.bif to resolve conflict from bbanier's adjustment to static casting of the return from strtoull 2025-02-23 16:23:31 -06:00
Mark Overholser
8fce9c34f8 Fix tests in to_count to reflect appropriate function; add tests for 0x-formatted hex values for to_count and to_int 2025-02-23 16:19:12 -06:00
zeek-bot
6671e95c6b Update doc submodule [nomail] [skip ci] 2025-02-23 00:16:34 +00:00
Arne Welzel
3682a42376 Merge remote-tracking branch 'origin/topic/awelzel/get-geneve-options'
* origin/topic/awelzel/get-geneve-options:
  PacketAnalyzer::Geneve: Add get_options()
  packet_analysis: Track data spans of packet analyzers
2025-02-22 12:33:46 -08:00
Arne Welzel
776c003033 PacketAnalyzer::Geneve: Add get_options()
Allow to extract Geneve options on-demand, for example during a
new_connection() event.
2025-02-22 12:19:42 -08:00
Arne Welzel
2dc98acd1f packet_analysis: Track data spans of packet analyzers
Do not just track the analyzer instance in the stack, but also the
data span it is given. This allows to extract more information on-demand
during event processing.

TrackAnalyzer() is technically a public API, but no one should use it
outside of the Analyzer's Forward methods itself.
2025-02-22 12:19:42 -08:00
Benjamin Bannier
0bc0104eb2 Merge remote-tracking branch 'origin/topic/timw/to-int-zam' 2025-02-21 12:24:43 +01:00
Tim Wojtulewicz
caeae0b777 Fix bifs.to_count and bifs.to_int btests under ZAM 2025-02-20 17:24:50 -07:00
Tim Wojtulewicz
bcecc6ea51 Merge remote-tracking branch 'mnhsrj/innerPktResults'
* mnhsrj/innerPktResults:
  Set original/outer packet flags to reflect inner packet results
2025-02-20 16:41:05 -07:00
Tim Wojtulewicz
07a03bbfe9 Merge remote-tracking branch 'origin/topic/bbannier/integer-conversion-error-handling'
* origin/topic/bbannier/integer-conversion-error-handling:
  Also trim trailing spaces in `to_count`/`to_int` inputs
  Align error handling in `to_int` with existing behavior of `to_count`
  Baseline handling of leading/trailing spaces in `to_count`/`to_int`.
  Add error messages to `to_count`/`to_int` baselines
2025-02-20 15:35:34 -07:00
Tim Wojtulewicz
27bfd5b4a8 Merge remote-tracking branch 'origin/topic/timw/update-broker'
* origin/topic/timw/update-broker:
  Update broker submodule [nomail]
2025-02-18 09:46:43 -07:00
Tim Wojtulewicz
6609269f3c Merge remote-tracking branch 'origin/topic/awelzel/freebsd-14-1-to-14-2'
* origin/topic/awelzel/freebsd-14-1-to-14-2:
  cirrus: Bump FreeBSD 14 task to 14.2
2025-02-18 08:51:40 -07:00
Benjamin Bannier
d421a19691 Also trim trailing spaces in to_count/to_int inputs
Previously we would already trim leading spaces in inputs to `to_count`
and `to_int`, effectively by just passing the behavior of the low-level
functions used in their implementations to the user. While this was
useful it was also inconsistent in that we did not allow trailing
spaces which we enable with this patch.
2025-02-18 14:15:32 +01:00
Benjamin Bannier
55533e12d4 Align error handling in to_int with existing behavior of to_count
Previously `to_int` would silently ignore invalid inputs and simply
return `0` while `to_count` would return an error; this patch changes
`to_int` to behave like `to_count`.

This introduces a breaking change in that `to_int` now raises an error
for trailing spaces (but still accepts leading spaces) where it
previously would have silently accepted it. This is consistent with
the behavior of `to_count`, but one could also argue that both of
these should only accept properly trimmed input; I did not go that route
since that would introduce breaking changes for both these functions
instead of for just one of them.
2025-02-18 14:03:09 +01:00
Benjamin Bannier
742f17fb15 Baseline handling of leading/trailing spaces in to_count/to_int.
Currently `to_count` reports an error for trailing spaces (but not for
leading ones) while `to_int` silently accepts them. This patch adds
baselines capture the current behavior.
2025-02-18 14:01:53 +01:00
Benjamin Bannier
4c4cd5984c Add error messages to to_count/to_int baselines
This captures error messages produced by `to_count`, but will also
baseline future error messages from `to_int` once we introduce them.
2025-02-18 14:01:32 +01:00
markoverholser
7b0e259655
Merge branch 'zeek:master' into master 2025-02-18 06:51:25 -06:00
Mark Overholser
df348ff2f2 update BIFs to_int() and to_count() to accept optional 'base' argument; allows more more exotic conversions from hex, octal, binary 2025-02-18 06:49:55 -06:00
Tim Wojtulewicz
e9330b563a Update broker submodule [nomail] 2025-02-17 13:49:20 -07:00
Johanna Amann
d3a6b93fdb Merge branch 'patch-2' of github.com:BrendanKapp/zeek 2025-02-17 17:10:04 +00:00
Brendan Kapp
76f4cd8b82
Fix dead links in README 2025-02-17 08:32:04 -07:00
Dominik Charousset
20b3eca257 Integrate review feedback 2025-02-15 16:37:24 +01:00
Mark Overholser
0b81bf5ad3 Fixes #4076; update BIFs to_int() and to_count() to accept optional 'base' argument for more easy conversions of strings representing (for example) hexadecimal, octal, or binary numbers 2025-02-15 07:53:38 -06:00
Arne Welzel
ea56976e3c cirrus: Bump FreeBSD 14 task to 14.2
CI is currently failing with:

    { "error": { "code": 404, "message": "The resource 'projects/freebsd-org-cloud-dev/global/images/family/freebsd-14-1' was not found" ...
2025-02-14 18:31:47 -08:00
Tim Wojtulewicz
9c41b6d227 Merge remote-tracking branch 'origin/topic/etyp/locals-to-global'
* origin/topic/etyp/locals-to-global:
  Do not export locals
2025-02-14 11:29:29 -08:00
Evan Typanski
7160e074f6 Do not export locals
Fixes #4227
2025-02-12 13:49:12 -08:00
mnhsrj
0257b6cd32
Set original/outer packet flags to reflect inner packet results
Propagate inner packet flags such as 'processed', 'dump_packet', 'dump_size'
to outer packet for packets involving tunneled data.
2025-02-12 09:43:44 -05:00
Dominik Charousset
30615f425e Hook into Broker logs via its new API
The new Broker API allows us to provide a custom logger to Broker that
pulls previously unattainable context information out of Broker to put
them into broker.log for users of Zeek.

Since Broker log events happen asynchronously, we cache them in a queue
and use a flare to notify Zeek of activity. Furthermore, the Broker
manager now implements the `ProcessFd` function to avoid unnecessary
polling of the new log queue. As a side effect, data stores are polled
less as well.
2025-02-08 16:28:02 +01:00
zeek-bot
b7b31ebce5 Update doc submodule [nomail] [skip ci] 2025-02-08 00:13:09 +00:00
Johanna Amann
363d3a8ac9 Merge remote-tracking branch 'origin/topic/johanna/dpd-zam-baseline-changes'
* origin/topic/johanna/dpd-zam-baseline-changes:
  DPD changes - ZAM baseline updates
2025-02-07 18:09:11 +00:00
Johanna Amann
eda2c30452 DPD changes - ZAM baseline updates
See GH-4200 for related PR
2025-02-07 09:04:02 +00:00
Johanna Amann
fc233fd8d0 Merge remote-tracking branch 'origin/topic/johanna/dpd-changes'
* origin/topic/johanna/dpd-changes:
  DPD: failed services logging alignment
  DPD: update test baselines; change options for external tests.
  DPD: change policy script for service violation logging; add NEWS
  DPD changes - small script fixes and renames.
  Update public and private test suite for DPD changes.
  Allow to track service violations in conn.log.
  Make conn.log service field ordered
  DPD: change handling of pre-confirmation violations, remove max_violations
  DPD: log analyzers that have confirmed
  IRC analyzer - make protocol confirmation more robust.
2025-02-07 07:35:30 +00:00
Johanna Amann
66d07c31fa DPD: failed services logging alignment
There were some special cases in which the failed-service-logging policy
script might log a service being removed that was not removed due to an
analyzer violation. This change should fix these cases.
2025-02-06 18:56:30 +00:00
Johanna Amann
0e9cf7b019 DPD: update test baselines; change options for external tests.
As services are sorted by default now, this disables the canonifier that
sorts the service field for the external baseline.

This also adds the tracking of disabled services in the service field
via DPD::track_removed_services_in_connection - to make such changes
more visible, and check that the feature works as desired.
2025-02-06 18:56:30 +00:00
Johanna Amann
0fa1ecce8f DPD: change policy script for service violation logging; add NEWS
This commit renames the `service_violation` column that can be added via
a policy script to `failed_service`. This expresses the intent of it
better - the column contains services that failed and were removed after
confirmation.

Furthermore, the script is fixed so it actually does this - before it
would sometimes add services to the list that were not actually removed.
In the course of this, the type of the column was changed from a vector
to an ordered set.

Due to the column rename, the policy script itself is also renamed.

Also adds a NEWS entry for the DPD changes.
2025-02-06 18:56:30 +00:00
Johanna Amann
ecb1a65610 Merge remote-tracking branch 'origin/topic/christian/ci-updates'
* origin/topic/christian/ci-updates:
  CI: bump FreeBSD 14 to 14.2, which came out in Dec'24
  CI: remove OpenSuSE Leap 15.5, EOL.
2025-02-06 17:02:15 +00:00
Johanna Amann
c402c28f7e Merge remote-tracking branch 'origin/topic/johanna/sslindentation'
* origin/topic/johanna/sslindentation:
  SSL main.zeek - fix indentation
2025-02-06 17:00:40 +00:00
Johanna Amann
3caa49023f SSL main.zeek - fix indentation
No functional changes
2025-02-06 16:15:58 +00:00
Arne Welzel
02494d2146 Merge remote-tracking branch 'origin/topic/christian/gh-3595-warnings'
* origin/topic/christian/gh-3595-warnings:
  Downgrade internal errors to reporter warnings in file/directory BiFs
2025-02-06 10:05:22 +01:00
Christian Kreibich
b77ef57dff CI: bump FreeBSD 14 to 14.2, which came out in Dec'24 2025-02-05 22:55:10 -08:00
Christian Kreibich
cff4d3a3a1 CI: remove OpenSuSE Leap 15.5, EOL. 2025-02-05 22:55:05 -08:00
Christian Kreibich
1f3d13a371 Downgrade internal errors to reporter warnings in file/directory BiFs
This allows Zeek execution to continue gracefully in the presence of such
errors, particularly at zeek_init() time. Includes a tweak to expand the
bifs.directory_operations test to check continuation after errors.

Resolves #3595.
2025-02-05 17:49:37 -08:00
zeek-bot
478a4a8ba2 Update doc submodule [nomail] [skip ci] 2025-02-06 00:23:22 +00:00
Tim Wojtulewicz
4ee7bde05e Add NEWS entry for recent kerberos change [nomail] [skip ci] 2025-02-05 10:09:18 -07:00
Arne Welzel
fbdefd1451 Merge remote-tracking branch 'origin/topic/awelzel/zeromq-fix-fmt-call-thanks-tsan'
* origin/topic/awelzel/zeromq-fix-fmt-call-thanks-tsan:
  cluster/zeromq: Call DoTerminate() in destructor
  cluster/zeromq: Use lambda for thread trampoline
  cluster/zeromq: Do not call util::fmt() from thread
2025-02-05 16:40:55 +01:00
Arne Welzel
6008e67008 cluster/zeromq: Call DoTerminate() in destructor
Normal life-cycle is that Terminate() / DoTerminate() is called
by zeek-setup code. If that doesn't happen, shutdown and join
threads during destructor.

try { } catch (...) suggested by Benjamin.
2025-02-05 16:39:44 +01:00
Arne Welzel
2c6d934ef4 cluster/zeromq: Use lambda for thread trampoline 2025-02-05 16:38:24 +01:00
Arne Welzel
16c745cee4 cluster/zeromq: Do not call util::fmt() from thread
...util::fmt() uses a static buffer, so this is problematic.

I've dabbled a bit replacing std::thread with using threading::BasicThread
which would offer Fmt(), but this makes things more complicated. Primarily
as BasicThread is registered with the thread manager and the shutdown
interactions become entangled. The thread might be terminated before the
backend, or vice-versa. Seems nicer for the thread to be owned by the backend.
2025-02-05 16:38:24 +01:00
Johanna Amann
e3493bc110 DPD changes - small script fixes and renames.
This addresses review feedback of GH-4200. No functional changes.
2025-02-05 13:55:43 +00:00
Arne Welzel
da673d6577 Merge remote-tracking branch 'origin/topic/awelzel/4136-cluster-backend-pre-work'
* origin/topic/awelzel/4136-cluster-backend-pre-work:
  cluster/zeromq: Fix Unsubscribe() bug caused by \x00 prefix
  cluster: Add SubscribeCallback support
  cluster/zeromq: Fix XSUB threading issues
  cluster/zeromq: Use NodeId(), drop my_node_id
  cluster/Backend: Pass node_id via Init()
  cluster/Backend: Make backend event processing customizable
  cluster/broker/Serializer: Fix adaptor to adapter
  cluster/Backend: Do not use const std::string_view&
  cluster/serializer/broker: Fix handler lookup
  broker/Manager: Move name in PublishEvent()
  btest/zeromq/test-bootstrap: Fix port parsing
  EventHandler: Support operator!=
2025-02-05 11:10:36 +01:00
Arne Welzel
9c5c0f40e1 cluster/zeromq: Fix Unsubscribe() bug caused by \x00 prefix 2025-02-05 10:39:56 +01:00
Arne Welzel
e8f87019c6 cluster: Add SubscribeCallback support
This allows callers of Subscribe() to pass in a callback that will be invoked
once the subscription is established or failed to establish. It is the
backend's responsibility to execute the callback on the main thread either
synchronously, or preferably asynchronously at a later point, by
scheduling a task on the IO main loop.

This turns on ZMQ_XPUB_VERBOSE for ZeroMQ so that notifications about
subscriptions are raised even if the subscriptions has previously been
observed.
2025-02-05 10:39:56 +01:00
Arne Welzel
fa22f91ca4 cluster/zeromq: Fix XSUB threading issues
It is not safe to use the same socket from different threads, but the
current code used the xsub socket directly from the main thread (to setup
subscriptions) and from the internal thread for polling and reading.

Leverage the PAIR socket already in use for forwarding publish operations
to the internal thread also for subscribe and unsubscribe.

The failure mode is/was a bit annoying. Essentially, closing of the
context would hang indefinitely in zmq_ctx_term().
2025-02-05 10:39:56 +01:00
Arne Welzel
df78a94c76 cluster/zeromq: Use NodeId(), drop my_node_id 2025-02-05 10:39:56 +01:00
Arne Welzel
769044e8e1 cluster/Backend: Pass node_id via Init() 2025-02-05 10:39:56 +01:00
Arne Welzel
0b7a660a34 cluster/Backend: Make backend event processing customizable
This allows configurability at the code level to decide what to do with
a received remote events and events produced by a backend. For now, only
enqueue events into the process's script layer, but for the WebSocket
interface, the action would be to send out the event on a WebSocket
connection instead.
2025-02-05 10:39:56 +01:00
Arne Welzel
337b62960b cluster/broker/Serializer: Fix adaptor to adapter 2025-02-05 10:39:56 +01:00
Arne Welzel
9b2fff9640 cluster/Backend: Do not use const std::string_view& 2025-02-05 10:39:56 +01:00
Arne Welzel
6d1259423e cluster/serializer/broker: Fix handler lookup
Handler overwrites operator bool, so need to explicitly test for nullptr
rather than not having any handlers defined.
2025-02-05 10:39:56 +01:00
Arne Welzel
24ee115bbc broker/Manager: Move name in PublishEvent() 2025-02-05 10:39:56 +01:00
Arne Welzel
ebdbbb5063 btest/zeromq/test-bootstrap: Fix port parsing
to_port() will produce an error on empty strings which extract_count()
does not.
2025-02-05 10:39:56 +01:00
Arne Welzel
e395332e7b EventHandler: Support operator!= 2025-02-05 10:39:56 +01:00
Johanna Amann
6324445d62 Merge remote-tracking branch 'origin/master' into topic/johanna/dpd-changes
This also includes some test baseline updates, due to recent QUIC
changes.

* origin/master: (39 commits)
  Update doc submodule [nomail] [skip ci]
  Bump cluster testsuite to pull in resilience to agent connection timing [skip ci]
  IPv6 support for detect-external-names and testcase
  Add  `skip_resp_host_port_pairs` option.
  util/init_random_seed: write_file implies deterministic
  external/subdir-btest.cfg: Set OPENSSL_ENABLE_SHA1_SIGNATURES=1
  btest/x509_verify: Drop OpenSSL 1.0 hack
  testing/btest: Use OPENSSL_ENABLE_SHA1_SIGNATURES
  Add ZAM baseline for new scripts.base.protocols.quic.analyzer-confirmations btest
  QUIC/decrypt_crypto: Rename all_data to data
  QUIC: Confirm before forwarding data to SSL
  QUIC: Parse all QUIC packets in a UDP datagram
  QUIC: Only slurp till packet end, not till &eod
  Remove unused SupervisedNode::InitCluster declaration
  Update doc submodule [nomail] [skip ci]
  Bump cluster testsuite to pull in updated Prometheus tests
  Make enc_part value from kerberos response available to scripts
  Management framework: move up addition of agent IPs into deployable cluster configs
  Support multiple instances per host addr in auto metrics generation
  When auto-generating metrics ports for worker nodes, get them more uniform across instances.
  ...
2025-02-05 09:31:16 +00:00
Johanna Amann
5ef6902331 Merge remote-tracking branch 'origin/topic/johanna/jbaggs-ignore-mdns'
* origin/topic/johanna/jbaggs-ignore-mdns:
  IPv6 support for detect-external-names and testcase
  Add  `skip_resp_host_port_pairs` option.
2025-02-05 09:09:01 +00:00
zeek-bot
1b4e057442 Update doc submodule [nomail] [skip ci] 2025-02-05 00:13:21 +00:00
Christian Kreibich
aa5adba013 Merge branch 'topic/christian/fix-cluster-testsuite-races'
* topic/christian/fix-cluster-testsuite-races:
  Bump cluster testsuite to pull in resilience to agent connection timing [skip ci]
2025-02-04 14:50:59 -08:00
Christian Kreibich
5d078bf84b Bump cluster testsuite to pull in resilience to agent connection timing [skip ci] 2025-02-04 14:49:45 -08:00
Johanna Amann
7a1a2c8d63 IPv6 support for detect-external-names and testcase
This commit builds on top of GH-4183 and adds IPv6 support for
policy/protocols/dns/detect-external-names.

Additionally it adds a test-case for this file testing it with mDNS
queries.
2025-02-04 17:34:43 +00:00
Arne Welzel
8d9f258f78 Merge remote-tracking branch 'origin/topic/awelzel/4209-save-seeds-load-seeds'
* origin/topic/awelzel/4209-save-seeds-load-seeds:
  util/init_random_seed: write_file implies deterministic
2025-02-04 16:50:57 +01:00
jbaggs
83926f60ce Add skip_resp_host_port_pairs option. 2025-02-04 11:22:15 +00:00
Johanna Amann
a7cf057a63 util/init_random_seed: write_file implies deterministic
This makes Zeek run in deterministic mode with --save-seeds usage
and reworks all the extra indirections used in init_random_seed()
to make it easier to follow the control flow.

Fixes #4209
2025-02-04 11:57:51 +01:00
Arne Welzel
280e7acc6e Merge remote-tracking branch 'origin/topic/awelzel/4035-btest-openssl-sha1-certs'
* origin/topic/awelzel/4035-btest-openssl-sha1-certs:
  external/subdir-btest.cfg: Set OPENSSL_ENABLE_SHA1_SIGNATURES=1
  btest/x509_verify: Drop OpenSSL 1.0 hack
  testing/btest: Use OPENSSL_ENABLE_SHA1_SIGNATURES
2025-02-04 09:52:55 +01:00
Arne Welzel
8b645243cb external/subdir-btest.cfg: Set OPENSSL_ENABLE_SHA1_SIGNATURES=1
We already do something similar for OPENSSL_ENABLE_MD5_VERIFY=1
2025-02-04 09:44:06 +01:00
Arne Welzel
ad370c0c37 btest/x509_verify: Drop OpenSSL 1.0 hack
We do not have a distro in CI anymore that ships OpenSSL 1.0,
drop the hack.
2025-02-04 09:44:03 +01:00
Arne Welzel
bb2e20d353 testing/btest: Use OPENSSL_ENABLE_SHA1_SIGNATURES
This reverts the call to update-crypto-policies in the Fedora 41 image
and instead sets OPENSSL_ENABLE_SHA1_SIGNATURES in the individual tests.
This allows RHEL 10 or Fedora 41 users to run the tests in question
without needing to fiddle with system settings.

Fixes #4035
2025-02-04 09:43:26 +01:00
Arne Welzel
0290a73544 Merge remote-tracking branch 'origin/topic/timw/add-missing-quic-zam-baseline'
* origin/topic/timw/add-missing-quic-zam-baseline:
  Add ZAM baseline for new scripts.base.protocols.quic.analyzer-confirmations btest
2025-02-04 09:18:42 +01:00
Tim Wojtulewicz
c8eab363fb Merge remote-tracking branch 'philipp-tg/asrep_enc_part'
* philipp-tg/asrep_enc_part:
  Make enc_part value from kerberos response available to scripts
2025-02-03 18:41:53 -07:00
Tim Wojtulewicz
f0d7984bac Merge remote-tracking branch 'origin/topic/timw/add-note-about-pe-pcap'
* origin/topic/timw/add-note-about-pe-pcap:
  Add note to Traces/README about possible malware in pe/pe.trace
  Fix formatting of Traces/README entry for modbus-eit.trace
2025-02-03 18:34:15 -07:00
Christian Kreibich
073aad9241 Merge branch 'topic/christian/remove-supervisednode-initcluster-decl'
* topic/christian/remove-supervisednode-initcluster-decl:
  Remove unused SupervisedNode::InitCluster declaration
2025-02-03 16:53:23 -08:00
Tim Wojtulewicz
0f4461fdbf Add ZAM baseline for new scripts.base.protocols.quic.analyzer-confirmations btest 2025-02-03 13:40:15 -07:00
Arne Welzel
44304973fb Merge remote-tracking branch 'origin/topic/awelzel/4198-4201-quic-maintenance'
* origin/topic/awelzel/4198-4201-quic-maintenance:
  QUIC/decrypt_crypto: Rename all_data to data
  QUIC: Confirm before forwarding data to SSL
  QUIC: Parse all QUIC packets in a UDP datagram
  QUIC: Only slurp till packet end, not till &eod
2025-02-03 17:52:20 +01:00
Arne Welzel
93bc4e4669 QUIC/decrypt_crypto: Rename all_data to data
...for consistency.
2025-02-03 17:36:41 +01:00
Arne Welzel
5d9d3921a6 QUIC: Confirm before forwarding data to SSL
Fixes #4201
2025-02-03 17:36:41 +01:00
Arne Welzel
6a14e64a17 QUIC: Parse all QUIC packets in a UDP datagram
A UDP datagram may contain multiple QUIC packets, but the parser so far
handled only the very first packet, ignoring any subsequent packets.

Fixes #4198
2025-02-03 17:36:37 +01:00
Arne Welzel
744917aa69 QUIC: Only slurp till packet end, not till &eod
This doesn't change behavior, but avoids slurping in more data than
needed. A UDP packet an contain multiple QUIC packets and we'd read
all following ones instead just the one we're interested in.
2025-02-03 17:26:57 +01:00
Christian Kreibich
4324bab58b Remove unused SupervisedNode::InitCluster declaration
The move of the cluster table initialization to the script layer removed
the implementation, but overlooked this declaration. See:
737b1a2013
2025-01-31 20:33:07 -08:00
zeek-bot
65a79b1dec Update doc submodule [nomail] [skip ci] 2025-02-01 00:14:20 +00:00
Christian Kreibich
8ef333ff32 Merge branch 'topic/christian/management-multinode-metrics-ports'
* topic/christian/management-multinode-metrics-ports:
  Bump cluster testsuite to pull in updated Prometheus tests
  Management framework: move up addition of agent IPs into deployable cluster configs
  Support multiple instances per host addr in auto metrics generation
  When auto-generating metrics ports for worker nodes, get them more uniform across instances.
2025-01-31 15:59:22 -08:00
Christian Kreibich
93eb99ca2e Bump cluster testsuite to pull in updated Prometheus tests 2025-01-31 15:58:04 -08:00
Philipp Tekeser-Glasz
135e2f9c67 Make enc_part value from kerberos response available to scripts 2025-01-31 12:58:14 +00:00
Christian Kreibich
ea88257d4d Management framework: move up addition of agent IPs into deployable cluster configs
Since the changes to port autoassignment in the preceding commits leverage agent
IP address information, we need to ensure that this information is available at
the time of autoassignment. The controller learns IP addresses from connecting
agents, and previously used that information at deploy time. This moves the
augmentation of the cluster config up to port autoassignment time.
2025-01-30 16:43:12 -08:00
Michael Dopheide
0c0769b1b2 Support multiple instances per host addr in auto metrics generation 2025-01-30 16:41:27 -08:00
Michael Dopheide
b120f39bd7 When auto-generating metrics ports for worker nodes, get them more uniform across instances. 2025-01-30 16:41:27 -08:00
Tim Wojtulewicz
a5b0a9467d Add note to Traces/README about possible malware in pe/pe.trace 2025-01-30 13:28:35 -07:00
Tim Wojtulewicz
430e3ab940 Fix formatting of Traces/README entry for modbus-eit.trace 2025-01-30 13:28:17 -07:00
Tim Wojtulewicz
7172b682f2 Merge remote-tracking branch 'origin/topic/timw/packing'
* origin/topic/timw/packing:
  Pack some classes for better memory usages
2025-01-30 10:51:23 -07:00
Tim Wojtulewicz
572adf3f23 Pack some classes for better memory usages
- Analyzer: Reduce from 208 bytes to 192 bytes, remove one cache line
- EventGroup: Reduce from 104 bytes to 96 bytes
- Packet: Reduce from 200 bytes to 184 bytes, remove one cache line
- threading::Value: Reduce from 48 bytes to 40 bytes
- ConnTuple: push hole to the end of struct
- TCP_Reassembler: Reduce from 240 bytes to 232 bytes
2025-01-30 10:50:29 -07:00
Johanna Amann
20ace6209f Update public and private test suite for DPD changes.
The changes are mostly quite minor. The main change reasons are:

* analyzers that were confirmed, and later removed now show up in the
  conn.log.
* a couple of removed lines in analyzer.log, because non-confirmed
  analyzers get removed more quickly.
* in some cases there are additional lines in analyzer.log. These are
  cases in which an analyzer gets removed due to a violation and then
  re-attached because of a later signature match, which replays the
  violating content. In all examples that I have so far, this is caused
  by both sides of a connection speaking a differing protocol. There
  probably should be a better way to handle this - but it works.
* new column for failed analyzers in conn.log
2025-01-30 16:59:44 +00:00
Johanna Amann
2f712c3c24 Allow to track service violations in conn.log.
This introduces ian options, DPD::track_removed_services_in_connection.
It adds failed services to the services column, prefixed with a
"-".

Alternatively, this commit also adds
policy/protocols/conn/failed-services.zeek, which provides the same
information in a new column in conn.log.
2025-01-30 16:59:44 +00:00
Johanna Amann
ac7bbe6949 Make conn.log service field ordered
This changes service set in the connection record, and thus also the
conn.log service field to being ordered. Speficically, the order of the
entries in the service field will be the same order in which protocols
will be confirmed. This means that it now is possible to see which
protocols were layered over each other in which order by looking at the
respective conn.log entry.
2025-01-30 16:59:44 +00:00
Johanna Amann
c72c1cba6f DPD: change handling of pre-confirmation violations, remove max_violations
This commit revamps the handling of analyzer violations that happen
before an analyzer confirms the protocol.

The current state is that an analyzer is disabled after 5 violations, if
it has not been confirmed. If it has been confirmed, it is disabled
after a single violation.

The reason for this is a historic mistake. In Zeek up to versions 1.5,
analyzers were unconditianally removed when they raised the first
protocol violation.

When this script was ported to the new layout for Zeek 2.0 in
b4b990cfb5, a logic error was introduced
that caused analyzers to no longer be disabled if they were not
confirmed.

This was the state for ~8 years, till the DPD::max_violations options
was added, which instates the current approach of disabling unconfirmed
analyzers after 5 violations. Sadly, there is not much discussion about
this change - from my hazy memory, I think this was discovered during
performance tests and the new behavior was added without checking into
the history of previous changes.

This commit reinstates the originally intended behavior of DPD. When an
analyzer that has not been confirmed raises a protocol violation, it is
immediately removed from the connection. This also makes a lot of sense
- this allows the analyzer to be in a "tasting" phase at the beginning
of the connection, and to error out quickly once it realizes that it was
attached to a connection not containing the desired protocol.

This change also removes the DPD::max_violations option, as it no longer
serves any purpose after this change. (In practice, the option remains
with an &deprecated warning, but it is no longer used for anything).

There are relatively minimal test-baseline changes due to this; they are
mostly triggered by the removal of the data structure and by less
analyzer errors being thrown, as unconfirmed analyzers are disabled
after the first error.
2025-01-30 16:59:44 +00:00
Johanna Amann
e6ed61c47a DPD: log analyzers that have confirmed
This switches the DPD logic to always log analyzers that raised a
protocol confirmation.

The logic is that, once a protocol has been confirmed - and thus there
probably is log output - it does not make sense to later remove it from
the log. It does make sense to somehow flag it as failed - but that
seems like a secondary step.
2025-01-30 16:59:44 +00:00
Johanna Amann
e411153f0d IRC analyzer - make protocol confirmation more robust.
I noticed that the IRC analyzer always confirms connections, pretty much
without regard what happened in it. This commit changes the logic of the
IRC analyzer to check for valid commands before confirming.
2025-01-30 16:59:40 +00:00
Tim Wojtulewicz
99023b14d5 Merge remote-tracking branch 'origin/topic/etyp/type-const'
* origin/topic/etyp/type-const:
  Make types into constants
2025-01-24 15:47:40 -07:00
Tim Wojtulewicz
5d9aa52122 Revert "Merge remote-tracking branch 'origin/topic/etyp/type-const'"
This reverts commit 53982aabfa, reversing
changes made to 8c28e47dc1.
2025-01-24 15:47:01 -07:00
Tim Wojtulewicz
1b122a919d Update doc submodule [nomail] [skip ci] 2025-01-24 15:43:37 -07:00
Tim Wojtulewicz
53982aabfa Merge remote-tracking branch 'origin/topic/etyp/type-const'
* origin/topic/etyp/type-const:
  Make types into constants
2025-01-24 15:43:06 -07:00
Evan Typanski
0c27aa6c50 Make types into constants
Closes #4173

This allows types to be used in expressions, but they can't be
reassigned. Note that this was meant to be a special "type expression" -
but that is unnecessary complexity.

Type expressions would allow access to the type without going through
its constant value, but the constant value is never changed, so it's
simply a few more checks if necessary when functionality gets expanded.
This way, ZAM and other code will not need updates, so the potential for
increased work in the future is probably not worth caring about.
2025-01-24 13:57:28 -05:00
Tim Wojtulewicz
8c28e47dc1 Merge remote-tracking branch 'origin/topic/timw/rst-linting'
* origin/topic/timw/rst-linting:
  Fix errors from rst linting on the generated docs
2025-01-24 11:42:32 -07:00
Tim Wojtulewicz
c1a8f8b763 Fix errors from rst linting on the generated docs 2025-01-24 11:41:36 -07:00
Evan Typanski
efe1ad2581 Make types into constants
Closes #4173

This allows types to be used in expressions, but they can't be
reassigned. Note that this was meant to be a special "type expression" -
but that is unnecessary complexity.

Type expressions would allow access to the type without going through
its constant value, but the constant value is never changed, so it's
simply a few more checks if necessary when functionality gets expanded.
This way, ZAM and other code will not need updates, so the potential for
increased work in the future is probably not worth caring about.
2025-01-24 11:16:10 -05:00
zeek-bot
fdf887ce3b Update doc submodule [nomail] [skip ci] 2025-01-24 00:14:23 +00:00
Tim Wojtulewicz
cc1fdb4203 Merge remote-tracking branch 'origin/topic/etyp/options-segfault-fix'
* origin/topic/etyp/options-segfault-fix:
  Fix options parsing segfault
2025-01-23 11:49:59 -07:00
Tim Wojtulewicz
ec0b44e5b0 Merge remote-tracking branch 'origin/topic/timw/merge-init-bare-sections'
* origin/topic/timw/merge-init-bare-sections:
  Minor whitespace cleanup in init-bare.zeek
  Add missing export blocks to init-bare.zeek
  Merge some GLOBAL module sections in init-bare
  Merge Tunnel module sections in init-bare
2025-01-23 11:21:38 -07:00
Tim Wojtulewicz
4eef4f4e33 Minor whitespace cleanup in init-bare.zeek 2025-01-23 11:21:08 -07:00
Tim Wojtulewicz
aab8f6575a Add missing export blocks to init-bare.zeek 2025-01-23 11:21:08 -07:00
Tim Wojtulewicz
9b75de4e09 Merge some GLOBAL module sections in init-bare 2025-01-23 11:21:08 -07:00
Tim Wojtulewicz
f6e091452b Merge Tunnel module sections in init-bare 2025-01-23 11:21:08 -07:00
Evan Typanski
30ccee263e Fix options parsing segfault
A command like this would segfault:

zeek -b test.zeek --debug

The issue was that `getopt_long` was using a null element to determine
what the end of the options array is. If it saw a non-null element after
`--debug` it would say it's the argument for optarg, even if it's beyond
`zeek_args.size()`. Instead, just make sure the array is
null-terminated.
2025-01-23 11:41:11 -05:00
Arne Welzel
cb44a6ca53 Merge remote-tracking branch 'origin/topic/awelzel/lookup-connection-zam-follow-up'
* origin/topic/awelzel/lookup-connection-zam-follow-up:
  script_opt: Use emit_builtin_error() for Lookup-Conn
2025-01-23 16:46:43 +01:00
Arne Welzel
3b4b379950 script_opt: Use emit_builtin_error() for Lookup-Conn
Still create a separate baseline file because ZAM doesn't provide
detailed location information.

Patch for ZBI.op provided by @vpax
2025-01-23 09:35:22 +01:00
Tim Wojtulewicz
7e5a9c3a82 Merge remote-tracking branch 'origin/topic/awelzel/lookup-connection-tweaks'
* origin/topic/awelzel/lookup-connection-tweaks:
  session/Manager: Emit explicit errors for FindConnection() with proto=65535
  IPAddr/ConnKey: Protect from uninitialized conn_id
  IPAddr/ConnKey: Promote transport to uint16_t
  session/Manager: Header cleanup
2025-01-21 16:49:09 -07:00
Arne Welzel
92f2f66a60 Merge remote-tracking branch 'origin/topic/vern/standalone-lambdas'
* origin/topic/vern/standalone-lambdas:
  fixes for -O gen-standalone-C++ generation of lambdas
2025-01-20 10:27:46 +01:00
Arne Welzel
17836ef7d9 session/Manager: Emit explicit errors for FindConnection() with proto=65535
We silently broke users constructing conn_id records manually and
subsequently using them with lookup_connection() or connection_exists().

This is an attempt to at least report a runtime error about the situation
so it doesn't go completely unnoticed.
2025-01-17 17:57:49 +01:00
Arne Welzel
ec0a85f553 IPAddr/ConnKey: Protect from uninitialized conn_id
Check if the non-default fields exist using HasField()
and use GetField() for proto such that it'll initialize
the default value which GetFieldAs<> doesn't do.
default
2025-01-17 17:53:02 +01:00
Arne Welzel
1105c8fe7d IPAddr/ConnKey: Promote transport to uint16_t
Instead of a separate bool field which is also stored in the session
table, promote the transport field to uint16_t and encode an invalid
ConnKey as transport 2**16-2
2025-01-17 17:53:02 +01:00
Arne Welzel
33fd324ebb session/Manager: Header cleanup 2025-01-17 17:45:05 +01:00
zeek-bot
eed205d1ef Update doc submodule [nomail] [skip ci] 2025-01-17 00:12:51 +00:00
Vern Paxson
a3b54b69a1 fixes for -O gen-standalone-C++ generation of lambdas 2025-01-14 17:02:12 -08:00
zeek-bot
f571ee31e0 Update doc submodule [nomail] [skip ci] 2025-01-15 00:33:48 +00:00
Arne Welzel
868eb129bf Merge remote-tracking branch 'origin/topic/awelzel/fix-writer-info-in-logging-hooks'
* origin/topic/awelzel/fix-writer-info-in-logging-hooks:
  logging: Fix reporter message
  logging: Avoid repeated writer name lookups for plugin hooks
  logging: Fix HookLogInit() and HookLogWrite() info usage
2025-01-14 21:39:31 +01:00
Benjamin Bannier
c6f9dfb155 Merge branch 'topic/bbannier/coverity' 2025-01-14 18:20:11 +01:00
Benjamin Bannier
0e12e68fb7 Bump auxil/spicy to latest development snapshot 2025-01-14 17:28:31 +01:00
Benjamin Bannier
a14dd511a5 Prevent unneeded copies in QUIC C++ helper code 2025-01-14 16:59:22 +01:00
Johanna Amann
b2222e97a1 Merge remote-tracking branch 'origin/topic/johanna/gh-4061'
* origin/topic/johanna/gh-4061:
  Update BiF-tracking, add is_event_handled
  Address review comments and small updates for DNS warnings
  Raise warnings when for DNS events that are not raised due to dns_skip_all_addl
2025-01-14 14:39:56 +00:00
Arne Welzel
5f91f8485c Merge remote-tracking branch 'origin/topic/vern/C++-standalone-record-redef'
* origin/topic/vern/C++-standalone-record-redef:
  support for record extensions when using -O gen-standalone-C++
2025-01-14 11:14:25 +01:00
Vern Paxson
960931ba5c support for record extensions when using -O gen-standalone-C++ 2025-01-14 11:12:10 +01:00
Arne Welzel
fd2229e7bb logging: Fix reporter message 2025-01-14 10:46:37 +01:00
Arne Welzel
345c4ca28a logging: Avoid repeated writer name lookups for plugin hooks
If a plugin provides a write hook, the invocation for HookLogWrite() would
redo looking up the writer's name from the enum value and instantiating
a new std::string instance for every write. Avoid doing this.
2025-01-14 10:45:34 +01:00
Arne Welzel
927a06b9ab logging: Fix HookLogInit() and HookLogWrite() info usage
There's two instances of WriterBackend::WriterInfo for a given
writer. One in Manager::WriterInfo that's accessible via
stream.writers and a copy within WriterFrontend.

Commit 78999d147d switched to use the
address of the frontend's info instance for HookLogWrite() invocations,
breaking users using the address for identification purposes.
2025-01-14 10:44:50 +01:00
Johanna Amann
6bfa55904c Update BiF-tracking, add is_event_handled 2025-01-14 09:33:49 +00:00
Johanna Amann
13f042cc27 Address review comments and small updates for DNS warnings
This commit addresses review feedback for DH-4155. Furthermore it fixes
test failures, and adds a new test for the is_event_handled bif.
2025-01-14 09:33:48 +00:00
Benjamin Bannier
300b3788e2 Merge branch 'topic/bbannier/coverity' 2025-01-14 08:44:22 +01:00
Benjamin Bannier
3f5fd5c414 Bump auxil/spicy to latest development snapshot 2025-01-13 23:03:27 +01:00
Benjamin Bannier
2fd20f71ad Prevent copies in various places 2025-01-13 22:19:16 +01:00
Tim Wojtulewicz
8931c352ef Merge remote-tracking branch 'origin/topic/bbannier/fix-spicy-ssl-includes'
* origin/topic/bbannier/fix-spicy-ssl-includes:
  Fix incomplete includes in Spicy SSL analyer C++ code
2025-01-13 08:31:04 -07:00
Tim Wojtulewicz
3ae6904b7c Merge branch 'topic/timw/add-security-md'
* topic/timw/add-security-md:
  Add SECURITY.md, pointing at the website
2025-01-13 08:22:13 -07:00
Tim Wojtulewicz
1ff5569762 Add SECURITY.md, pointing at the website 2025-01-13 08:21:28 -07:00
Tim Wojtulewicz
36737657ea Merge remote-tracking branch 'origin/topic/timw/non-routeable-subnets'
* origin/topic/timw/non-routeable-subnets:
  Update zeekctl submodule [nomail]
2025-01-13 08:20:09 -07:00
Tim Wojtulewicz
16809435a7 Update zeekctl submodule [nomail] 2025-01-13 08:18:47 -07:00
Benjamin Bannier
097088085e Fix incomplete includes in Spicy SSL analyer C++ code
This appears to have been broken by
feec451bce.
2025-01-12 14:00:51 +01:00
zeek-bot
436d23204e Update doc submodule [nomail] [skip ci] 2025-01-12 00:22:54 +00:00
Benjamin Bannier
8910415659 Merge branch 'topic/bbannier/bump-spicy' 2025-01-11 17:36:54 +01:00
zeek-bot
7b3126689f Update doc submodule [nomail] [skip ci] 2025-01-11 00:13:58 +00:00
Christian Kreibich
f2d54db694 Merge remote-tracking branch 'origin/topic/etyp/harden-flaky-test'
* origin/topic/etyp/harden-flaky-test:
  Harden flaky test based on creating a file
2025-01-10 11:15:45 -08:00
Benjamin Bannier
a17ca4f870 Mark swap specialization noexcept 2025-01-10 11:42:27 +01:00
Benjamin Bannier
feec451bce Clean up some includes 2025-01-10 11:42:27 +01:00
Benjamin Bannier
3ea2d2760a Prevent exception in noexcept function. 2025-01-10 11:42:26 +01:00
Benjamin Bannier
85ad6084e8 Prevent exception escape. 2025-01-10 11:42:26 +01:00
Benjamin Bannier
a4ab0af70d Prevent unnecessary copies in Spicy bindings 2025-01-10 11:42:26 +01:00
Benjamin Bannier
7f1d3ae559 Bump auxil/spicy to latest development snapshot 2025-01-10 11:42:26 +01:00
Tim Wojtulewicz
c10b18253a Merge remote-tracking branch 'origin/topic/timw/non-routeable-subnets'
* origin/topic/timw/non-routeable-subnets:
  Update btests for new local-only subnets
  Add recommended non-routable subnets
2025-01-09 22:18:03 -07:00
Tim Wojtulewicz
0fcbc8546e Update btests for new local-only subnets 2025-01-09 22:16:42 -07:00
JW-Corelight
05e3de9b81 Add recommended non-routable subnets
224.0.0.0/24 (and 6to4 conversion 2002:e000::/40) from RFC5771	"Multicast Local Network Control Block" defined as non-routable.

239.0.0.0/8 (and 6to4 conversion 2002:ef00::/24) from RFC2365 "Administratively Scoped IP Multicast"

fec0::/10 from RFC3879 "Deprecated Site Local Addresses"
(cherry picked from commit 821ab2dbed)
2025-01-09 22:15:45 -07:00
Tim Wojtulewicz
5fbbbe9548 Fix another typo in the Coverity workflow script 2025-01-09 18:45:56 -07:00
zeek-bot
a4d9067327 Update doc submodule [nomail] [skip ci] 2025-01-10 00:14:49 +00:00
Tim Wojtulewicz
a919226b24 Merge remote-tracking branch 'origin/topic/vern/macro-descriptions'
* origin/topic/vern/macro-descriptions:
  Add missing include for <vector>
  Extended ZAM validation to include macros
2025-01-09 13:47:57 -07:00
Tim Wojtulewicz
c30af24aee Add missing include for <vector> 2025-01-09 12:28:24 -07:00
Tim Wojtulewicz
7df5298fcd Merge remote-tracking branch 'origin/topic/vern/zam-header-factoring'
* origin/topic/vern/zam-header-factoring:
  factoring of some ZAM header files for better modularity
2025-01-09 12:09:16 -07:00
Tim Wojtulewicz
f57e650242 Merge remote-tracking branch 'origin/topic/vern/CPP-standalone-fixes'
* origin/topic/vern/CPP-standalone-fixes:
  fixes for initializing globals when using -O gen-standalone-C++
2025-01-09 12:02:55 -07:00
Evan Typanski
34f13e7291 Harden flaky test based on creating a file
Closes #4102

Surely it won't take over 10 seconds to create the file
2025-01-09 11:06:04 -05:00
Arne Welzel
0fc7a8ca4b Merge remote-tracking branch 'origin/topic/etyp/copying-2025'
* origin/topic/etyp/copying-2025:
  Update COPYING date to now and fix some [skip CI]
2025-01-09 16:34:28 +01:00
Evan Typanski
fe44022ee7 Update COPYING date to now and fix some [skip CI] 2025-01-09 08:38:45 -05:00
Christian Kreibich
597e137b46 Merge remote-tracking branch 'origin/topic/etyp/help-stdout'
* origin/topic/etyp/help-stdout:
  Try to be more careful with `--help` printing
2025-01-08 21:44:49 -08:00
zeek-bot
b76cc88f3a Update doc submodule [nomail] [skip ci] 2025-01-09 00:12:41 +00:00
Johanna Amann
ac1c55c02a Merge remote-tracking branch 'origin/topic/johanna/yet-another-curve-for-ssl'
* origin/topic/johanna/yet-another-curve-for-ssl:
  Add CECPQ2 curve number to SSL consts
2025-01-08 16:22:28 +00:00
Tim Wojtulewicz
e0961da7b9 Merge remote-tracking branch 'origin/topic/timw/fix-coverity-request'
* origin/topic/timw/fix-coverity-request:
  CI: Fix escaping in coverity workflow
2025-01-08 08:38:39 -07:00
Tim Wojtulewicz
5d55d40764 CI: Fix escaping in coverity workflow 2025-01-08 08:37:59 -07:00
Evan Typanski
0b2f843db9 Try to be more careful with --help printing
Namely, this will:

 - print --help to stdout rather than stderr
 - not print full usage when errors happen
 - add a prompt to use --help for more info on error

This should make it more greppable, clearer, and less spammy.
2025-01-08 07:54:18 -05:00
Johanna Amann
8b85acfc05 Add CECPQ2 curve number to SSL consts
This one was hard to find, as it never was officially specified
anywhere.

Source: https://boringssl.googlesource.com/boringssl/+/4ae4fb76c809bfc48a5ab100670395ce404244ce%5E%21/#F4
2025-01-08 09:36:48 +00:00
zeek-bot
adf02b487f Update doc submodule [nomail] [skip ci] 2025-01-08 00:15:06 +00:00
Tim Wojtulewicz
f1c054f8f3 Merge remote-tracking branch 'origin/topic/christian/news-7-1-contribs'
* origin/topic/christian/news-7-1-contribs:
  Add 7.1 contributors to NEWS file [skip ci]
2025-01-07 11:41:44 -07:00
Christian Kreibich
0ff3fbb7ce Add 7.1 contributors to NEWS file [skip ci] 2025-01-07 10:38:51 -08:00
Johanna Amann
9f72353a41 Raise warnings when for DNS events that are not raised due to dns_skip_all_addl
By default, dns_skip_all_addl is set to false. This causes several
events to not be raised. This change emits warnings when a user defines
event handlers for events that will not be raised.

Furthermore, it adds notes about this behavior to the documentation. We
also introduce a new BIF, `is_event_handled`, which checks if an event
is handled.

Fixes GH-4061
2025-01-07 17:46:27 +00:00
Tim Wojtulewicz
2ce71a75a7 Merge remote-tracking branch 'origin/topic/johanna/even-more-tls-const-updates'
* origin/topic/johanna/even-more-tls-const-updates:
  More updates to the SSL consts from recent protocol additions
2025-01-07 10:05:26 -07:00
Johanna Amann
87d9ecb743 More updates to the SSL consts from recent protocol additions 2025-01-07 16:08:18 +00:00
zeek-bot
a819d7cf8a Update doc submodule [nomail] [skip ci] 2025-01-07 00:12:57 +00:00
Tim Wojtulewicz
7f4a620db6 Merge remote-tracking branch 'origin/topic/johanna/more-post-quantum-curves'
* origin/topic/johanna/more-post-quantum-curves:
  Update ssl consts with more post-quantum curves
2025-01-06 15:51:40 -07:00
Tim Wojtulewicz
c892594703 Merge remote-tracking branch 'origin/topic/timw/coverity-upload-large-builds'
* origin/topic/timw/coverity-upload-large-builds:
  CI: Fix coverity workflow to support large uploads
  CI: Remove use of wget from coverity workflow
  CI: Upgrade coverity workflow to ubuntu24, add jq
2025-01-06 10:37:50 -07:00
Johanna Amann
c99f544e1c Update ssl consts with more post-quantum curves 2025-01-06 16:54:29 +00:00
zeek-bot
01e6c2c53b Update doc submodule [nomail] [skip ci] 2025-01-06 00:14:25 +00:00
Tim Wojtulewicz
6deae2d28d Merge remote-tracking branch 'origin/topic/bbannier/fix-zeek-see-uses'
* origin/topic/bbannier/fix-zeek-see-uses:
  Fix incorrect uses of `zeek:see`
2025-01-05 14:19:32 -07:00
Tim Wojtulewicz
f95298f1d0 CI: Fix coverity workflow to support large uploads
The previous setup only allowed uploads of up to 500MB, which we
eclipsed a long time ago. They recently started enforcing it, so
this switches over to use a call-and-response API for uploading
larger files.
2025-01-05 12:22:56 -07:00
Tim Wojtulewicz
2cc2056310 CI: Remove use of wget from coverity workflow 2025-01-05 12:22:21 -07:00
Tim Wojtulewicz
b0b534dbda CI: Upgrade coverity workflow to ubuntu24, add jq 2025-01-05 10:51:24 -07:00
Vern Paxson
7a908a2876 Extended ZAM validation to include macros 2025-01-02 15:32:30 -08:00
Vern Paxson
4f48428283 factoring of some ZAM header files for better modularity 2025-01-02 08:36:42 -08:00
Vern Paxson
3d58732cb3 fixes for initializing globals when using -O gen-standalone-C++ 2025-01-01 13:26:58 -08:00
Benjamin Bannier
e8960e0efc Fix incorrect uses of zeek:see
This fixes instances where `zeek:see` was used incorrectly so it was not
rendered correctly. All these instances have been found by looking for
`zeek:see` in the generated HTML where it should not be visible anymore.

I also removed a doc reference to `paraglob_add` which never existed.
2025-01-01 15:35:59 +01:00
zeek-bot
9e85a0d27d Update doc submodule [nomail] [skip ci] 2025-01-01 00:12:27 +00:00
Tim Wojtulewicz
f39f0aae2d Merge remote-tracking branch 'origin/topic/bbannier/bump-spicy'
* origin/topic/bbannier/bump-spicy:
  Bump auxil/spicy to latest development snapshot
2024-12-20 15:31:34 -07:00
Benjamin Bannier
4278ab2b04 Bump auxil/spicy to latest development snapshot 2024-12-20 15:18:20 -07:00
Tim Wojtulewicz
3a0bb55244 Merge remote-tracking branch 'origin/topic/timw/require-spicy-for-analyzer-id-test'
* origin/topic/timw/require-spicy-for-analyzer-id-test:
  Require spicy for spicy.analyzer-id btest
2024-12-20 15:14:42 -07:00
Tim Wojtulewicz
eb8f99da92 Require spicy for spicy.analyzer-id btest 2024-12-20 14:25:04 -07:00
zeek-bot
65022614ba Update doc submodule [nomail] [skip ci] 2024-12-20 00:12:22 +00:00
Tim Wojtulewicz
15a506a5b7 Merge remote-tracking branch 'origin/topic/etyp/get-tag-doc'
* origin/topic/etyp/get-tag-doc:
  Document `get_tag` to ensure that `name` exists
2024-12-19 11:15:48 -07:00
Tim Wojtulewicz
f405f4ea7e Merge remote-tracking branch 'origin/topic/timw/4090-current-spicy-analyzer'
* origin/topic/timw/4090-current-spicy-analyzer:
  Add spicy runtime-support current_analyzer_id(), use it to set id in events
2024-12-18 15:46:17 -07:00
Tim Wojtulewicz
fd4f25965d Add spicy runtime-support current_analyzer_id(), use it to set id in events 2024-12-18 15:44:09 -07:00
Evan Typanski
77273a676d Document get_tag to ensure that name exists
This caused confusion and I don't think it's very intuitive. If called
with a name that does not exist, this returns without a value, not even
an error value. Changing that seems like it could be more deprecation
work.
2024-12-18 16:13:13 -05:00
Arne Welzel
991bc9644d Merge remote-tracking branch 'origin/topic/vern/ZAM-field-assign-in-op'
* origin/topic/vern/ZAM-field-assign-in-op:
  pre-commit: Bump spicy-format to 0.23
  fix for ZAM optimization of assigning a record field to result of "in" operation
2024-12-18 09:28:44 +01:00
Arne Welzel
f290529b35 pre-commit: Bump spicy-format to 0.23 2024-12-18 09:27:31 +01:00
Vern Paxson
6e549554b8 fix for ZAM optimization of assigning a record field to result of "in" operation 2024-12-17 19:49:43 -08:00
Tim Wojtulewicz
e4489616c6 Merge remote-tracking branch 'origin/topic/timw/3969-broker-stores-at-global-scope'
* origin/topic/timw/3969-broker-stores-at-global-scope:
  Return a warning and fail if creating a store at global scope
2024-12-17 12:15:56 -07:00
Tim Wojtulewicz
6b5d0491aa Return a warning and fail if creating a store at global scope 2024-12-17 11:32:43 -07:00
Tim Wojtulewicz
33eaa5ccda Merge remote-tracking branch 'origin/topic/awelzel/4084-vector-of-pattern-compare'
* origin/topic/awelzel/4084-vector-of-pattern-compare:
  ZAM/relexpr-op NE for patterns
  Expr: Fix folding of pattern values to support == and !=
2024-12-16 12:37:46 -07:00
Vern Paxson
30de8dbea1 ZAM/relexpr-op NE for patterns 2024-12-16 19:56:57 +01:00
Tim Wojtulewicz
f940f2d88f Merge remote-tracking branch 'security/topic/awelzel/217-quic-decrypt-crash'
* security/topic/awelzel/217-quic-decrypt-crash:
  QUIC/decrypt_crypto: Actually check if decryption was successful
  QUIC/decrypt_crypto: Limit payload_length to 10k
  QUIC/decrypt_crypto: Fix decrypting into too small stack buffer
2024-12-16 10:19:43 -07:00
Arne Welzel
cd8adb3da5 Expr: Fix folding of pattern values to support == and !=
The fatal error is actually triggered at runtime, so it's a bit
dangerous for users, but not sure there's many use-cases to
compare vectors of patterns.

Closes #4084
2024-12-16 10:56:02 +01:00
Arne Welzel
7bdc856f0d QUIC/decrypt_crypto: Actually check if decryption was successful
...and bail if it wasn't.

PCAP was produced using OSS-Fuzz input from issue 383379789.
2024-12-15 20:39:26 -07:00
Arne Welzel
f10832d110 QUIC/decrypt_crypto: Limit payload_length to 10k
Given we dynamically allocate memory for decryption, employ a limit
that is unlikely to be hit, but allows for large payloads produced
by the fuzzer or jumbo frames.
2024-12-15 20:39:26 -07:00
Arne Welzel
15511e0fb5 QUIC/decrypt_crypto: Fix decrypting into too small stack buffer
A QUIC initial packet larger than 1500 bytes could lead to crashes
due to the usage of a fixed size stack buffer for decryption.

Allocate the necessary memory dynamically on the heap instead.
2024-12-15 20:39:26 -07:00
Tim Wojtulewicz
9a4791f9e9 Fix naming of zeromq package in Coverity workflow 2024-12-15 20:38:18 -07:00
Tim Wojtulewicz
ef35eadbd4 Fix naming of cppzmq-dev package in Coverity workflow 2024-12-15 20:36:47 -07:00
Tim Wojtulewicz
909a3d30b2 Merge branch 'topic/timw/coverity-build-failure'
* topic/timw/coverity-build-failure:
  CI: Add missing packages to coverity workflow
2024-12-13 16:46:36 -07:00
Tim Wojtulewicz
d702675aa6 CI: Add missing packages to coverity workflow 2024-12-13 13:58:55 -07:00
Tim Wojtulewicz
db3dcd5ff9 Start of 7.2.0 development 2024-12-13 13:38:53 -07:00
Tim Wojtulewicz
0890de2a3b Merge remote-tracking branch 'origin/topic/timw/update-all-submodules'
* origin/topic/timw/update-all-submodules:
  Updating submodule(s) [nomail]
2024-12-13 13:15:58 -07:00
Tim Wojtulewicz
0b301bbd26 Updating submodule(s) [nomail] 2024-12-13 12:18:00 -07:00
Tim Wojtulewicz
ee6d1374ba Merge remote-tracking branch 'origin/topic/vern/ZAM-assert-streamlining'
* origin/topic/vern/ZAM-assert-streamlining:
  btest/supervisor: Bump one timeout to 30 seconds
  btest/cluster: Bump timeouts to 30 seconds
  btest/validate-ZAM: Update baseline, run always
2024-12-13 12:17:45 -07:00
Tim Wojtulewicz
d788ab8f0e Merge remote-tracking branch 'origin/topic/vern/ZAM-assert-streamlining'
* origin/topic/vern/ZAM-assert-streamlining:
  simplified ZAM instructions for executing "assert" statements
2024-12-13 12:15:08 -07:00
Tim Wojtulewicz
ef98afb29e Merge remote-tracking branch 'origin/topic/awelzel/3287-push-rc-container-images'
* origin/topic/awelzel/3287-push-rc-container-images:
  cirrus/container_image_manifest: match RC tags, too
  cirrus: Move additional tag "computation" into separate script
2024-12-13 12:14:30 -07:00
Arne Welzel
a675aea6bb btest/supervisor: Bump one timeout to 30 seconds 2024-12-13 18:35:39 +01:00
Arne Welzel
21e33fdcd9 btest/cluster: Bump timeouts to 30 seconds
ZAM startup may take a long time, particularly in CI environments, so
bump it up from 10 to 30 seconds.
2024-12-13 18:28:43 +01:00
Arne Welzel
48b26f74f7 btest/validate-ZAM: Update baseline, run always 2024-12-13 18:25:28 +01:00
Tim Wojtulewicz
805e9db588 Merge remote-tracking branch 'origin/topic/vern/ZAM-tbl-iteration-memory-mgt-fix'
* origin/topic/vern/ZAM-tbl-iteration-memory-mgt-fix:
  fix for memory management associated with ZAM table iteration
2024-12-13 08:04:29 -07:00
Arne Welzel
522b03d362 cirrus/container_image_manifest: match RC tags, too
The rest should just work, assuming VERSION files contain an
appropriate value. Add a check for that, too.
2024-12-13 13:17:37 +01:00
Arne Welzel
eac91fdc24 cirrus: Move additional tag "computation" into separate script
This allows for easier testing locally and maybe re-usability.
2024-12-13 13:17:31 +01:00
Arne Welzel
8d09a404f2 Merge remote-tracking branch 'origin/topic/awelzel/zeekygen-disable-cluster-experimental'
* origin/topic/awelzel/zeekygen-disable-cluster-experimental:
  zeekygen: Disable Cluster::Experimental module
2024-12-13 12:59:33 +01:00
Arne Welzel
9c5c8b55cc Merge remote-tracking branch 'origin/topic/vern/CPP-standalone-fixes'
* origin/topic/vern/CPP-standalone-fixes:
  BTest updates in support of compiling-scripts-to-C++
  -O gen-standalone-C++ fixes for recent more aggressive AST profiling
2024-12-13 10:57:28 +01:00
Arne Welzel
38e77eace7 zeekygen: Disable Cluster::Experimental module
The nodes-experimental/manager.zeek file ends up calling Broker::publish()
unconditionally, resulting in a warning. Skip running that code when
generating documentation.
2024-12-13 10:03:44 +01:00
Vern Paxson
4b6cec4cd8 simplified ZAM instructions for executing "assert" statements 2024-12-12 22:40:49 -08:00
Christian Kreibich
94f64a6dc6 Merge remote-tracking branch 'origin/topic/vern/preen-btest-alternatives'
* origin/topic/vern/preen-btest-alternatives:
  removed a bunch of no-longer used BTest alternatives and their associated baselines
2024-12-12 20:11:56 -08:00
Vern Paxson
85ef6e0cb8 removed a bunch of no-longer used BTest alternatives and their associated baselines 2024-12-12 19:16:34 -08:00
Vern Paxson
f4421d81c2 fix for memory management associated with ZAM table iteration 2024-12-12 18:37:52 -08:00
zeek-bot
14b59192ba Update doc submodule [nomail] [skip ci] 2024-12-13 00:25:00 +00:00
Vern Paxson
8876ec6f2d BTest updates in support of compiling-scripts-to-C++ 2024-12-12 14:30:23 -08:00
Vern Paxson
0a813a53c7 -O gen-standalone-C++ fixes for recent more aggressive AST profiling 2024-12-12 14:27:12 -08:00
Tim Wojtulewicz
1158757b2b Merge remote-tracking branch 'origin/topic/awelzel/move-broker-to-cluster-publish'
* origin/topic/awelzel/move-broker-to-cluster-publish:
  netcontrol: Move to Cluster::publish()
  openflow: Move to Cluster::publish()
  netcontrol/catch-and-release: Move to Cluster::publish()
  config: Move to Cluster::publish()
  ssl/validate-certs: Move to Cluster::publish()
  irc: Move to Cluster::publish()
  ftp: Move to Cluster::publish()
  dhcp: Move to cluster publish
  notice: Move to Cluster::publish()
  intel: Move to Cluster::publish()
  sumstats: Move to Cluster::publish()
2024-12-12 13:18:21 -07:00
Tim Wojtulewicz
25554fa668 Merge remote-tracking branch 'origin/topic/awelzel/fix-cluster-publish-any'
* origin/topic/awelzel/fix-cluster-publish-any:
  cluster/Backend: Handle unspecified table/set
  cluster: Fix Cluster::publish() of Broker::Data
  cluster: Be noisy when attempting to connect to an unknown node
2024-12-12 13:17:08 -07:00
Tim Wojtulewicz
c3bae4f1f8 Merge remote-tracking branch 'origin/topic/bbannier/bump-spicy'
* origin/topic/bbannier/bump-spicy:
  Bump auxil/spicy to latest development snapshot
2024-12-12 11:35:19 -07:00
Tim Wojtulewicz
98ec627404 Merge branch 'topic/timw/7.1-news-updates'
* topic/timw/7.1-news-updates:
  Add note about various dependency updates [nomail] [skip ci]
  NEWS additions for v7.1 [nomail] [skip ci]
2024-12-12 11:33:09 -07:00
Arne Welzel
3d55341690 netcontrol: Move to Cluster::publish() 2024-12-12 17:54:42 +01:00
Arne Welzel
fdf783df65 cluster/Backend: Handle unspecified table/set
Same as what we do in Broker. Use the expected type if publishing
a table() or set() parameter.

This fixes issues when switching sumstats to Cluster::publish()
2024-12-12 17:54:42 +01:00
Arne Welzel
b2df78c0bb openflow: Move to Cluster::publish() 2024-12-12 17:54:42 +01:00
Arne Welzel
100b825561 netcontrol/catch-and-release: Move to Cluster::publish() 2024-12-12 17:54:42 +01:00
Arne Welzel
66f6149662 config: Move to Cluster::publish() 2024-12-12 17:54:42 +01:00
Arne Welzel
32c9c940bf ssl/validate-certs: Move to Cluster::publish() 2024-12-12 17:54:42 +01:00
Arne Welzel
3d3706440b irc: Move to Cluster::publish() 2024-12-12 17:54:42 +01:00
Arne Welzel
387db42fea ftp: Move to Cluster::publish() 2024-12-12 17:54:42 +01:00
Arne Welzel
b372b47f83 dhcp: Move to cluster publish 2024-12-12 17:54:42 +01:00
Arne Welzel
a9243bafcc notice: Move to Cluster::publish() 2024-12-12 17:54:42 +01:00
Arne Welzel
347faf5e86 intel: Move to Cluster::publish() 2024-12-12 17:54:42 +01:00
Arne Welzel
f58a2c2ca8 sumstats: Move to Cluster::publish() 2024-12-12 17:54:42 +01:00
Arne Welzel
d9a74cf32d cluster: Fix Cluster::publish() of Broker::Data
The broker serializer leverages the existing data_to_val() function.
During unserialization, if the destination type is any, the logic
simply wraps the broker::data value into a Broker::Data record.
Therefore, events with any parameters are currently exposed to
the Broker::Data type.

There is a bigger issue in that re-publishing such Broker::Data
instances would encode them as a normal record. Explicitly prevent
this by serializing the contained data value directly instead, similar
to what Broker already did when publishing a record.
2024-12-12 17:54:37 +01:00
Arne Welzel
953fe8e029 Merge remote-tracking branch 'origin/topic/justin/pools-cache-node-topic'
* origin/topic/justin/pools-cache-node-topic:
  Pre-compute the node topics for all pool entries.
2024-12-12 14:45:50 +01:00
Arne Welzel
e100a8e698 Merge remote-tracking branch 'origin/topic/christian/fix-zam-analyzer-name'
* origin/topic/christian/fix-zam-analyzer-name:
  Fix ZAM's implementation of Analyzer::name() BiF
2024-12-12 14:45:28 +01:00
Benjamin Bannier
42406ad95e Bump auxil/spicy to latest development snapshot 2024-12-12 13:12:35 +01:00
Arne Welzel
271fc15041 cluster: Be noisy when attempting to connect to an unknown node
Mostly due to spending too much time wondering why nodes didn't connect
when there was a mismatch between "manager" and "manager-1" in the
cluster layout. Remove manager from test-all-policy-cluster test to
avoid connection attempts in this test.
2024-12-12 13:01:04 +01:00
Christian Kreibich
235638815f Fix ZAM's implementation of Analyzer::name() BiF
ZAM's implementation deviates from Zeek's in consideration of remappings, which
means that running ZAM produced conn.log service names prefixed with "spicy_"
whereas regular Zeek doesn't.
2024-12-11 23:16:47 -08:00
zeek-bot
fb74834f4c Update doc submodule [nomail] [skip ci] 2024-12-12 00:44:53 +00:00
Tim Wojtulewicz
b547c7287d Merge remote-tracking branch 'origin/topic/timw/remove-brocontrol-dir'
* origin/topic/timw/remove-brocontrol-dir:
  Update zeekctl submodule to remove BroControl dir
2024-12-11 15:33:17 -07:00
Tim Wojtulewicz
72375abf49 Update zeekctl submodule to remove BroControl dir 2024-12-11 15:32:38 -07:00
Justin Azoff
10438408a5 Pre-compute the node topics for all pool entries.
A zeek script profile showed a small percentage of time spent in
Cluster::node_topic, but this never changes and can be cached.
2024-12-11 15:57:01 -05:00
Tim Wojtulewicz
746d61f399 Run Coverity workflow on ubuntu 22.04 2024-12-11 13:31:49 -07:00
Tim Wojtulewicz
4eebc97355 Add note about various dependency updates [nomail] [skip ci] 2024-12-11 13:00:47 -07:00
Tim Wojtulewicz
7b8f9b5385 NEWS additions for v7.1 [nomail] [skip ci] 2024-12-11 13:00:28 -07:00
Tim Wojtulewicz
9e19b51f41 Merge remote-tracking branch 'origin/topic/johanna/spicysslnews'
* origin/topic/johanna/spicysslnews:
  Add blurb about Spicy SSL to NEWS
2024-12-11 12:59:28 -07:00
Johanna Amann
3711af53d5 Add blurb about Spicy SSL to NEWS 2024-12-11 12:58:35 -07:00
Tim Wojtulewicz
9f1a30d3fe Merge remote-tracking branch 'origin/topic/timw/add-spicy-to-coverity'
* origin/topic/timw/add-spicy-to-coverity:
  Add Spicy analyzers to Coverity builds
2024-12-11 12:38:59 -07:00
Tim Wojtulewicz
b1d077cab9 Add Spicy analyzers to Coverity builds 2024-12-11 12:38:34 -07:00
Tim Wojtulewicz
649cedb693 Merge remote-tracking branch 'origin/topic/timw/python-upgrade'
* origin/topic/timw/python-upgrade: (65 commits)
  Swap pre-commit yapf for ruff/ruff-format, fix findings
  Upgrade package-manager submodule to get python upgrade
  Upgrade broker submodule to get python upgrade
  Upgrade zeekctl submodule to get python upgrade
  Upgrade zeek-client submodule to get python upgrade
  Upgrade btest submodule to get python upgrade
  Require Python 3.9 in CMakeLists.txt
  CI: Install python 3.9 on ubuntu 20
  btest: Avoid loading ZeroMQ if not compiled in
  btest/coverage: Avoid warnings in test-all-policy-cluster
  Broker::publish: Warn on using Broker::publish() when inactive
  Update doc submodule [nomail] [skip ci]
  Update zeek-testing and zeek-testing-cluster commit hashes
  Update ZAM BiF-tracking
  configure: Add --disable-cluster-backend-zeromq
  CMakeLists: Cluster backends output
  zeromq: Conditionally enable by default
  btest/generic: Add publish_hrw(), publish_rr() and logging tests
  generate-docs: Run on Ubuntu 24.04, add cppzmq
  docker: Add cppzmq/libzmq dependencies
  ...
2024-12-11 11:46:02 -07:00
Tim Wojtulewicz
49f82b325b Swap pre-commit yapf for ruff/ruff-format, fix findings 2024-12-11 11:08:37 -07:00
Tim Wojtulewicz
b02f812e26 Upgrade package-manager submodule to get python upgrade 2024-12-11 11:08:37 -07:00
Tim Wojtulewicz
e65e92edcf Upgrade broker submodule to get python upgrade 2024-12-11 11:08:37 -07:00
Tim Wojtulewicz
c98ed621d6 Upgrade zeekctl submodule to get python upgrade 2024-12-11 11:08:37 -07:00
Tim Wojtulewicz
38fb76d52d Upgrade zeek-client submodule to get python upgrade 2024-12-11 11:08:37 -07:00
Tim Wojtulewicz
641306b912 Upgrade btest submodule to get python upgrade 2024-12-11 11:08:37 -07:00
Tim Wojtulewicz
566fa7c6d0 Require Python 3.9 in CMakeLists.txt 2024-12-11 11:08:37 -07:00
Tim Wojtulewicz
beb7b5bbbf CI: Install python 3.9 on ubuntu 20 2024-12-11 11:08:37 -07:00
Tim Wojtulewicz
7f3bea7ce1 Merge remote-tracking branch 'origin/topic/awelzel/broker-publish-warn'
* origin/topic/awelzel/broker-publish-warn:
  btest: Avoid loading ZeroMQ if not compiled in
  btest/coverage: Avoid warnings in test-all-policy-cluster
  Broker::publish: Warn on using Broker::publish() when inactive
2024-12-11 11:08:11 -07:00
Arne Welzel
85189ca918 btest: Avoid loading ZeroMQ if not compiled in
...at the same time, add some `TEST-REQUIRES: have-zeromq` which
unfortunately means that developers will usually want libzmq
installed on their system.
2024-12-11 18:08:43 +01:00
Arne Welzel
c6c6d88b4c btest/coverage: Avoid warnings in test-all-policy-cluster 2024-12-11 17:20:45 +01:00
Arne Welzel
0ad3210177 Broker::publish: Warn on using Broker::publish() when inactive
This is mostly for transitioning base scripts to Cluster::publish() and
avoid silent surprises why certain things don't work when using ZeroMQ.
2024-12-11 17:20:42 +01:00
Arne Welzel
f674fc2634 Merge remote-tracking branch 'origin/topic/timw/update-zeek-testing'
* origin/topic/timw/update-zeek-testing:
  Update zeek-testing and zeek-testing-cluster commit hashes
2024-12-11 13:19:33 +01:00
Arne Welzel
4ee2f9256b Merge remote-tracking branch 'origin/topic/awelzel/pluggable-cluster-backends-part4'
* origin/topic/awelzel/pluggable-cluster-backends-part4:
  Update ZAM BiF-tracking
  configure: Add --disable-cluster-backend-zeromq
  CMakeLists: Cluster backends output
  zeromq: Conditionally enable by default
  btest/generic: Add publish_hrw(), publish_rr() and logging tests
  generate-docs: Run on Ubuntu 24.04, add cppzmq
  docker: Add cppzmq/libzmq dependencies
  tsan_suppressions: Add called_from_lib: libzmq
  ci: Add cppzmq and libzmq to most platforms
  cluster/backend/zeromq: Add ZeroMQ based cluster backend
  cluster/backend/zeromq: Add cppzmq submodule
  cluster: Add Cluster::node_id(), allow redef of node_topic(), nodeid_topic()
  cluster: Move publish_hrw() and publish_rr() to cluster.bif
2024-12-11 09:52:41 +01:00
zeek-bot
567d2f356b Update doc submodule [nomail] [skip ci] 2024-12-11 00:19:44 +00:00
Tim Wojtulewicz
0701895132 Merge remote-tracking branch 'J-Gras/topic/jgras/add-unknown-proto-count'
* J-Gras/topic/jgras/add-unknown-proto-count:
  Add btest for unknown_protocols.log
  Add protocol_id count to unknown protocol record
2024-12-10 16:16:12 -07:00
Tim Wojtulewicz
f61ba4df29 Update zeek-testing and zeek-testing-cluster commit hashes 2024-12-10 16:13:00 -07:00
Tim Wojtulewicz
666d319cfa Merge remote-tracking branch 'origin/topic/christian/news-tweaks'
* origin/topic/christian/news-tweaks:
  NEWS tweaks [skip ci]
2024-12-10 14:41:28 -07:00
Arne Welzel
759281dabd Update ZAM BiF-tracking 2024-12-10 20:35:41 +01:00
Arne Welzel
b93a4f5d2f configure: Add --disable-cluster-backend-zeromq 2024-12-10 20:33:02 +01:00
Arne Welzel
9e9d0ba7aa CMakeLists: Cluster backends output 2024-12-10 20:33:02 +01:00
Arne Welzel
07e23fb95e zeromq: Conditionally enable by default
Instead of having ZeroMQ as a new dependency, enable the ZeroMQ backend only
if ZeroMQ is available on the system as suggested by Tim.
2024-12-10 20:33:02 +01:00
Arne Welzel
d816bfb249 btest/generic: Add publish_hrw(), publish_rr() and logging tests
They currently use zeromq, but technically they should be valid for
any other backend, too, even broker.
2024-12-10 20:33:02 +01:00
Arne Welzel
df69ec1279 generate-docs: Run on Ubuntu 24.04, add cppzmq 2024-12-10 20:33:02 +01:00
Arne Welzel
d946be878e docker: Add cppzmq/libzmq dependencies 2024-12-10 20:33:02 +01:00
Arne Welzel
2f37dcf505 tsan_suppressions: Add called_from_lib: libzmq 2024-12-10 20:33:02 +01:00
Arne Welzel
34275afc1f ci: Add cppzmq and libzmq to most platforms 2024-12-10 20:33:02 +01:00
Arne Welzel
35c79ab2e3 cluster/backend/zeromq: Add ZeroMQ based cluster backend
This is a cluster backend implementation using a central XPUB/XSUB proxy
that by default runs on the manager node. Logging is implemented leveraging
PUSH/PULL sockets between logger and other nodes, rather than going
through XPUB/XSUB.

The test-all-policy-cluster baseline changed: Previously, Broker::peer()
would be called from setup-connections.zeek, causing the IO loop to be
alive. With the ZeroMQ backend, the IO loop is only alive when
Cluster::init() is called, but that doesn't happen anymore.
2024-12-10 20:33:02 +01:00
Arne Welzel
889c7d888a cluster/backend/zeromq: Add cppzmq submodule
Not all supported platforms provide a recent enough cppzmq version,
add a fallback as submodule. cppzmq is a header-only library, so there's
no build step involved.
2024-12-10 20:33:02 +01:00
Arne Welzel
a2249f7ecb cluster: Add Cluster::node_id(), allow redef of node_topic(), nodeid_topic()
This provides a way for non-broker cluster backends to override a
node's identifier and its own topics that it listens on by default.
2024-12-10 20:33:02 +01:00
Arne Welzel
210b54799e cluster: Move publish_hrw() and publish_rr() to cluster.bif
From this point on, Cluster::publish_hrw() and Cluster::publish_rr()
go through cluster/Backend.cc code.
2024-12-10 20:33:02 +01:00
Arne Welzel
79a71357c7 Merge remote-tracking branch 'origin/topic/awelzel/bif-tracking-fix'
* origin/topic/awelzel/bif-tracking-fix:
  Update BiF-tracking, add get_current_packet_ts()
2024-12-10 20:31:47 +01:00
Arne Welzel
7449b050b3 Update BiF-tracking, add get_current_packet_ts()
Also, run the ZAM-bif-tracking test in non-ZAM environments so
failures are caught immediately. There's nothing overly ZAM specific about
running this test.

I'm not sure I like the fact that any new contributor adding a BiF
will need to dig into this... it might be a bit intimidating.
2024-12-10 20:07:56 +01:00
Arne Welzel
77465a90b5 Merge remote-tracking branch 'jgras/topic/jgras/fix-packet-lag'
* jgras/topic/jgras/fix-packet-lag:
  Introduce get_packet_lag()
  Add btest for get_current_packet_ts()
  Introduce get_current_packet_ts to fix packet lag
2024-12-10 18:26:54 +01:00
Jan Grashoefer
1805afe5d9 Add btest for unknown_protocols.log 2024-12-10 14:54:19 +01:00
Jan Grashoefer
9228f0ff9f Add protocol_id count to unknown protocol record
The count representation is not logged and added for access to the value
in log policy hooks without converting the logged hex representation.
2024-12-10 14:49:02 +01:00
Arne Welzel
9034e135d1 Merge remote-tracking branch 'origin/topic/awelzel/fix-dns-binds-complte-typo'
* origin/topic/awelzel/fix-dns-binds-complte-typo:
  DNS/dns_binds_rr: Fix complte to complete typo, switch to count
2024-12-10 09:57:00 +01:00
Christian Kreibich
a32ea43664 NEWS tweaks [skip ci]
- Switch list items back to "-" from "*" -- we hadn't used "*" since
  2.5.4 but started in 7.1, probably by accident? :-)

- Fix a typo.
2024-12-09 23:59:58 -08:00
Christian Kreibich
1c42bfc715 Merge branch 'topic/christian/disconnect-slow-peers'
* topic/christian/disconnect-slow-peers:
  Bump cluster testsuite to pull in Broker backpressure tests
  Expand documentation of Broker events.
  Add sleep() BiF.
  Add backpressure disconnect notification to cluster.log and via telemetry
  Remove unneeded @loads from base/misc/version.zeek
  Add Cluster::nodeid_to_node() helper function
  Support re-peering with Broker peers that fall behind
  Add Zeek-level configurability of Broker slow-peer disconnects
  Bump Broker to pull in disconnect feature and infinite-loop fix
  No need to namespace Cluster:: functions in their own namespace
2024-12-09 23:33:35 -08:00
zeek-bot
09541d5ef2 Update doc submodule [nomail] [skip ci] 2024-12-10 00:24:53 +00:00
Tim Wojtulewicz
cb7cda9808 Merge remote-tracking branch 'origin/topic/awelzel/license-header-cleanup'
* origin/topic/awelzel/license-header-cleanup:
  Add missing copyright line to headers and cc files
  pre-commit: Add license-header check inspired by Spicy
  Add missing "COPYING" in file comments
2024-12-09 12:23:00 -07:00
Tim Wojtulewicz
6e75417032 Merge remote-tracking branch 'origin/topic/vern/CPP-streamlining'
* origin/topic/vern/CPP-streamlining:
  BTest baseline updates for compile-to-C++
  mark ZAM regression BTests as not suitable for compile-to-C++
  fix for -O gen-C++ maintenance helper to skip BTest intermediary files
  introduced simplified initialization for non-standalone -O gen-C++ code tied -O gen-standalone-C++ to use of --optimize-files
  streamline generated -O C++ code by relying on per-function profiles rather than aggregate profile
  when reporting available/unavailble C++ script bodies, flag those that are skipped
  modified AST profiling to mark (and fully skip) non-optimizable functions
  modified merge_types() to skip work if given identical types, which also preserves type names (useful for -O gen-C++)
2024-12-09 12:16:00 -07:00
Tim Wojtulewicz
832b9b6cf0 Merge remote-tracking branch 'origin/topic/timw/python-magic-numbers'
* origin/topic/timw/python-magic-numbers:
  Move python signatures to a separate file
  Add signatures for Python bytecode for 3.8-3.14
2024-12-09 12:09:20 -07:00
Jan Grashoefer
c2b17f9d30 Introduce get_packet_lag() 2024-12-09 19:19:29 +01:00
Tim Wojtulewicz
ccefd66d37 Move python signatures to a separate file 2024-12-09 11:08:30 -07:00
Arne Welzel
f6c44e3f7a DNS/dns_binds_rr: Fix complte to complete typo, switch to count
From my reading in the docs the complete_flag should only ever be a
single byte, so add a weird for when it is longer, but use count
as the new type.
2024-12-09 19:02:28 +01:00
Benjamin Bannier
e94fe45865 Merge remote-tracking branch 'origin/topic/bbannier/bump-pre-commit-hook' 2024-12-09 17:42:39 +01:00
Jan Grashoefer
6977c07a25 Add btest for get_current_packet_ts() 2024-12-09 16:39:38 +01:00
Jan Grashoefer
08c5a9c66d Introduce get_current_packet_ts to fix packet lag
Using network_time to calculate packet lag will produce wrong results
when there is no packet available but network time does not (yet) fall
back to wall clock.
2024-12-09 16:39:38 +01:00
Benjamin Bannier
29a49a59bd Bump pre-commit hooks 2024-12-09 16:14:25 +01:00
Benjamin Bannier
24894febb6 Bump typos pre-commit hooks
This now picks up additional typical misspellings, but also triggers on
more identifiers we use. I opted for fixing the obvious misspellings and
updated the allowlist for anything else.
2024-12-09 16:13:28 +01:00
Benjamin Bannier
97c0df29d4 Bump clang-format pre-commit hooks
This brings in slightly better formatting around uniform initialization,
and comments after blocks not surrounded by `{ .. }`.
2024-12-09 16:12:36 +01:00
Arne Welzel
0ebcd9608f Merge remote-tracking branch 'origin/topic/vern/script-opt-uncompilable-AST'
* origin/topic/vern/script-opt-uncompilable-AST:
  ScriptOpt: Fail compilation if known exprs/stmts is outdated
  skip optimization of functions with AST nodes unknown to script optimization
2024-12-09 14:04:01 +01:00
Arne Welzel
28f76d5da9 ScriptOpt: Fail compilation if known exprs/stmts is outdated 2024-12-09 11:03:20 +01:00
Arne Welzel
99989b8055 Disable CTU-SME test under TSAN 2024-12-09 09:26:42 +01:00
Christian Kreibich
83d16f9ef4 Bump cluster testsuite to pull in Broker backpressure tests 2024-12-07 00:36:45 -08:00
Christian Kreibich
feb2aa890d Expand documentation of Broker events. 2024-12-07 00:36:45 -08:00
Christian Kreibich
e6d0c8aa04 Add sleep() BiF.
Yes, really. :-) We've hit the need for this on occasion in very specific
settings and always worked around it via ugly nested loops or similars.
This has ample warning that folks normally won't want to use this.

Not sure that ZAM btest should baseline the number of BiFs.
2024-12-07 00:36:45 -08:00
Vern Paxson
96305aa4aa BTest baseline updates for compile-to-C++ 2024-12-06 16:30:44 -08:00
Vern Paxson
2047ae980a mark ZAM regression BTests as not suitable for compile-to-C++ 2024-12-06 16:28:06 -08:00
Vern Paxson
de98f1c36c fix for -O gen-C++ maintenance helper to skip BTest intermediary files 2024-12-06 16:26:48 -08:00
Vern Paxson
2e69a8870a introduced simplified initialization for non-standalone -O gen-C++ code
tied -O gen-standalone-C++ to use of --optimize-files
2024-12-06 16:25:22 -08:00
Vern Paxson
612d99e751 streamline generated -O C++ code by relying on per-function profiles rather than aggregate profile 2024-12-06 16:23:32 -08:00
Vern Paxson
79c5790bbf when reporting available/unavailble C++ script bodies, flag those that are skipped 2024-12-06 16:18:43 -08:00
Vern Paxson
62f891dcba modified AST profiling to mark (and fully skip) non-optimizable functions 2024-12-06 16:17:44 -08:00
Vern Paxson
7ed3f79c87 modified merge_types() to skip work if given identical types, which
also preserves type names (useful for -O gen-C++)
2024-12-06 16:16:35 -08:00
zeek-bot
db79c88fb8 Update doc submodule [nomail] [skip ci] 2024-12-07 00:12:05 +00:00
Christian Kreibich
ead6134501 Add backpressure disconnect notification to cluster.log and via telemetry
This adds a Broker-specific script to the cluster framework, loaded only when
Zeek is running in cluster mode. It adds logging in cluster.log as well as
telemetry via a metrics counter for Broker-observed backpressure disconnects.

The new zeek_broker_backpressure_disconnects counter, labeled by the neighboring
peer that the reporting node has determined to be unresponsive, counts the
number of unpeerings for this reason.

Here the node "worker" has observed node "proxy" falling behind once:

# HELP zeek_broker_backpressure_disconnects_total Number of Broker peering drops due to a neighbor falling too far behind in message I/O
# TYPE zeek_broker_backpressure_disconnects_total counter
zeek_broker_backpressure_disconnects_total{endpoint="worker",peer="proxy"} 1

Includes small btest baseline update to reflect @load of a new script.
2024-12-06 15:18:05 -08:00
Christian Kreibich
d260a5b7a9 Remove unneeded @loads from base/misc/version.zeek
This module is loaded by the telemetry framework, which we're now loading via
the cluster framework, i.e. also in bare mode. The resulting additional
thread (for creating reporter.log) trips up a number of btest baselines.

version.zeek doesn't use any of the string helper functions.
2024-12-06 15:18:05 -08:00
Christian Kreibich
46a11ec37d Add Cluster::nodeid_to_node() helper function
This translates backend-specific node identifiers (like Broker IDs) to
cluster nodes and their names, if available.
2024-12-06 15:18:05 -08:00
Christian Kreibich
0010e65f6d Support re-peering with Broker peers that fall behind
This adds re-peering at the Broker level for peers that Broker decided to
unpeer. We keep this at the Broker level since this behavior is specific to
it (as opposed to other cluster backends).

Includes baseline updates for btests that pick up on the new script's @load.
2024-12-06 15:18:05 -08:00
Dominik Charousset
4c4eb4b8e2 Add Zeek-level configurability of Broker slow-peer disconnects 2024-12-06 15:18:05 -08:00
Christian Kreibich
b9df1674b7 Bump Broker to pull in disconnect feature and infinite-loop fix 2024-12-06 15:18:05 -08:00
Christian Kreibich
e81856a4af No need to namespace Cluster:: functions in their own namespace 2024-12-06 15:18:05 -08:00
Tim Wojtulewicz
bbd7f56dcc Add signatures for Python bytecode for 3.8-3.14 2024-12-06 13:45:46 -07:00
Arne Welzel
27517ee4cb Merge remote-tracking branch 'origin/topic/awelzel/4068-http-upgrade-content-type'
* origin/topic/awelzel/4068-http-upgrade-content-type:
  btest/http: Demo StreamEvent analyzer with HTTP::upgrade_analyzers
  protocol: Add StreamEvent analyzer
2024-12-06 17:33:52 +01:00
Arne Welzel
079ae460a7 btest/http: Demo StreamEvent analyzer with HTTP::upgrade_analyzers
Relates to #4068
2024-12-06 16:12:40 +01:00
Arne Welzel
51836d08ae protocol: Add StreamEvent analyzer
This analyzer can be used to transport raw stream data for a given
connection to the script layer. For example, adding this analyzer into
the HTTP::upgrade_analyzer or using it to configure a child WebSocket
analyzer allows to get access to the raw stream data in script land
when no more appropriate protocol analyzer is available.
2024-12-06 16:12:40 +01:00
Arne Welzel
9619cd0f17 Add missing copyright line to headers and cc files 2024-12-06 12:50:58 +01:00
Arne Welzel
d93249eeab pre-commit: Add license-header check inspired by Spicy 2024-12-06 12:50:58 +01:00
Arne Welzel
4958c56c84 Add missing "COPYING" in file comments
This was just done via sed. There's a number of files that don't
have a license entry at all.
2024-12-06 11:55:46 +01:00
Arne Welzel
2f27db6542 Merge remote-tracking branch 'origin/topic/vern/zam-assert-fix'
* origin/topic/vern/zam-assert-fix:
  fix for ZAM "assert" statements potentially evaluating invalid expressions
2024-12-06 10:22:24 +01:00
zeek-bot
a1776540f4 Update doc submodule [nomail] [skip ci] 2024-12-06 00:22:21 +00:00
Vern Paxson
e6e31bc25a fix for ZAM "assert" statements potentially evaluating invalid expressions 2024-12-05 14:29:06 -08:00
Tim Wojtulewicz
682789a8e9 Merge remote-tracking branch 'origin/topic/awelzel/deprecate-tcp-reassembler-ports'
* origin/topic/awelzel/deprecate-tcp-reassembler-ports:
  init-bare: Deprecate tcp_reassembler_ports
2024-12-05 13:48:57 -07:00
Arne Welzel
93a3a11d36 Merge remote-tracking branch 'origin/topic/vern/script-opt-keep-asserts'
* origin/topic/vern/script-opt-keep-asserts:
  ZAM documentation updates for asserts and event handler run-time errors
  BTest updates for ZAM support of (optionally) keeping "assert" statements
  command-line options for controlling script optimization: keeping asserts, avoiding event handler coalescence
  ZAM support for option to not coalesce event handlers
  ZAM support for keeping "assert" statements
  internal support for script optimization options for keeping asserts, not consolidating event handlers
  ZAM operations to support asserts
  simplified "assert" by not trying to catch messages that themselves have errors

Fixed some TEST-REQUIRES "${ZEEK_ZAM}" == "1" to use "=" instead to
be /bin/sh compatible.
2024-12-05 21:45:07 +01:00
Arne Welzel
9efa12b055 Merge remote-tracking branch 'origin/topic/vern/ZAM-empty-hook-opt'
* origin/topic/vern/ZAM-empty-hook-opt:
  ZAM optimization now removes hook calls to hooks without any bodies
2024-12-05 19:12:59 +01:00
Tim Wojtulewicz
488ac7ddf0 Merge remote-tracking branch 'origin/topic/vern/zam-pattern-comparison'
* origin/topic/vern/zam-pattern-comparison:
  update of BTest that tracks number of (and validates) ZAM operations
  ZAM support for pattern equality/inequality operations
  expanded ZAM operations for bit-shifting to allow for int/count shift values
  added type coercion for bit-shifting expressions
2024-12-05 11:09:15 -07:00
Arne Welzel
e773fe0506 init-bare: Deprecate tcp_reassembler_ports
...and remove from NetVar, seems left-over.
2024-12-05 16:18:11 +01:00
Arne Welzel
6482a9a8c2 Merge remote-tracking branch 'origin/topic/awelzel/ctu-sme-11-vm-win7ad'
* origin/topic/awelzel/ctu-sme-11-vm-win7ad:
  zeek-testing: Add Experiment-VM-Microsoft-Windows7AD-1 PCAP and baselines
2024-12-05 14:52:14 +01:00
zeek-bot
55929e5acd Update doc submodule [nomail] [skip ci] 2024-12-05 00:19:43 +00:00
Vern Paxson
678db505fb update of BTest that tracks number of (and validates) ZAM operations 2024-12-04 15:26:13 -07:00
Vern Paxson
f300fb6cf0 ZAM support for pattern equality/inequality operations 2024-12-04 15:25:31 -07:00
Vern Paxson
7d25835ca8 expanded ZAM operations for bit-shifting to allow for int/count shift values 2024-12-04 15:24:11 -07:00
Vern Paxson
01fe72d9fc added type coercion for bit-shifting expressions 2024-12-04 15:23:44 -07:00
Arne Welzel
df5a6a1ea0 zeek-testing: Add Experiment-VM-Microsoft-Windows7AD-1 PCAP and baselines
The pcap comes from the following dataset [1]:

    CTU-SME-11: a labeled dataset with real benign and malicious network
    traffic mimicking a small medium-size enterprise environment

[1] https://zenodo.org/records/7958259
2024-12-04 20:12:30 +01:00
Arne Welzel
a44cafafe7 Merge remote-tracking branch 'origin/topic/awelzel/pluggable-cluster-backends-part3'
* origin/topic/awelzel/pluggable-cluster-backends-part3:
  init-bare/zeek-setup: Groundwork for instantiating cluster backends
  cluster/serializer: Add binary-serialization-format
  logging/WriterFrontend: Add logic for non-broker cluster backends
  logging/WriterBackend: Include logging/Types.h
  logging/Manager: Implement new WriteBatchFromRemote()
  logging/WriterFrontend: Add LogWriteHeader as member
  logging: Add filter_name to WriterInfo
2024-12-04 13:47:49 +01:00
Arne Welzel
b3080f2652 init-bare/zeek-setup: Groundwork for instantiating cluster backends 2024-12-04 12:40:35 +01:00
Arne Welzel
fdde1e9841 cluster/serializer: Add binary-serialization-format
This is a serializer for log records that is using SerialTypes
for serializing and un-serializing rather. Essentially, this is
similar to what broker does except for the envelope.
2024-12-04 12:40:35 +01:00
Arne Welzel
10d93eff36 logging/WriterFrontend: Add logic for non-broker cluster backends
If cluster::backend isn't broker_mgr, use the WriterFrontend's buffering
logic and send a whole batch of log writes during FlushWriteBuffer().
This is a different path than broker's own logging logic.

Preferably we adapt broker to a model where it isn't
buffering either.
2024-12-04 12:40:35 +01:00
Arne Welzel
15ea8a3be9 logging/WriterBackend: Include logging/Types.h 2024-12-04 12:40:35 +01:00
Arne Welzel
ab1d48c95a logging/Manager: Implement new WriteBatchFromRemote() 2024-12-04 12:40:35 +01:00
Arne Welzel
3dd1f8d38a logging/WriterFrontend: Add LogWriteHeader as member
The header captures the enum values as well as the fields
2024-12-04 12:37:22 +01:00
Arne Welzel
f5d4526eac logging: Add filter_name to WriterInfo
...with this change, it'll be possible to identify WriterFrontend's
based on (stream, filter_name, path) pairs in addition to (stream,
writer, path) pairs.
2024-12-04 12:37:22 +01:00
Arne Welzel
2c52e533b2 Merge remote-tracking branch 'origin/topic/awelzel/spicy-type-convert-asan-options'
* origin/topic/awelzel/spicy-type-convert-asan-options:
  btest/spicy.type-converter: Drop ASAN_OPTIONS from test
2024-12-04 11:14:10 +01:00
Arne Welzel
a2cf0d874a btest/spicy.type-converter: Drop ASAN_OPTIONS from test
...doesn't seem it's needed anymore.

Fixes #4077
2024-12-04 11:11:47 +01:00
Arne Welzel
067c40a545 Merge remote-tracking branch 'origin/topic/neverlord/broker-cleanup'
* origin/topic/neverlord/broker-cleanup:
  Remove obsolete c_str_safe utility
  Remove obsolete Broker compatibility layer
2024-12-04 11:08:08 +01:00
zeek-bot
2ef57aaea1 Update doc submodule [nomail] [skip ci] 2024-12-04 00:23:36 +00:00
Vern Paxson
0fda589a19 ZAM optimization now removes hook calls to hooks without any bodies 2024-12-03 12:47:20 -07:00
Vern Paxson
0775719342 ZAM documentation updates for asserts and event handler run-time errors 2024-12-03 10:59:47 -07:00
Vern Paxson
47a555da87 BTest updates for ZAM support of (optionally) keeping "assert" statements 2024-12-03 10:40:41 -07:00
Vern Paxson
aa9c0a99b0 command-line options for controlling script optimization: keeping asserts,
avoiding event handler coalescence
2024-12-03 10:38:31 -07:00
Vern Paxson
c523684cc4 ZAM support for option to not coalesce event handlers 2024-12-03 10:38:05 -07:00
Vern Paxson
908e8a3a27 ZAM support for keeping "assert" statements 2024-12-03 10:37:38 -07:00
Vern Paxson
a328185a8f internal support for script optimization options for keeping asserts, not
consolidating event handlers
2024-12-03 10:35:35 -07:00
Vern Paxson
8b1790019a ZAM operations to support asserts 2024-12-03 10:34:56 -07:00
Tim Wojtulewicz
deb2acaeda Merge remote-tracking branch 'origin/topic/timw/json-interval-conversion'
* origin/topic/timw/json-interval-conversion:
  Add interval_as_double argument to control how intervals are converted to JSON
  Add btest for round-trip JSON conversion
  Allow comparing two PatternVals
  Handle conversion between data from Val::ToJSON and ValFromJSON better
2024-12-03 10:10:37 -07:00
Dominik Charousset
feeb06f7cf Remove obsolete c_str_safe utility
The old `c_str_safe` utility function allowed Zeek to operator on
`broker::data` and `broker::variant`. The former grants access to actual
`std::string` objects while the latter only provides access to fields
via `std::string_view`. Since the Zeek formatting functions need null
terminated strings, we need to copy the characters into a
null-terminated container first.

After removing support for `broker::data` and `broker::variant` from the
same code paths, we can drop `c_str_safe` and always do the copying
(since we are always dealing with `broker::variant` now).
2024-12-03 17:26:23 +01:00
Tim Wojtulewicz
43e3de5c79 Add interval_as_double argument to control how intervals are converted to JSON 2024-12-03 09:26:08 -07:00
Tim Wojtulewicz
8ff10e4d21 Add btest for round-trip JSON conversion 2024-12-03 09:26:08 -07:00
Tim Wojtulewicz
7670a6f589 Allow comparing two PatternVals 2024-12-03 09:26:08 -07:00
Tim Wojtulewicz
9f5cd54e78 Handle conversion between data from Val::ToJSON and ValFromJSON better 2024-12-03 09:26:08 -07:00
Dominik Charousset
470f545b37 Remove obsolete Broker compatibility layer
Since the transition to broker::variant has been long finalized, there
is no more need to be able to go back to a pre-variant version of
Broker. Hence, we can drop various utilities that allow Zeek to run with
older Broker releases.
2024-12-03 17:21:19 +01:00
Vern Paxson
05e913db1b simplified "assert" by not trying to catch messages that themselves have errors 2024-12-02 10:37:10 -08:00
Arne Welzel
d2ecdc2a11 Merge remote-tracking branch 'origin/topic/vern/ZAM-cluster-bifs'
* origin/topic/vern/ZAM-cluster-bifs:
  added new Cluster:: BiFs to script optimization tracking
2024-12-02 13:43:36 +01:00
Arne Welzel
731dd4cabe Merge remote-tracking branch 'origin/topic/vern/location-for-ZAM-vector-mismatch2'
* origin/topic/vern/location-for-ZAM-vector-mismatch2:
  added locations to ZAM run-time errors about vector size mismatches
2024-12-02 13:43:15 +01:00
Arne Welzel
423c2de4c8 Merge remote-tracking branch 'origin/topic/vern/dump-no-opt-ZAM'
* origin/topic/vern/dump-no-opt-ZAM:
  fixed -O dump-final-ZAM to work in conjunction with -O no-ZAM-opt
2024-12-02 10:59:16 +01:00
Benjamin Bannier
f1bb009e44 Merge branch 'topic/bbannier/bump-spicy' 2024-12-02 10:35:34 +01:00
Vern Paxson
2a9c1d900f added new Cluster:: BiFs to script optimization tracking 2024-11-30 08:36:39 -08:00
Vern Paxson
35e157a0ab skip optimization of functions with AST nodes unknown to script optimization 2024-11-29 16:12:05 -08:00
Vern Paxson
67f256e87a added locations to ZAM run-time errors about vector size mismatches 2024-11-29 08:13:12 -08:00
Vern Paxson
5feadf5d69 fixed -O dump-final-ZAM to work in conjunction with -O no-ZAM-opt 2024-11-28 16:36:28 -08:00
Benjamin Bannier
730316fc8a Remove support for building against Spicy versions before 1.8
zeek-6.0 shipped with spicy-1.8, but we still have dedicated handling
for earlier versions of Spicy in the code. This patch cleans them up
since these versions are unsupported.
2024-11-28 15:26:15 +01:00
Benjamin Bannier
0c55fb4dd7 Bump auxil/spicy to latest development snapshot 2024-11-28 15:26:15 +01:00
zeek-bot
a2a47ba334 Update doc submodule [nomail] [skip ci] 2024-11-28 00:11:24 +00:00
Tim Wojtulewicz
8d625715ca Merge remote-tracking branch 'origin/topic/johanna/jq-guard'
* origin/topic/johanna/jq-guard:
  Add TEST-REQUIRES: which jq to two new tests that are using jq
2024-11-27 12:31:59 -07:00
Johanna Amann
079581aa6b Add TEST-REQUIRES: which jq to two new tests that are using jq 2024-11-27 16:52:15 +00:00
Johanna Amann
e52bad6192 Merge remote-tracking branch 'origin/topic/johanna/modbus-test-comment'
* origin/topic/johanna/modbus-test-comment:
  Explain why modbus test does not work with the Spicy SSL analyzer
2024-11-27 15:52:51 +00:00
Johanna Amann
3523d393bf Explain why modbus test does not work with the Spicy SSL analyzer
This took a _long_ time to figure out.
2024-11-27 14:51:26 +00:00
Johanna Amann
7b582bc345 Merge remote-tracking branch 'origin/topic/johanna/sqlite-pragmas'
* origin/topic/johanna/sqlite-pragmas:
  Options for SQLite log writer, eliminate duplicate definitions
  Test synchronous/journal mode options for SQLite log writer
  Added default options for synchronous and journal mode
  Support for synchronous and journal_mode
2024-11-27 08:32:08 +00:00
zeek-bot
9e62c31421 Update doc submodule [nomail] [skip ci] 2024-11-27 00:23:50 +00:00
Arne Welzel
3ce41f1eff Merge remote-tracking branch 'origin/topic/awelzel/pluggable-cluster-backends-part2'
* origin/topic/awelzel/pluggable-cluster-backends-part2:
  ci/test.sh: Run doctest with TZ=UTC
  cluster/setup-connections: Switch to Cluster::subscribe(), short-circuit broker
  cluster/serializer: Add Broker based event serializers
  cluster: Add Cluster scoped bifs
  Reporter: Add ScriptLocationScope helper
  init-bare/zeek-setup: Add Cluster::backend const &redef
  broker: Implement cluster::Backend interface
  Broker: Fix some error messages
  broker: Remove MakeEvent(ArgsSpan)
2024-11-26 18:01:28 +01:00
Johanna Amann
35ad35ad0f Options for SQLite log writer, eliminate duplicate definitions
Patch provided by Arne Welzel, see GH-4063
2024-11-26 16:31:13 +00:00
Johanna Amann
35acbbfd03 Update 3dparty submodule
[nomail]
2024-11-26 16:28:54 +00:00
Arne Welzel
c3b30b187e Merge remote-tracking branch 'origin/topic/vern/zam-exception-leaks'
* origin/topic/vern/zam-exception-leaks:
  More robust memory management for ZAM execution - fixes #4052
2024-11-26 17:17:10 +01:00
Vern Paxson
847fcc66d6 More robust memory management for ZAM execution - fixes #4052 2024-11-26 17:05:38 +01:00
Johanna Amann
dec9eeafbd Merge remote-tracking branch 'origin/topic/johanna/sqlite3.47.1'
* origin/topic/johanna/sqlite3.47.1:
  Update SQLite to 3.47.1
2024-11-26 14:57:07 +00:00
Arne Welzel
f65c4f0b7e Merge remote-tracking branch 'origin/topic/awelzel/deprecate-val-list-to-args'
* origin/topic/awelzel/deprecate-val-list-to-args:
  ZeekArgs: Deprecate val_list_to_args()
2024-11-26 15:25:25 +01:00
Johanna Amann
d592942ccb Test synchronous/journal mode options for SQLite log writer
Also adds some small tweaks and adds the new feature to NEWS.
2024-11-26 12:26:38 +00:00
Arne Welzel
3de52c27e0 ci/test.sh: Run doctest with TZ=UTC
Broker's JSON serialization is TZ dependent (which seems a bug). For now
do the same as we do in btest.cfg and run doctests with TZ set to UTC.

Reported in zeek/broker#434.
2024-11-26 12:58:23 +01:00
Arne Welzel
fc12be1f17 cluster/setup-connections: Switch to Cluster::subscribe(), short-circuit broker
For the time being, this is easiest, otherwise we'd need to
conditionally load a broker-specific policy script based on
Cluster::backend being set.
2024-11-26 12:58:23 +01:00
Arne Welzel
9ec872d161 cluster/serializer: Add Broker based event serializers
This adds the first event serializers that use
broker functionality. Binary and JSON formats.
2024-11-26 12:58:23 +01:00
Arne Welzel
ef04a199c8 cluster: Add Cluster scoped bifs
... and a broker based test using Cluster::publish() and
Cluster::subscribe().
2024-11-26 12:58:23 +01:00
Arne Welzel
27e6d87331 Reporter: Add ScriptLocationScope helper 2024-11-26 12:13:14 +01:00
Arne Welzel
c7c96610e3 init-bare/zeek-setup: Add Cluster::backend const &redef 2024-11-26 12:13:14 +01:00
Arne Welzel
68a391d767 broker: Implement cluster::Backend interface 2024-11-26 12:13:14 +01:00
Arne Welzel
91a8fd0c63 Broker: Fix some error messages 2024-11-26 12:12:48 +01:00
Arne Welzel
a233b50be1 broker: Remove MakeEvent(ArgsSpan)
This was added previously in the 7.1 cycle. Now that MakeEvent() was
removed from cluster::Backend, there's no need for Broker to provide
this version.
2024-11-26 12:12:48 +01:00
Mymaqn
3ca56f7e0f Added default options for synchronous and journal mode
Added enum options SQLITE_SYNCHRONOUS_DEFAULT and SQLITE_JOURNAL_MODE_DEFAULT
and changed the default to be these instead.
2024-11-26 11:08:30 +00:00
Mymaqn
6e026ba313 Support for synchronous and journal_mode 2024-11-26 11:08:18 +00:00
Johanna Amann
fb864ab9b4 Update SQLite to 3.47.1 2024-11-26 11:04:40 +00:00
zeek-bot
a1d64ad6ae Update doc submodule [nomail] [skip ci] 2024-11-23 00:20:35 +00:00
Arne Welzel
40a780bb24 Merge remote-tracking branch 'origin/topic/awelzel/test-init-hooks-plugin'
* origin/topic/awelzel/test-init-hooks-plugin:
  btest/plugins: Add a plugin testing Init and Done hooks
2024-11-22 18:38:06 +01:00
Arne Welzel
542640db00 Merge remote-tracking branch 'origin/topic/awelzel/skip-core-expr-error'
* origin/topic/awelzel/skip-core-expr-error:
  Disable core.expr-execption btest under ZAM to fix CI builds
2024-11-22 15:29:48 +01:00
Tim Wojtulewicz
24d913c0a9 Disable core.expr-execption btest under ZAM to fix CI builds
Relates to #4052.
2024-11-22 15:28:14 +01:00
Arne Welzel
39b43e8dd6 btest/plugins: Add a plugin testing Init and Done hooks
Follow-up for #4047.
2024-11-22 13:37:03 +01:00
Arne Welzel
97f05b2f8c Merge remote-tracking branch 'origin/topic/awelzel/pluggable-cluster-backends-part1'
* origin/topic/awelzel/pluggable-cluster-backends-part1:
  btest: Test Broker::make_event() together with Cluster::publish_hrw()
  btest: Add cluster dir, minimal test for enum value
  broker: Add shim plugin adding a backend component
  zeek-setup: Instantiate backend::manager
  cluster: Add to src/CMakeLists.txt
  cluster: Add Components and ComponentManager for new components
  cluster/Backend: Interface for cluster backends
  cluster/Serializer: Interface for event and log serializers
  logging: Introduce logging/Types.h
  SerialTypes/Field: Allow default construction and add move constructor
  DebugLogger: Add cluster debugging stream
  plugin: Add component enums for pluggable cluster backends
  broker: Pass frame to MakeEvent()
2024-11-22 12:53:23 +01:00
Arne Welzel
baca6ba769 btest: Test Broker::make_event() together with Cluster::publish_hrw() 2024-11-22 10:43:55 +01:00
Arne Welzel
de9d39cd01 btest: Add cluster dir, minimal test for enum value 2024-11-22 10:43:55 +01:00
Arne Welzel
6fb73aa9da broker: Add shim plugin adding a backend component
For broker, this isn't really functioning, but at least makes the
CLUSTER_BACKEND_BROKER enum available.
2024-11-22 10:43:55 +01:00
Arne Welzel
60b5cf9730 zeek-setup: Instantiate backend::manager
Required to allow registration of cluster components.
2024-11-22 10:43:55 +01:00
Arne Welzel
ac9594ffae cluster: Add to src/CMakeLists.txt 2024-11-22 10:43:55 +01:00
Arne Welzel
23ca625c03 cluster: Add Components and ComponentManager for new components 2024-11-22 10:43:54 +01:00
Arne Welzel
fb23a06f6f cluster/Backend: Interface for cluster backends 2024-11-22 10:43:50 +01:00
Arne Welzel
e94e30616d cluster/Serializer: Interface for event and log serializers 2024-11-22 10:06:59 +01:00
Arne Welzel
a946b27faf logging: Introduce logging/Types.h
Header and implementation for types shared between the cluster and
logging framework. The logging framework will be adapted later to
use these. For now, the new cluster components will simply reference
them.
2024-11-22 10:06:59 +01:00
Arne Welzel
60fb212f17 SerialTypes/Field: Allow default construction and add move constructor
This is in preparation of using SerialTypes to serialize and
unserialize complete log batches which include Field instances
and not just Value's.
2024-11-22 10:06:59 +01:00
Arne Welzel
d2633163bd DebugLogger: Add cluster debugging stream 2024-11-22 10:06:59 +01:00
Arne Welzel
35eadf0ceb plugin: Add component enums for pluggable cluster backends 2024-11-22 10:06:59 +01:00
Arne Welzel
349d88153f broker: Pass frame to MakeEvent()
This was lost in a prior change.
2024-11-22 10:06:59 +01:00
zeek-bot
66aec5ba2f Update doc submodule [nomail] [skip ci] 2024-11-22 00:20:09 +00:00
Arne Welzel
9883b3a917 Merge remote-tracking branch 'origin/topic/awelzel/sumstats-non-cluster-final-epoch'
* origin/topic/awelzel/sumstats-non-cluster-final-epoch:
  sumstat/non-cluster: Move last epoch processing to zeek_done()
2024-11-21 16:39:18 +01:00
Arne Welzel
94ffcd6535 Merge remote-tracking branch 'origin/topic/awelzel/plugin-init-pre-execution'
* origin/topic/awelzel/plugin-init-pre-execution:
  plugin: Add InitPreExecution()
2024-11-21 14:41:14 +01:00
Arne Welzel
aac640ebff Merge remote-tracking branch 'origin/topic/awelzel/bump-zeekjs-0-14-0'
* origin/topic/awelzel/bump-zeekjs-0-14-0:
  Bump zeekjs to v0.14.0
2024-11-21 10:22:44 +01:00
Arne Welzel
4b2fbfb57c Bump zeekjs to v0.14.0
79b0c21 version: 0.14.0
    b75b384 docker: Use Fedora 41 packages
    d65cbc8 Minor header cleanup
    4fd7e8b scripts: Remove __preload__.zeek and types.zeek
    93a8113 CreateEnvironment: Unset kOwnsProcessState and kOwnsInspector
    3b1f5d3 Instance::Init(): Replace parameters with Options struct
2024-11-21 10:15:33 +01:00
Arne Welzel
b996f87e75 ZeekArgs: Deprecate val_list_to_args()
Fly-by deprecation for something that isn't used in-tree anymore.
2024-11-21 09:30:57 +01:00
zeek-bot
eb76da1aa2 Update doc submodule [nomail] [skip ci] 2024-11-21 00:10:29 +00:00
Benjamin Bannier
4a96d34af6 Merge remote-tracking branch 'origin/topic/bbannier/doc-have-spicy' 2024-11-20 09:34:10 +01:00
Benjamin Bannier
a65598ff20 Fix documentation for have_spicy [skip CI]
The continued line was incorrectly marked up (as a plain comment instead
of a Zeekygen comment) which caused only half of the docstring to be
rendered by Zeekygen.
2024-11-19 21:04:35 +01:00
Arne Welzel
6e916efe8d Merge remote-tracking branch 'origin/topic/awelzel/bump-zeekjs-0-13-2'
* origin/topic/awelzel/bump-zeekjs-0-13-2:
  Bump zeekjs to 0.13.2
2024-11-19 19:17:48 +01:00
Tim Wojtulewicz
d9a74680e0 Merge remote-tracking branch 'origin/topic/timw/speed-up-zam-ci-testing'
* origin/topic/timw/speed-up-zam-ci-testing:
  CI: Use test.sh script for running ZAM tests, but disable parts of it
2024-11-19 10:53:21 -07:00
Tim Wojtulewicz
ead3a625f8 CI: Use test.sh script for running ZAM tests, but disable parts of it
This ensures that the normal test setup is run, which enables greedy
mode on Cirrus allowing us to over-provision the testing. This should
help speed up the ZAM builds a bit.
2024-11-19 10:52:44 -07:00
Arne Welzel
f15c49c334 Bump zeekjs to 0.13.2
41ec748 cmake: Use foreach range
    2b90a56 tests: Update new-event to run with 7.1+, remove ip_proto elsewhere
    a596f6f Makefile: Update outdated commands
    b954661 Enable `cmake/FindNodejs.cmake` to find more libnode versions
2024-11-19 18:51:37 +01:00
Christian Kreibich
96273b4550 Merge branch 'topic/christian/fix-rulematcher-iteration'
* topic/christian/fix-rulematcher-iteration:
  Order rule traversal in RuleMatcher::Match() operations by Rule index
2024-11-18 10:13:18 -08:00
Christian Kreibich
b24c5c0e46 Order rule traversal in RuleMatcher::Match() operations by Rule index
This ordering fixes a test failure we're seeing on Alpine for the
signatures/tcp-end-of-match btest, since discrepancies in rule match traversal
could lead to discrepancies in corresponding event ordering.

It looks safe to rely on across platforms since the index is driven by signature
load order, which shouldn't deviate. If this somehow doesn't hold in the future,
we'll only wind up with a test failure, not incorrect match behavior.

(Correction to 2e03fbb8b0, which I pushed
accidentally.)
2024-11-18 09:45:09 -08:00
Christian Kreibich
5e0e2a8bd8 Merge branch 'topic/christian/fix-rulematcher-iteration'
* topic/christian/fix-rulematcher-iteration:
  Define ordering on Rule instances and use on sets in RuleMatcher
2024-11-18 09:39:22 -08:00
Arne Welzel
7ae52ea4d2 Merge remote-tracking branch 'origin/topic/awelzel/zam-baseline-updates'
* origin/topic/awelzel/zam-baseline-updates:
  communityid: Use GetField() over GetFieldAs()
  btest/Baseline.zam: Updates for proto addition
2024-11-18 17:28:37 +01:00
Arne Welzel
91f5945f92 sumstat/non-cluster: Move last epoch processing to zeek_done()
@Sheco reported that standalone epoch processing may exclude scheduled
events when the final sumstat epoch runs before. For example, this easily
happens when attempting to do sumstat observations within connection_state_remove().

Delay final epoch processing to zeek_done() instead.

This doesn't deal with the clustered version - this would need something
more elaborate and potentially a mechanism to delay the shutdown of
other cluster nodes until/after sumstat processing completed.
2024-11-18 15:58:01 +01:00
Arne Welzel
993cdd03e0 plugin: Add InitPreExecution()
Currently, plugins do not have a way to further inspect or even mutate
script functions after ZAM optimization ran. One use-case here is
zeek-perf-support [1]. This plugin wraps Stmt instances of functions,
events and hooks hooks with a small assembly stub to support JIT map
files [2] and for integration with perf tools.

This change introduces a new InitPreExecution() hook that runs after
ZAM optimization completed, just before the zeek_init() event is enqueued.

Additionally, remove the existing CPP_activation_hook. It doesn't seem
to be used. If it becomes necessary in the future, the new
InitPreExecution() hook can be leveraged instead.

[1] https://github.com/zeek/zeek-perf-support
[2] https://github.com/torvalds/linux/blob/master/tools/perf/Documentation/jit-interface.txt
2024-11-18 13:53:56 +01:00
Tim Wojtulewicz
62bc324fe1 Merge remote-tracking branch 'origin/topic/christian/debug-stream-tweaks'
* origin/topic/christian/debug-stream-tweaks:
  Make debug stream names use "-", and handle "_" transparently
  Make "-B all" apply to plugin streams as well.
  Sort streams in "-B help" output, and match case-insensitively throughout
2024-11-16 09:34:42 -07:00
Christian Kreibich
26cc378471 Merge branch 'topic/timw/avoid-unknown-ip-transport-weirds'
* topic/timw/avoid-unknown-ip-transport-weirds:
  Don't forward out of the unknown IP transport analyzer
2024-11-15 19:08:33 -08:00
Christian Kreibich
b1e0e26484 Make debug stream names use "-", and handle "_" transparently
This looks consistent, and doesn't break any existing uses with underscores.
2024-11-15 17:53:29 -08:00
Tim Wojtulewicz
5c1c592554 Don't forward out of the unknown IP transport analyzer
We already accept that the packets coming into this analyzer won't
be processed, so forwarding out of it will just result in a failure.
Forwarding will also report a weird for every packet which just
results in extra noise.
2024-11-15 16:54:53 -07:00
Tim Wojtulewicz
bb2456129a Merge remote-tracking branch 'origin/topic/timw/ip-proto-btests'
* origin/topic/timw/ip-proto-btests:
  The cisco-fabric-path pcap used in tests doesn't need the -C argument
  Add btests for ip_proto policy files
2024-11-15 16:51:15 -07:00
Tim Wojtulewicz
d30f480ca9 The cisco-fabric-path pcap used in tests doesn't need the -C argument 2024-11-15 16:50:10 -07:00
Tim Wojtulewicz
fbaf438a1d Add btests for ip_proto policy files 2024-11-15 16:49:10 -07:00
Christian Kreibich
7563af4906 Make "-B all" apply to plugin streams as well. 2024-11-15 13:53:06 -08:00
Christian Kreibich
5e4942bcc0 Sort streams in "-B help" output, and match case-insensitively throughout
Matching of plugins' debug streams was still case-sensitive. Also contains some
minor output tweaks.

It'd be nice to only list plugin debug streams actually _used_ by plugins. I
didn't see a quick way to do that so that's for another time.
2024-11-15 12:50:13 -08:00
Arne Welzel
2125a1f558 Merge remote-tracking branch 'origin/topic/awelzel/log-broker-io-telemetry-rules-includes'
* origin/topic/awelzel/log-broker-io-telemetry-rules-includes:
  zeek-setup: Remove some unused headers
  clang-format: Sort doctest header at the bottom
  RuleMatcher: Move plugin/Manager.h include from .h to .cc
  iosource/Manager: Remove superflous includes
  telemetry/Manager: Remove broker header include, add fnmatch.h
  logging/Manager: Fix using filename from input.h in debug log
2024-11-15 17:40:40 +01:00
Arne Welzel
a75ade222b communityid: Use GetField() over GetFieldAs()
GetFieldAs() does not initialize an optional or default field. Apparently,
for ZAM that makes a difference, possibly the [] record construction is
optimized, not initializing proto until actually accessed. Not quite
sure why that's not happening for classic script interpretation
though.
2024-11-15 17:38:53 +01:00
Arne Welzel
173e6683f5 btest/Baseline.zam: Updates for proto addition 2024-11-15 17:36:49 +01:00
Arne Welzel
a46387075c zeek-setup: Remove some unused headers
The zeek_binpac.h one isn't used directly, but keeping it over
<binpac.h> include. Also do some std prefixing. binpac.h has
'using namespace std', so these slip through :-(
2024-11-15 17:00:02 +01:00
Arne Welzel
0f1c1cb754 clang-format: Sort doctest header at the bottom 2024-11-15 17:00:00 +01:00
Arne Welzel
a02ae82778 RuleMatcher: Move plugin/Manager.h include from .h to .cc 2024-11-15 16:00:23 +01:00
Arne Welzel
c380ee68ca iosource/Manager: Remove superflous includes 2024-11-15 15:55:46 +01:00
Arne Welzel
da291272f9 telemetry/Manager: Remove broker header include, add fnmatch.h 2024-11-15 15:55:42 +01:00
Arne Welzel
65037fa822 logging/Manager: Fix using filename from input.h in debug log
...and remove network_time, it's always included.
2024-11-15 15:46:24 +01:00
Christian Kreibich
2e03fbb8b0 Define ordering on Rule instances and use on sets in RuleMatcher
Establishing reliable ordering fixes a test failure we're seeing on Alpine for
the signatures/tcp-end-of-match btest, since discrepancies in rule match
traversal could lead to discrepancies in corresponding event ordering.
2024-11-14 20:03:07 -08:00
zeek-bot
b4ddf73e22 Update doc submodule [nomail] [skip ci] 2024-11-15 00:22:21 +00:00
Arne Welzel
42cf86b503 Update external commit hashes 2024-11-14 14:37:05 +01:00
Arne Welzel
8ff49f9910 Merge remote-tracking branch 'origin/topic/awelzel/communityid-non-tcp-udp-icmp'
* origin/topic/awelzel/communityid-non-tcp-udp-icmp:
  communityid: Do not include ports for non TCP, UDP, ICMP
2024-11-14 14:21:36 +01:00
Arne Welzel
18bfdb8a2b Merge remote-tracking branch 'origin/topic/awelzel/deprecate-broker-auto-publish'
* origin/topic/awelzel/deprecate-broker-auto-publish:
  sumstats: Remove copy() for Broker::publish() calls
  broker/Publish: Use event time instead of network time
  broker/Eventhandler: Deprecate Broker::auto_publish() for v8.1
  btest: Remove Broker::auto_publish() usages
  frameworks/control: Remove Broker::auto_publish()
  catch-and-release: Remove Broker::auto_publish()
  ssl/validate-certs: Remove Broker::auto_publish()
  sumstats: Remove Broker::auto_publish()
  cluster_started: No Broker::auto_publish() use
  openflow: Remove Broker::auto_publish()
  dhcp: Remove Broker::auto_publish()
  frameworks/notice: Remove Broker::auto_publish()
  netcontrol: Replace Broker::auto_publish()
  intel: Switch to Cluster::publish()
  broker: Support publish() of unspecified set() / table()
  types: Fix table() resulting in table_type->IsSet() == true
2024-11-14 14:17:13 +01:00
Arne Welzel
aabc4a4114 sumstats: Remove copy() for Broker::publish() calls
Serialization happens immediately at Broker::publish() time, there
should be no caching issues.
2024-11-14 12:59:22 +01:00
Arne Welzel
831614f907 broker/Publish: Use event time instead of network time
Discussed with @J-Gras, calling Broker::publish() within a scheduled
should use the "intended timestamp" implicitly.

This is subtle, but supposedly more expected when running
a pcap replay cluster.
2024-11-14 12:59:22 +01:00
Arne Welzel
6abb9d7eda broker/Eventhandler: Deprecate Broker::auto_publish() for v8.1
Relates to #3637
2024-11-14 12:59:22 +01:00
Arne Welzel
455e05bc2e btest: Remove Broker::auto_publish() usages
The ones that seemed to test Broker::auto_publish() were annotated
for removal.
2024-11-14 12:59:22 +01:00
Arne Welzel
927e936653 frameworks/control: Remove Broker::auto_publish() 2024-11-14 12:59:22 +01:00
Arne Welzel
6aca4d1dc7 catch-and-release: Remove Broker::auto_publish() 2024-11-14 12:59:22 +01:00
Arne Welzel
44c4a91cc8 ssl/validate-certs: Remove Broker::auto_publish() 2024-11-14 12:59:22 +01:00
Arne Welzel
883ae3694c sumstats: Remove Broker::auto_publish() 2024-11-14 12:59:22 +01:00
Arne Welzel
416887157c cluster_started: No Broker::auto_publish() use 2024-11-14 12:59:22 +01:00
Arne Welzel
b32153037a openflow: Remove Broker::auto_publish() 2024-11-14 12:59:22 +01:00
Arne Welzel
cb10852f99 dhcp: Remove Broker::auto_publish()
This isn't prettier, but neither worse IMO. A test would be good.
2024-11-14 12:59:22 +01:00
Arne Welzel
08f2198d3e frameworks/notice: Remove Broker::auto_publish() 2024-11-14 12:59:22 +01:00
Arne Welzel
b05f7a4d0e communityid: Do not include ports for non TCP, UDP, ICMP
Checked against the result of pycommunityid. The SCTP case
isn't quite right, because Zeek's core will not have extracted
any ports for SCTP.
2024-11-14 11:05:43 +01:00
Christian Kreibich
af4c21763f Merge branch 'topic/christian/ci-updates'
* topic/christian/ci-updates:
  CI: Use FEDORA40 crypto policy in Fedora 41
  Bump zeekjs to 0.13.0
  CI: bump FreeBSD 13 to 13.4, released in September
  CI: drop Fedora 39, add 41
2024-11-13 17:29:23 -08:00
Johanna Amann
09d6be7f68 CI: Use FEDORA40 crypto policy in Fedora 41
Fedora 41 distrusts SHA-1 signatures by default. Switching to this policy is
Fedora's recommended way of re-enabling support for at least the next several
releases.

A few references:

https://fedoraproject.org/wiki/Changes/OpenSSLDistrustSHA1SigVer
https://fedoraproject.org/wiki/SHA1SignaturesGuidance
https://www.redhat.com/en/blog/rhel-security-sha-1-package-signatures-distrusted-rhel-9
2024-11-13 17:05:08 -08:00
zeek-bot
ba0e8290ed Update doc submodule [nomail] [skip ci] 2024-11-14 00:24:48 +00:00
Tim Wojtulewicz
3c08c57be3 Merge remote-tracking branch 'origin/topic/timw/3915-unknown-ip-protocol'
* origin/topic/timw/3915-unknown-ip-protocol:
  Add NEWS entry for ip_proto feature
  Move IP protocol names table out of policy script to init-bare
  Minor review nits
  Fixes for community ID hashing with new proto values
  Use new_connection instead of connection_state_remove
  Add policy script to remove ip_proto field, rename protocol naming script
  Rename protocol_id field to ip_proto and similar renaming for name field
  Increase size of proto fields to uint16_t, add common default value
  Disable part of core/dict-iteration-expire5 btest to avoid iteration bug
  Add conn.log entries for connections with unhandled IP protocols
2024-11-13 14:36:22 -07:00
Tim Wojtulewicz
ec3794b43e Add NEWS entry for ip_proto feature 2024-11-13 14:15:57 -07:00
Tim Wojtulewicz
e33aee8ca2 Move IP protocol names table out of policy script to init-bare 2024-11-13 14:08:30 -07:00
Tim Wojtulewicz
fd67206865 Minor review nits 2024-11-13 14:08:30 -07:00
Tim Wojtulewicz
43e77a3338 Fixes for community ID hashing with new proto values 2024-11-13 14:08:30 -07:00
Tim Wojtulewicz
5a3d16e16f Use new_connection instead of connection_state_remove 2024-11-13 14:08:30 -07:00
Tim Wojtulewicz
623fea9014 Add policy script to remove ip_proto field, rename protocol naming script 2024-11-13 14:08:04 -07:00
Tim Wojtulewicz
5e5aceb6f7 Rename protocol_id field to ip_proto and similar renaming for name field 2024-11-13 12:02:00 -07:00
Tim Wojtulewicz
d0896e81d6 Increase size of proto fields to uint16_t, add common default value 2024-11-13 11:25:46 -07:00
Tim Wojtulewicz
f762a45e83 Disable part of core/dict-iteration-expire5 btest to avoid iteration bug
The second set of seeds in this test trip the bug reported in #3538
2024-11-13 11:25:46 -07:00
Tim Wojtulewicz
35ec9733c0 Add conn.log entries for connections with unhandled IP protocols 2024-11-13 11:25:40 -07:00
Johanna Amann
a96515a2e8 Merge remote-tracking branch 'origin/topic/johanna/ci-u2410'
* origin/topic/johanna/ci-u2410:
  CI: Add Ubuntu 24.10
2024-11-13 14:52:29 +00:00
Johanna Amann
2f5f8bdd36 CI: Add Ubuntu 24.10 2024-11-13 12:58:20 +00:00
Arne Welzel
6c7f2e62f2 Bump zeekjs to 0.13.0
c0dd7bb README: Add note about supported versions
    da69053 ci: Bump to Fedora 40
    43f69bd Nodejs/Types: Make compatible with v22.11.0
    8a70a21 ci: Fix nightly job
2024-11-13 13:43:31 +01:00
Christian Kreibich
62e8c49e66 CI: bump FreeBSD 13 to 13.4, released in September 2024-11-12 15:49:03 -08:00
Christian Kreibich
2881ff620b CI: drop Fedora 39, add 41 2024-11-12 15:32:07 -08:00
Tim Wojtulewicz
0217208c49 Merge remote-tracking branch 'origin/topic/timw/remove-abspath-cleanup'
* origin/topic/timw/remove-abspath-cleanup:
  diff-remove-abspath: Add separate handling of Windows paths
  diff-remove-abspath: Remove capture of windows drive letters from POSIX regex
2024-11-12 12:26:56 -07:00
Robin Sommer
0ea2a35d7a
Merge remote-tracking branch 'origin/topic/robin/spicy-bump'
* origin/topic/robin/spicy-bump:
  Bump Spicy to current `main`.
2024-11-12 16:16:23 +01:00
Arne Welzel
d0bf4e428a Merge remote-tracking branch 'origin/topic/awelzel/pseudo-realtime-again'
* origin/topic/awelzel/pseudo-realtime-again:
  PktSrc: Remove first_timestamp condition check
  PktSrc: Fix includes
  PktSrc/RunState: Scale on first_wallclock and move pseudo realtime logic to RunState
  RunState.h: Deprecate misleadingly named current_packet_timestamp()
  debug: Add processing suspended/continued to debug.log
2024-11-12 16:00:19 +01:00
Robin Sommer
f68d43bc02
Bump Spicy to current main. 2024-11-12 15:00:01 +01:00
Arne Welzel
fcab5fd6cf PktSrc: Remove first_timestamp condition check
The comment is stale and first_timestamp is only relevant/available
in pseudo_realtime.
2024-11-12 10:46:55 +01:00
Arne Welzel
ffa1fafa03 PktSrc: Fix includes 2024-11-12 10:46:55 +01:00
Arne Welzel
d9a7f9f36f PktSrc/RunState: Scale on first_wallclock and move pseudo realtime logic to RunState
check_pseudo_time() used zeek_start_time which skews things sufficiently
around being in the past when ZAM compilation takes multiple seconds. Switch
to using first_wallclock instead.

Further, move setting of first_timestamp and first_wallclock from PktSrc
into RunState's dispatch_packet(), so it's more centralized now.

The only pseudo_realtime piece left in PktSrc() is in GetNextTimeout() to
determine how long the PktSrc is idle until the next packet is ready.
2024-11-12 10:46:55 +01:00
Arne Welzel
54d28a2179 RunState.h: Deprecate misleadingly named current_packet_timestamp()
This returns current_pseudo, naming it current_packet_timestamp()
is actively misleading.
2024-11-12 10:46:55 +01:00
Arne Welzel
402b768787 debug: Add processing suspended/continued to debug.log 2024-11-12 10:46:55 +01:00
Arne Welzel
9e27334596 Merge remote-tracking branch 'origin/topic/vern/zam-asan-fixes'
* origin/topic/vern/zam-asan-fixes:
  ZAM fixes for assignments involving "any" record fields
  fixes for (mostly ZAM) vector operation issues found by ASAN

Including a fix for mmdb/explicit-open.zeek to avoid using assert.
2024-11-12 10:29:56 +01:00
zeek-bot
57ffa96600 Update doc submodule [nomail] [skip ci] 2024-11-12 00:11:11 +00:00
Benjamin Bannier
1d38c31071 Merge remote-tracking branch 'origin/topic/etyp/cookie-nullptr-spicy-dpd' 2024-11-11 22:30:50 +01:00
Evan Typanski
ae33aa0413 Fix nullptr deref in Spicy accept/decline input
Seems like this is a continuation of #4006
2024-11-11 10:30:02 -05:00
Robin Sommer
0285196626
Merge remote-tracking branch 'origin/topic/robin/gh-3988-evt-assert'
* origin/topic/robin/gh-3988-evt-assert:
  Spicy: Improve error messages reporting malformed unit names in EVT files.
  Spicy:: Remove unhelpful assertion.
2024-11-11 14:02:15 +01:00
Robin Sommer
3362d44e0c
Merge remote-tracking branch 'origin/topic/robin/gh-4007-spicy-eod'
* origin/topic/robin/gh-4007-spicy-eod:
  Spicy: Do not raise an analyzer error when a connection is missing a regular tear-down.
2024-11-11 14:02:05 +01:00
Arne Welzel
50c2b10cfb Merge remote-tracking branch 'origin/topic/awelzel/run-zam-ci-if-changes-include-src-script-opt'
* origin/topic/awelzel/run-zam-ci-if-changes-include-src-script-opt:
  ci: Run ZAM CI if src/script_opt is modified
2024-11-11 10:25:56 +01:00
Arne Welzel
43789fbccc ci: Run ZAM CI if src/script_opt is modified
...and rework && to || conditions.
2024-11-11 10:18:14 +01:00
Arne Welzel
f598c89f17 Merge remote-tracking branch 'origin/topic/timw/update-c-ares-to-latest-release'
* origin/topic/timw/update-c-ares-to-latest-release:
  DNS_Mgr: Remove processing of dns aliases in general
  ci: Add dnsmasq to a few platforms for testing
  DNS_Mgr: Fix aliases memory issues
  btest: Add integration test for DNS_Mgr
  DNS_Mgr: Remove usage of ares_getsock from Lookup
  DNS_Mgr: Remove usage of ares_getsock from GetNextTimeout
  DNS_Mgr: Switch to ares_set_servers_csv
  DNS_Mgr: Use ares_dns_record methods for queries
  Update vcpkg submodule to pick up c-ares v1.34.2
  Update c-ares submodule to v1.34.2
2024-11-11 09:53:04 +01:00
Arne Welzel
d3579c1f34 Merge remote-tracking branch 'origin/topic/awelzel/community-id-new-connection'
* origin/topic/awelzel/community-id-new-connection:
  policy/community-id: Populate conn$community_id in new_connection()
2024-11-11 09:35:49 +01:00
Vern Paxson
197d49773c ZAM fixes for assignments involving "any" record fields 2024-11-11 09:19:54 +01:00
Vern Paxson
c7e5e5feea fixes for (mostly ZAM) vector operation issues found by ASAN 2024-11-11 09:19:54 +01:00
zeek-bot
35cac72984 Update doc submodule [nomail] [skip ci] 2024-11-09 00:12:14 +00:00
Tim Wojtulewicz
e3763df065 DNS_Mgr: Remove processing of dns aliases in general 2024-11-08 12:45:51 -07:00
Arne Welzel
346a9233da Merge remote-tracking branch 'origin/topic/vern/zam-any-coerce-leak'
* origin/topic/vern/zam-any-coerce-leak:
  Fixed ZAM memory leak when coercing values to "any"
2024-11-08 18:36:34 +01:00
Arne Welzel
cb679e4d7a policy/community-id: Populate conn$community_id in new_connection()
This wasn't possible before #3028 was fixed, but now it's safe to set
the value in new_connection() and allow other users access to the
field much earlier. We do not have to deal with connection_flipped()
because the community-id hash is symmetric.
2024-11-08 18:19:55 +01:00
Arne Welzel
3f4de778ae ci: Add dnsmasq to a few platforms for testing 2024-11-08 09:50:35 -07:00
Arne Welzel
0a7c9365be ci: Remove -b from test_script lines for zam tasks
Better for monitoring process.
2024-11-08 17:13:49 +01:00
Arne Welzel
4f8ef3c792 Merge remote-tracking branch 'origin/topic/vern/zam-degenerate-CFT-propagation'
* origin/topic/vern/zam-degenerate-CFT-propagation:
  fixes for ZAM's propagation of control flow information for some degenerate constructs
2024-11-08 15:35:08 +01:00
Vern Paxson
148215aa87 fixes for ZAM's propagation of control flow information for some degenerate constructs 2024-11-08 15:34:21 +01:00
Arne Welzel
bc75b1811d Merge remote-tracking branch 'origin/topic/vern/zam-vector-loop-leak'
* origin/topic/vern/zam-vector-loop-leak:
  fixed ZAM memory leak when looping over vectors of records
2024-11-08 15:32:57 +01:00
Arne Welzel
8613f821f9 Merge remote-tracking branch 'origin/topic/vern/cat-builtin-tmp'
* origin/topic/vern/cat-builtin-tmp:
  fixed access to uninitialized memory in ZAM's "cat" built-in
2024-11-08 15:23:00 +01:00
Arne Welzel
8945b2b186 Merge remote-tracking branch 'origin/topic/awelzel/asan-zam-ci'
* origin/topic/awelzel/asan-zam-ci:
  ci: Add asan and ubsan sanitizer tasks for ZAM
2024-11-08 15:22:26 +01:00
Arne Welzel
6f9eec6c33 ci: Add asan and ubsan sanitizer tasks for ZAM
Closes #3906
2024-11-08 15:17:03 +01:00
Robin Sommer
d57c125942
Spicy: Improve error messages reporting malformed unit names in EVT files. 2024-11-08 13:44:09 +01:00
Robin Sommer
2d935d9668
Spicy:: Remove unhelpful assertion.
In cases of a malformed event definition, this could fire instead of a
more helpful error message coming later.

Closes #3988.
2024-11-08 12:54:14 +01:00
Robin Sommer
9e1592d5c4
Spicy: Do not raise an analyzer error when a connection is missing a regular tear-down.
So far, when Zeek didn't see a connection's regular tear-down (e.g.,
because its state timed-out before we got to the end), we'd still
signal a regular end-of-data to Spicy parsers. As a result, they would
then typically raise a parse error because they were probably still
expecting data and would now declare it missing. That's not very
useful because semantically it's not really a protocol issue if the
data just doesn't make it over to us; it's a transport-layer issue
that Zeek already handles elsewhere. So we now switch to signaling
end-of-data to Spicy analyzers only if the connection indeed shuts
down regularly. This is also matches how BinPAC handles it.

This also comes with a test exercising various combinations of
end-of-data behavior so that we ensure consistent/desired behavior.

Closes #4007.
2024-11-08 12:20:29 +01:00
Arne Welzel
5859a7e28c DNS_Mgr: Fix aliases memory issues 2024-11-08 11:29:40 +01:00
Arne Welzel
f3fbe45c4c btest: Add integration test for DNS_Mgr
This makes use of an ephemeral dnsmasq instance
2024-11-08 11:29:31 +01:00
Vern Paxson
6c2b2819c7 fixed access to uninitialized memory in ZAM's "cat" built-in 2024-11-07 17:13:22 -08:00
Vern Paxson
cf1de7e6b7 Fixed ZAM memory leak when coercing values to "any" 2024-11-07 08:28:34 -08:00
Tim Wojtulewicz
b8b14537a9 diff-remove-abspath: Add separate handling of Windows paths 2024-11-06 16:06:17 -07:00
Tim Wojtulewicz
9cc7b05064 diff-remove-abspath: Remove capture of windows drive letters from POSIX regex 2024-11-06 16:05:08 -07:00
Tim Wojtulewicz
d95057d618 DNS_Mgr: Remove usage of ares_getsock from Lookup 2024-11-06 16:01:04 -07:00
Tim Wojtulewicz
6739fca645 DNS_Mgr: Remove usage of ares_getsock from GetNextTimeout 2024-11-06 16:01:04 -07:00
Tim Wojtulewicz
16474ed77f DNS_Mgr: Switch to ares_set_servers_csv 2024-11-06 16:01:04 -07:00
Tim Wojtulewicz
65a59419b0 DNS_Mgr: Use ares_dns_record methods for queries 2024-11-06 16:01:04 -07:00
Tim Wojtulewicz
b52a8ed9e2 Update vcpkg submodule to pick up c-ares v1.34.2 2024-11-06 16:01:04 -07:00
Tim Wojtulewicz
da495400ca Update c-ares submodule to v1.34.2 2024-11-06 16:00:48 -07:00
Vern Paxson
04ff5bead9 fixed ZAM memory leak when looping over vectors of records 2024-11-06 08:25:40 -08:00
Arne Welzel
219d621234 netcontrol: Replace Broker::auto_publish()
I'd think we could drop the cluster.zeek and non-cluster.zeek and
just unconditionally do the publish(), but keeping it for now.
2024-11-06 15:27:48 +01:00
Arne Welzel
93478a246e intel: Switch to Cluster::publish()
This isn't quite making things a lot nicer, but more explicit.
2024-11-06 15:27:48 +01:00
Arne Welzel
91c03cd988 broker: Support publish() of unspecified set() / table()
Calling Broker::make_event(..., table()) or Broker::publish(..., table())
caused runtime type errors as same_type() would result in false.
2024-11-06 15:27:26 +01:00
Arne Welzel
189565d131 types: Fix table() resulting in table_type->IsSet() == true
typename(table()) apparently always resulted in a set[] type
being rendered. Make the yield type of an unspecified table
ANY so that type->IsSet() ends up false.

While at it, also render unspecified types as table(), set() and
vector() rather than vector of void, set[] or table[] of any which
IMO should help to figure out what's going.
2024-11-06 13:28:57 +01:00
Benjamin Bannier
e4dbba20a4 Merge remote-tracking branch 'origin/topic/bbannier/bump-spicy' 2024-11-06 11:57:01 +01:00
Benjamin Bannier
f57955321e Make Spicy hook execution order deterministic in test 2024-11-06 09:42:33 +01:00
Benjamin Bannier
f47a089576 Bump auxil/spicy to latest development snapshot 2024-11-06 09:26:00 +01:00
Benjamin Bannier
2e8d6e86e7 Merge remote-tracking branch 'origin/topic/bbannier/spicy-cookie-nullptr-deref' 2024-11-05 17:39:12 +01:00
Benjamin Bannier
93c201df57 Fix potential nullptr deref in Spicy plugin runtime
If we added a file but the other side of the connection had already run
into a protocol violation and shut down we could previously have
dereferenced a null cookie. This patch fixes the code so it now throws
in such scenarios.
2024-11-05 16:48:35 +01:00
Benjamin Bannier
0028ba320d Assume no Spicy cookie in most places
We would previously assert that it was available which could have lead
to aborts since when the analyzer for either side of a connection shuts
down the connection cookie could get cleared and become nil. This patch
reworks the code slightly so we now never assume it is available. We do
this by either throwing or by making the whole operation requesting the
cookie a noop.
2024-11-05 16:48:35 +01:00
Arne Welzel
a3a0155825 Merge remote-tracking branch 'origin/topic/awelzel/sqli-test-followup'
* origin/topic/awelzel/sqli-test-followup:
  btest: Add detect-sqli test script
2024-11-04 19:35:34 +01:00
Arne Welzel
c171d9e8c2 Merge remote-tracking branch 'origin/topic/vern/canonicalize-std-string'
* origin/topic/vern/canonicalize-std-string:
  switched CPPCompile::Canonicalize() to take std::string instead of const char*
2024-11-04 18:47:18 +01:00
Arne Welzel
b69222d5f6 btest: Add detect-sqli test script
...I added the baselines during the merge, just not the test itself.
2024-11-04 18:42:55 +01:00
Vern Paxson
519fec2592 switched CPPCompile::Canonicalize() to take std::string instead of const char* 2024-11-04 08:22:37 -08:00
Arne Welzel
8935dc9ed4 Merge remote-tracking branch 'origin/topic/vern/script-opt-fnv1a64'
* origin/topic/vern/script-opt-fnv1a64:
  minor ZAM BTest updates for recently added fnv1a64 BiF
2024-11-04 16:33:21 +01:00
Arne Welzel
db497d1da7 Merge remote-tracking branch 'origin/topic/awelzel/pattern-matches-rework'
* origin/topic/awelzel/pattern-matches-rework:
  RuleMatcher: Use a single list for tracking pattern_matches
  ZeekString: Implement move constructor
2024-11-04 16:32:48 +01:00
Arne Welzel
e443624c32 RuleMatcher: Use a single list for tracking pattern_matches 2024-11-04 16:17:49 +01:00
Arne Welzel
0ecbd4435e ZeekString: Implement move constructor 2024-11-04 16:17:47 +01:00
Benjamin Bannier
8fc5b7fcda Merge remote-tracking branch 'origin/topic/bbannier/bump-spicy-format' 2024-11-04 09:43:28 +01:00
Benjamin Bannier
b829b2165e Bump and reenable spicy-format pre-commit hook 2024-11-04 07:25:44 +01:00
Vern Paxson
d5c820d2c5 minor ZAM BTest updates for recently added fnv1a64 BiF 2024-11-03 14:05:19 -08:00
Johanna Amann
84d8e74884 Merge remote-tracking branch 'origin/topic/johanna/snap-tcp-test'
* origin/topic/johanna/snap-tcp-test:
  Add test for TCP over 802.3/SNAP
2024-10-31 16:17:31 +00:00
Johanna Amann
807bb142a7 Add test for TCP over 802.3/SNAP
This admittedly is a quite esoteric combination of protocols. But - as
we do correctly support them, it seems nice to have a slightly more
complete testcase that covers this.
2024-10-31 14:37:44 +00:00
zeek-bot
56514d98d6 Update doc submodule [nomail] [skip ci] 2024-10-31 00:14:49 +00:00
Arne Welzel
7b3bc891f4 Merge remote-tracking branch 'origin/topic/etyp/ubuntu-clang-ci'
Modified ubuntu24_clang_libcpp_task to be skipped on PRs.

* origin/topic/etyp/ubuntu-clang-ci:
  CI: Upgrade FreeBSD 14 to 14.1
  CI: Add Ubuntu Clang task
  Fix up minor warnings in touched files
  Fix Clang 19 deprecation failure
2024-10-30 14:54:08 +01:00
Arne Welzel
9fa4d6f5ed pre-commit-config: Disable spicy-format
This fails to install currently: bbannier/spicy-format#157
2024-10-30 14:43:42 +01:00
Arne Welzel
fd0181c2cb Merge branch 'modbus-fc-fixes' of https://github.com/zambo99/zeek
* 'modbus-fc-fixes' of https://github.com/zambo99/zeek:
  Fix issues with Modbus message logging
2024-10-30 14:38:53 +01:00
Arne Welzel
00a0f9c920 Merge remote-tracking branch 'origin/topic/awelzel/data-end-offset-v1'
* origin/topic/awelzel/data-end-offset-v1:
  signatures: Add data_end_offset to signature_match() and custom events
  Add pattern_end_offset to signature_state
2024-10-30 14:34:08 +01:00
Evan Typanski
8b64d12167 CI: Upgrade FreeBSD 14 to 14.1 2024-10-30 09:04:24 -04:00
Evan Typanski
04c3c2ec72 CI: Add Ubuntu Clang task
This feels more like a band-aid solution - it still requires very manual
intervention to get the next builds, but at least this way we don't rely
on whatever Clang/libc++ happens to ship with FreeBSD for the only
libc++ testing. It seems like sanitizer builds don't use libc++, but I'd
rather a dedicated Linux/Clang/libc++ task at least.
2024-10-30 09:04:24 -04:00
Evan Typanski
36af0591a6 Fix up minor warnings in touched files 2024-10-30 08:47:57 -04:00
Evan Typanski
985f4f7c72 Fix Clang 19 deprecation failure
Fixes #3994

Clang 19 with libc++ started failing to compile because the default
implementation of `std::char_traits` was removed, making uses of
`std::char_traits<unsigned char>` invalid. This was more of used for
convenience before, but it should be roughly the same behavior with
`char`.

See relevant LLVM commits:

aeecef08c3

08a0faf4cd
2024-10-30 08:47:15 -04:00
Arne Welzel
04872d4e78 signatures: Add data_end_offset to signature_match() and custom events
This change tracks the current offset (number of bytes fed into matchers)
on the top-level RuleEndpointState such that we can compute the relative ending
for matched texts individually.

Additionally, it adds the data_end_offset as a new optional parameter to
signature_match().
2024-10-30 13:29:58 +01:00
Emmanuele Zambon
792aacc8e5 Fix issues with Modbus message logging
This commit fixes three issues with Zeek's Modbus message logging:

1 - Some exception responses (e.g., READ_COILS_EXCEPTION) are logged
    twice: once without and once with the exception message.
2 - Some exception responses (e.g., PROGRAM_484_EXCEPTION) are not
    logged.
3 - Some known but reserved function codes (e.g., PROGRAM_UNITY) are
    logged as unk-xxx (e.g., unk-90), while it would be possible to
    log their known name.

To address these inconsistencies, the modbus parser has been updated
to parse all exception responses (i.e., all responses where the MSB
of the function code is set) using the already defined Exception
message.
Also, the Modbus main.zeek script has been updated to consistently
demand logging exception responses to the specialized
modbus_exception event, rather than logging some exception responses
in the modbus_message event and others in the modbus_exception event.
Finally, the main.zeek script has been updated to make sure that
for every known function code, the corresponding exception code was
also present, and the enumeration of known function codes in
consts.zeek has been expanded.

Closes #3984
2024-10-30 13:12:27 +01:00
Johanna Amann
681fd37a6d Merge remote-tracking branch 'origin/topic/awelzel/skip-modbus-when-spicy-ssl-enabled'
* origin/topic/awelzel/skip-modbus-when-spicy-ssl-enabled:
  modbus: Skip non-modbus traffic testing with Spicy SSL
  testing: Add have-spicy-ssl helper and update tests
2024-10-30 11:48:15 +00:00
Johanna Amann
eb74790d90 Merge branch 'improvement/fnv1a_hashing_algorithm_improvements' of https://github.com/martinvanhensbergen/zeek
Fixes indentation.

Fixes GH-3970
2024-10-30 11:46:26 +00:00
ronny8360988
5859e23198 Add pattern_end_offset to signature_state
Add pattern_end_offset to signature_state

Update init-bare.zeek

Update RuleMatcher.cc

Update RuleMatcher.h

Update init-bare.zeek

clang format

clang format

clang format

Using Match Offsets List

Temp commit
2024-10-30 12:32:00 +01:00
zeek-bot
ab4d8744b6 Update doc submodule [nomail] [skip ci] 2024-10-30 00:10:54 +00:00
Arne Welzel
5200b84fb3 Merge branch 'sqli-spaces-encode-to-plus' of https://github.com/cooper-grill/zeek
* 'sqli-spaces-encode-to-plus' of https://github.com/cooper-grill/zeek:
  account for spaces encoding to plus signs in sqli regex detection
2024-10-29 14:08:39 +01:00
Arne Welzel
821218e7b2 Merge remote-tracking branch 'origin/topic/vern/CPP-when-capture-naming'
* origin/topic/vern/CPP-when-capture-naming:
  fixed "-O gen-C++" naming of "when" captures to avoid ambiguities due to inlining
  Simplified & made more robust maintenance helper script for "-O gen-C++" testing
  "-a cpp" baseline updates to reflect recent BTest changes
2024-10-29 13:50:56 +01:00
Cooper Grill
ec6bf7bebc account for spaces encoding to plus signs in sqli regex detection
remove instance of plus sign to account for real plus in sql

account for spaces encoding to plus signs in sqli regex detection

add test cases for sqli space to plus

account for spaces encoding to plus signs in sqli regex detection

forgot semicolon

account for spaces encoding to plus signs in sqli regex detection
2024-10-29 07:48:36 -04:00
Arne Welzel
54bc3672d8 modbus: Skip non-modbus traffic testing with Spicy SSL
With Spicy SSL, there's no SSL conn.log produced.
2024-10-29 09:30:01 +01:00
Arne Welzel
d18045ee16 testing: Add have-spicy-ssl helper and update tests 2024-10-29 09:30:01 +01:00
zeek-bot
fc42074c7c Update doc submodule [nomail] [skip ci] 2024-10-25 00:22:10 +00:00
Christian Kreibich
66173633f4 Merge branch 'topic/christian/telemetry-make-bifs-primary'
* topic/christian/telemetry-make-bifs-primary:
  Telemetry framework: move BIFs to the primary-bif stage
  Minor comment tweaks for init-frameworks-and-bifs.zeek
2024-10-24 07:09:16 -07:00
Christian Kreibich
f2b4c9d553 Update broker submodule [nomail]
This pulls in zeek/broker#424, zeek/broker#430, zeek/broker#431.
2024-10-23 05:52:07 -07:00
zeek-bot
b65a7d427c Update doc submodule [nomail] [skip ci] 2024-10-23 00:12:55 +00:00
Arne Welzel
daa358c840 Merge remote-tracking branch 'origin/topic/awelzel/3947-telemetry-hook-scrape'
* origin/topic/awelzel/3947-telemetry-hook-scrape:
  btest/telemetry: Fix "Note compilable" typo
  misc/stats: Add zeek_net_timestamp_seconds
  telemetry/Manager: Remove variant include
  telemetry: Invoke Telemetry::sync() only at scrape/collection time
2024-10-22 19:04:51 +02:00
Arne Welzel
3d053a94f7 btest/telemetry: Fix "Note compilable" typo 2024-10-22 18:50:32 +02:00
Arne Welzel
e20aa66eae misc/stats: Add zeek_net_timestamp_seconds
Adding a metric for the network time value itself should make it
possible to observe it stopping or growing slowly as compared to
realtime when Zeek isn't able to keep up.

Also, modify the telemetry/log.zeek test to include misc/stats and
log at a higher frequency with a more interesting pcap.
2024-10-22 18:49:17 +02:00
Arne Welzel
1822f4f6fe telemetry/Manager: Remove variant include 2024-10-22 18:49:16 +02:00
Arne Welzel
70872673a1 telemetry: Invoke Telemetry::sync() only at scrape/collection time
This stops invoking Telemetry::sync() via a scheduled event and instead
only invokes it on-demand. This makes metric collection network time
independent and lazier, too.

With Prometheus scrape requests being processed on Zeek's main thread
now, we can safely invoke the script layer Telemetry::sync() hook.

Closes #3947
2024-10-22 18:49:11 +02:00
Martin van Hensbergen
ee84c0c59a Improvements in FNV1A hash functions
- Add FNV1a64 hash function
- make hash function type aware
- add unit tests
2024-10-22 16:07:12 +02:00
Arne Welzel
d74b073852 Merge remote-tracking branch 'origin/topic/awelzel/3978-zeekjs-0.12.1-bump'
* origin/topic/awelzel/3978-zeekjs-0.12.1-bump:
  Bump zeekjs to 0.12.1
2024-10-22 11:25:05 +02:00
Arne Welzel
ee18b8911c Bump zeekjs to 0.12.1
7ec0953 ci: Bump actions/upload-artifact
    8e5914d ci/docker: Bump distros, update some OBS repos
    129b737 Fix crash during shutdown

Closes #3978
2024-10-22 11:09:35 +02:00
zeek-bot
5428ddbdeb Update doc submodule [nomail] [skip ci] 2024-10-22 00:10:53 +00:00
Arne Welzel
4763282f36 Merge branch 'modbus-fixes' of https://github.com/zambo99/zeek
* 'modbus-fixes' of https://github.com/zambo99/zeek:
  Prevent non-Modbus on port 502 to be reported as Modbus
2024-10-21 15:54:11 +02:00
Emmanuele Zambon
05d92dc2a5 Prevent non-Modbus on port 502 to be reported as Modbus
This commit prevents most non-Modbus TCP traffic on port 502 to be
reported as Modbus in conn.log as well as in modbus.log.
To do so, we have introduced two &enforce checks in the Modbus
protocol definition that checks that some specific fields of the
(supposedly) Modbus header are compatible with values specified in
the specs.

To ensure non-regression, with this commit we also introduce a
new btest.

Closes #3962
2024-10-21 14:40:45 +02:00
Christian Kreibich
2e576b058d Merge branch 'topic/vern/script-opt-headers-factoring'
* topic/vern/script-opt-headers-factoring:
  factored CPP source's main header into collection of per-source-file headers
  renamed script optimization Attrs.h header to prepare for factoring large Compile.h
  factored ZAM source's main header into collection of per-source-file headers
2024-10-18 17:51:19 -07:00
Vern Paxson
744628f115 factored CPP source's main header into collection of per-source-file headers 2024-10-18 17:37:33 -07:00
Vern Paxson
a2495d028e renamed script optimization Attrs.h header to prepare for factoring large Compile.h 2024-10-18 17:37:33 -07:00
Vern Paxson
64de2dbf31 factored ZAM source's main header into collection of per-source-file headers 2024-10-18 17:37:33 -07:00
zeek-bot
d6c1d0640e Update doc submodule [nomail] [skip ci] 2024-10-19 00:13:12 +00:00
Christian Kreibich
71f7e89974 Telemetry framework: move BIFs to the primary-bif stage
This moves the Telemetry framework's BIF-defined functionalit from the
secondary-BIFs stage to the primary one. That is, this functionality is now
available from the end of init-bare.zeek, not only after the end of
init-frameworks-and-bifs.zeek.

This allows us to use script-layer telemetry in our Zeek's own code that get
pulled in during init-frameworks-and-bifs.

This change splits up the BIF features into functions, constants, and types,
because that's the granularity most workable in Func.cc and NetVar. It also now
defines the Telemetry::MetricsType enum once, not redundantly in BIFs and script
layer.

Due to subtle load ordering issues between the telemetry and cluster frameworks
this pushes the redef stage of Telemetry::metrics_port and address into
base/frameworks/telemetry/options.zeek, which is loaded sufficiently late in
init-frameworks-and-bifs.zeek to sidestep those issues. (When not doing this,
the effect is that the redef in telemetry/main.zeek doesn't yet find the
cluster-provided values, and Zeek does not end up listening on these ports.)

The need to add basic Zeek headers in script_opt/ZAM/ZBody.cc as a side-effect
of this is curious, but looks harmless.

Also includes baseline updates for the usual btests and adds a few doc strings.
2024-10-18 09:56:29 -07:00
Christian Kreibich
acdd7a7934 Minor comment tweaks for init-frameworks-and-bifs.zeek 2024-10-18 09:56:29 -07:00
Christian Kreibich
c28442a9a1 Merge remote-tracking branch 'origin/topic/bbannier/fix-docs-ci-again'
* origin/topic/bbannier/fix-docs-ci-again:
  Fix installation of Python packages in generate docs CI job again
2024-10-18 09:55:33 -07:00
Benjamin Bannier
42762aa06e Fix installation of Python packages in generate docs CI job again
This pins the generate-docs GH workflow to run on a fixed version of
ubuntu so we get defined semantics of `pip install` wrt system packages.
We were previously using the `ubuntu-latest` image and GH has been
switching this from ubuntu-22.04 to 24.04 and back again, also see
https://github.com/actions/runner-images/issues/10636.
2024-10-18 08:51:18 +02:00
zeek-bot
ec9d6932fc Update doc submodule [nomail] [skip ci] 2024-10-16 00:40:34 +00:00
Benjamin Bannier
cb612cd48a Merge branch 'topic/bbannier/fix-sphinx-build' 2024-10-15 17:12:22 +02:00
Benjamin Bannier
cfd66ec6f3 Fix invalid Sphinx directive in docstring
Use of `:zeek::see:..` instead of `:zeek:see:..` caused a Sphinx build
failure which prevented automatic regeneration of docs.
2024-10-15 12:47:39 +02:00
Benjamin Bannier
a1aff92c1a Merge remote-tracking branch 'origin/topic/bbannier/ci-pre-commit' 2024-10-15 12:15:30 +02:00
Benjamin Bannier
5110af3c13 Bump GH actions for generate-docs job 2024-10-15 10:45:28 +02:00
Benjamin Bannier
34490edae0 Fix installation of Python packages in generate docs CI job
This job uses `ubuntu-latest`, i.e., it will automatically use the
newest version of Ubuntu available. On current versions `pip install`
refuses to install packages into the system since this might break
system packages. Users are expected to explicitly opt into this
potential breakage by passing the `--break-system-packages` flag. This
is an acceptable workaround here since we do not distribute this setup,
and currently things appear to not break.
2024-10-15 10:43:52 +02:00
Benjamin Bannier
7747182dbd Bump GH actions for pre-commit job 2024-10-15 10:33:41 +02:00
Benjamin Bannier
d9072c0932 Pin distribution for pre-commit CI job
The GH action `pre-commit/action` installs `pre-commit` into the system
with `pip`.[^1] On newer distributions this is discouraged as it might break
system packages and would require a dedicated flag
`--break-system-packages` in order to pass.

Since the action does not work in such environments yet, instead pin the
distribution we use for the workflow to a fixed, older and working version.

[^1]: 576ff52938/action.yml (L11)
2024-10-15 10:30:44 +02:00
Benjamin Bannier
391fb4de07 Merge remote-tracking branch 'origin/topic/etyp/enshrine-event-order' 2024-10-15 09:57:36 +02:00
Evan Typanski
0c79849a0f Test .evt file &priority
This was not documented nor tested, so this tests the behavior.
Documentation should be added later.
2024-10-14 08:51:58 -04:00
Vern Paxson
1f1200e5e8 fixed "-O gen-C++" naming of "when" captures to avoid ambiguities due to inlining
Previously there was logic for doing this, but it was ineffectual
	due to the order in which canonicalization was done. This problem
	manifested non-deterministically depending on order-of-generation
	of "when" lambdas, which is why previous testing didn't catch it.
2024-10-11 08:16:59 -07:00
Vern Paxson
e18ab5be95 Simplified & made more robust maintenance helper script for "-O gen-C++" testing 2024-10-11 08:14:23 -07:00
Vern Paxson
f90d03bc7f "-a cpp" baseline updates to reflect recent BTest changes 2024-10-11 08:12:49 -07:00
zeek-bot
1e24980901 Update doc submodule [nomail] [skip ci] 2024-10-10 00:12:02 +00:00
Christian Kreibich
1208555ee3 Merge remote-tracking branch 'origin/topic/vern/remove-teredo-gtpv1-script-opt-insts'
* origin/topic/vern/remove-teredo-gtpv1-script-opt-insts:
  removed specialized ZAM instructions for GTPv1 and Teredo cleanup BiFs
2024-10-09 15:36:52 -07:00
Christian Kreibich
2651de64bf Merge remote-tracking branch 'origin/topic/vern/script-opt-baselines.Oct24'
* origin/topic/vern/script-opt-baselines.Oct24:
  -a zam baseline updates reflecting recent changes to main baselines
2024-10-09 15:36:21 -07:00
Christian Kreibich
2a23e9fc19 Merge branch 'topic/awelzel/3957-raw-reader-spinning'
* topic/awelzel/3957-raw-reader-spinning:
  input/Raw: Rework GetLine()
2024-10-09 14:26:54 -07:00
Arne Welzel
ecfa03ea1d input/Raw: Rework GetLine()
This isn't a straightforward fix, unfortunately. The existing GetLine()
implementation didn't deal well with input that's incrementally produced
where individually read chunks wouldn't end with the separator.

The prior implementation increased the buffer each time it failed to find
a separator in the current buffer, but then also ended up not searching the
full new buffer size for the terminator, doing that endlessly.

This change reworks the Raw reader to rely only on bufpos for reading
and searching purposes and skip reallocation if the buffer size if it
wasn't actually exhausted.

Closes #3957
2024-10-09 14:21:07 -07:00
Vern Paxson
b4bfbcc8d2 removed specialized ZAM instructions for GTPv1 and Teredo cleanup BiFs 2024-10-05 15:39:47 -07:00
Vern Paxson
99f2bcef41 -a zam baseline updates reflecting recent changes to main baselines 2024-10-05 14:57:50 -07:00
Arne Welzel
4656faed6c POP3: Rework unbounded pending command fix
Processing out-of-order commands or finishing commands based on invalid
server responses resulted in inconsistent analyzer state, potentially
triggering null pointer references for crafted traffic.

This commit reworks cf9fe91705 such that
too many pending commands are simply discarded, rather than any attempt
being made to process them. Further, invalid server responses do not
result in command completion anymore.

Test PCAP was crafted based on traffic produced by the OSS-Fuzz reproducer.

Closes #215
2024-10-04 12:45:59 -07:00
Christian Kreibich
d70bb6a889 Merge branch 'topic/christian/bump-cluster-testing'
* topic/christian/bump-cluster-testing:
  Bump zeek-testing-cluster to pull in a baseline update
2024-10-04 12:45:22 -07:00
Christian Kreibich
4ccf1dd470 Bump zeek-testing-cluster to pull in a baseline update
The recently expanded `Describe()` output (c0ffaabe) caused one test to
complain.
2024-10-04 12:44:11 -07:00
Arne Welzel
c826118385 Merge remote-tracking branch 'origin/topic/etyp/centos-missing-file-test-fail'
* origin/topic/etyp/centos-missing-file-test-fail:
  Fix flaky `missing-file-initially` test
2024-10-04 19:32:48 +02:00
Evan Typanski
5c6f172c0a Fix flaky missing-file-initially test
That test got flaky probably from #3949 on centosstream9 CI. You can
replicate that behavior by increasing the sleep time when waiting for
the file such that the test will attempt to read the missing file again.
Since the one second wait for file is glacially slow for this, speeding
it up should mean that the file gets created sooner and so the test
won't try to open the file again. But, it's always still technically
possible, since the test will wait for 10 seconds and the heartbeat
seems to be 1 second. At least if that happens, it's probably a bug or
massive slowdown of some kind.
2024-10-04 12:27:34 -04:00
Benjamin Bannier
ac5522f03a Merge branch 'topic/bbannier/spicyz-usage' 2024-10-04 13:34:49 +02:00
Benjamin Bannier
2358e8b608 Add missing newline in spicyz usage message 2024-10-04 12:56:19 +02:00
Arne Welzel
e118887771 Merge remote-tracking branch 'origin/topic/etyp/bg-test-nondeterminism'
* origin/topic/etyp/bg-test-nondeterminism:
  Fix input error test nondeterminism
2024-10-02 20:17:38 +02:00
Evan Typanski
e8872b4c7f Fix input error test nondeterminism
It seems like other similar tests get by because they have more "stuff"
before they call `terminate()` most likely. But, to be safe, just
removing the "received termination signal" line seems like the best
approach.
2024-10-02 13:26:41 -04:00
Arne Welzel
6aeb302bfc Merge remote-tracking branch 'origin/topic/etyp/remove-duplicate-table-warns'
* origin/topic/etyp/remove-duplicate-table-warns:
  Report suppressed warnings count
  Avoid duplicating warnings when reading table
2024-10-01 11:52:02 +02:00
Evan Typanski
ecabf882ac Report suppressed warnings count
This also triggers if there is one warning, which seems a little weird,
but it seems mostly reasonable.
2024-09-30 08:20:19 -04:00
Evan Typanski
6e8d43a552 Avoid duplicating warnings when reading table
Invalid lines in a file was the one case that would not suppress future
warnings. Just make it suppress warnings too, but clear that suppression
if there is a field in between that doesn't error.

Fixes #3692
2024-09-30 08:20:19 -04:00
zeek-bot
54391f50d9 Update doc submodule [nomail] [skip ci] 2024-09-28 00:32:20 +00:00
Christian Kreibich
b4c43e1607 Merge branch 'topic/vern/script-opt-maint.Sep24B'
* topic/vern/script-opt-maint.Sep24B:
  factoring of logic used by ZAM's low-level optimizer when adjusting control flow info
  BTest baseline update for more complete function/lambda names
  tweak to -O gen-C++ maintenance script to avoid treating plugins as BTests
  fixed lambda hash collision bug due to function descriptions lacking full parameter information
  fixes (to avoid collisions) for AST profiling's function hash computations
  removed unused ZAM cast-to-any operation
  fixes for ZAM tracking the return type associated with function calls
  ZAM control-flow tracking now explicitly includes the ends of loops
  fix for ZAM identification of common subexpressions
  "-O dump-final-ZAM" option similar to "dump-ZAM" only prints final version of functions
  fix for setting object locations to avoid use-after-free situation
  extended "-O allow-cond" to apply to both gen-C++ and gen-standalone-C++
  -O gen-C++ fix for run-time warnings for "when" lambdas
  fix to -O gen-C++ for recent AST profiling changes for identifying function parameters
  fix to -O gen-C++ for dealing with "hidden" parameters
  tweak to prevent an incorrect warning for scripts compiled to C++
  fixed overly narrow Spicy test for manipulating packet analyzers
  fixed memory leak for recursive ZAM functions that exit via an exception
  remove unnecessary header include
2024-09-27 15:20:21 -07:00
Vern Paxson
110e5d0787 factoring of logic used by ZAM's low-level optimizer when adjusting control flow info 2024-09-27 14:16:15 -07:00
Vern Paxson
61258587bf BTest baseline update for more complete function/lambda names 2024-09-27 14:16:10 -07:00
Vern Paxson
32d254bd47 tweak to -O gen-C++ maintenance script to avoid treating plugins as BTests 2024-09-27 13:25:00 -07:00
Vern Paxson
c0ffaabe2e fixed lambda hash collision bug due to function descriptions lacking full parameter information 2024-09-27 13:24:57 -07:00
Vern Paxson
adf3648554 fixes (to avoid collisions) for AST profiling's function hash computations 2024-09-27 13:24:35 -07:00
Vern Paxson
a390b3665b removed unused ZAM cast-to-any operation 2024-09-27 13:24:35 -07:00
Vern Paxson
e7817b709c fixes for ZAM tracking the return type associated with function calls 2024-09-27 13:24:34 -07:00
Vern Paxson
56d01ea83b ZAM control-flow tracking now explicitly includes the ends of loops 2024-09-27 13:24:34 -07:00
Vern Paxson
b0e21b7e64 fix for ZAM identification of common subexpressions 2024-09-27 13:24:34 -07:00
Vern Paxson
e0e6c462ce "-O dump-final-ZAM" option similar to "dump-ZAM" only prints final version of functions 2024-09-27 13:24:30 -07:00
Vern Paxson
07d211419a fix for setting object locations to avoid use-after-free situation 2024-09-27 13:23:06 -07:00
Vern Paxson
a68ffc5316 extended "-O allow-cond" to apply to both gen-C++ and gen-standalone-C++ 2024-09-27 13:23:06 -07:00
Vern Paxson
5c38f7637d -O gen-C++ fix for run-time warnings for "when" lambdas 2024-09-27 13:23:06 -07:00
Vern Paxson
d1c31927c4 fix to -O gen-C++ for recent AST profiling changes for identifying function parameters 2024-09-27 13:23:06 -07:00
Vern Paxson
2b64e3b05e fix to -O gen-C++ for dealing with "hidden" parameters 2024-09-27 13:23:06 -07:00
Vern Paxson
8025ee74ef tweak to prevent an incorrect warning for scripts compiled to C++ 2024-09-27 13:23:06 -07:00
Vern Paxson
ed905c33cd fixed overly narrow Spicy test for manipulating packet analyzers 2024-09-27 13:23:06 -07:00
Vern Paxson
11a7ef42ef fixed memory leak for recursive ZAM functions that exit via an exception 2024-09-27 13:23:06 -07:00
Vern Paxson
c165e05b83 remove unnecessary header include 2024-09-27 13:23:06 -07:00
Arne Welzel
c36ae2f1a3 Merge branch 'pr/3946'
* pr/3946:
  Honor no plaintext password logging for PASS cmd

Closes #3946 - squashed commits into a single one.
2024-09-27 16:52:44 +02:00
Martin van Hensbergen
0e926afbc1 Honor no plaintext password logging for PASS cmd 2024-09-27 16:45:06 +02:00
Arne Welzel
989730c241 Merge remote-tracking branch 'origin/topic/awelzel/cluster-backends-pre-work-v1'
* origin/topic/awelzel/cluster-backends-pre-work-v1:
  NEWS: Update
  scripts/base/cluster: Move active node management into node_down()
  logging/Manager: Extract another CreateWriter() helper
  logging/Manager: Extract path_func invocation into helper
  logging: Dedicated log flush timer
  all: Change to use Func::GetName()
  script_opt: Use Func::GetName()
  Func: Add std::string name accessors, deprecate const char* versions
  plugin/ComponentManager: Support lookup by EnumValPtr
2024-09-27 15:37:47 +02:00
Arne Welzel
77b0f7d7ba NEWS: Update 2024-09-27 15:32:09 +02:00
Arne Welzel
6bb7b9d726 scripts/base/cluster: Move active node management into node_down()
With the idea of an alternative cluster backend, we should
not maintain Cluster state within low-level Broker events.
2024-09-27 15:32:09 +02:00
Arne Welzel
78999d147d logging/Manager: Extract another CreateWriter() helper
For other cluster backends, CreateWriter() will use a logger's filter
configuration rather than receiving all configuration through CreateLog.
Extract a helper out from WriteToFilters() for reuse.
2024-09-27 15:32:09 +02:00
Arne Welzel
16cca62292 logging/Manager: Extract path_func invocation into helper 2024-09-27 15:32:09 +02:00
Arne Welzel
0d925e935e logging: Dedicated log flush timer
Log flushing is currently triggered based on the threading heartbeat timer
of WriterBackends and the hard-coded WRITE_BUFFER_SIZE 1000.

This change introduces a separate timer that is managed by the logger
manager instead of piggy-backing on the heartbeat timer, as well as a
const &redef for the buffer size.

This allows to modify the log flush frequency and batch size independently
of the threading heartbeat interval. Later, this will allow to re-use the
buffering and flushing logic of writer frontends for non-Broker cluster
backends, too.

One change here is that even frontends that do not have a backend will
be flushed regularly. This is wanted for non-Broker backends and should be
very cheap. Possibly, Broker can piggy back on this timer down the road, too,
rather than using its own script-level timer (see Broker::log_flush()).
2024-09-27 15:30:35 +02:00
Arne Welzel
77b9510c8a all: Change to use Func::GetName() 2024-09-27 15:11:17 +02:00
Arne Welzel
71e9c8d436 script_opt: Use Func::GetName() 2024-09-27 15:11:17 +02:00
Arne Welzel
89127722ea Func: Add std::string name accessors, deprecate const char* versions 2024-09-27 15:11:17 +02:00
Arne Welzel
bf2ba626b1 plugin/ComponentManager: Support lookup by EnumValPtr 2024-09-27 15:11:03 +02:00
Arne Welzel
4aca6290a7 Merge remote-tracking branch 'origin/topic/awelzel/debug-stream-env'
* origin/topic/awelzel/debug-stream-env:
  zeek-setup: Support enabling debug streams through env variable
2024-09-27 15:00:04 +02:00
Arne Welzel
780976bf91 zeek-setup: Support enabling debug streams through env variable
For debugging btests, it can be convenient to enable debug streams
by setting an environment variable rather than editing zeek invocations
and adding -B selectively.

Sample use case:

    $ export ZEEK_DEBUG_LOG_STREAMS=all
    $ btest -d core/failing-test.zeek
    $ less .tmp/core/failing-test/debug.log

This change makes Zeek's -B option and ZEEK_DEBUG_LOG_STREAMS are additive.
2024-09-27 14:27:36 +02:00
Benjamin Bannier
a27066e3fc Merge remote-tracking branch 'origin/topic/bbannier/ci-opensuse-leap-ps-dep' 2024-09-27 11:09:47 +02:00
Benjamin Bannier
2d1c865654 Install procps in OpenSuse Leap images
The tests `core.sigterm-regular` and `core.sigterm-stdin` rely on `ps`
to be present which is not the case anymore on OpenSuse Leap; install it
explicitly there.
2024-09-27 10:00:13 +02:00
Benjamin Bannier
96c091f7ac Merge remote-tracking branch 'origin/topic/bbannier/bump-spicy' 2024-09-27 09:20:18 +02:00
Benjamin Bannier
c8a4436552 Bump auxil/spicy to latest development snapshot 2024-09-27 08:10:57 +02:00
Tim Wojtulewicz
632b989e44 Update docs submodule [nomail] 2024-09-24 16:12:58 -07:00
Tim Wojtulewicz
702fb031a4 Merge remote-tracking branch 'origin/topic/awelzel/3936-pop3-and-redis'
* origin/topic/awelzel/3936-pop3-and-redis:
  pop3: Remove unused headers
  pop3: Prevent unbounded state growth
  btest/pop3: Add somewhat more elaborate testing
2024-09-23 11:00:06 -07:00
Arne Welzel
b22ec06568 Merge remote-tracking branch 'origin/topic/etyp/enum-port-sizeof'
* origin/topic/etyp/enum-port-sizeof:
  Add enum value negative check
  Fix port/enum values `SizeOf` not being a count
2024-09-18 19:10:59 +02:00
Arne Welzel
922cb4d51f pop3: Remove unused headers 2024-09-18 19:05:39 +02:00
Arne Welzel
cf9fe91705 pop3: Prevent unbounded state growth
The cmds list may grow unbounded due to the POP3 analyzer being in
multiLine mode after seeing `AUTH` in a Redis connection, but never
a `.` terminator. This can easily be provoked by the Redis ping
command.

This adds two heuristics: 1) Forcefully process the oldest commands in
the cmds list and cap it at max_pending_commands. 2) Start raising
analyzer violations if the client has been using more than
max_unknown_client_commands commands (default 10).

Closes #3936
2024-09-18 19:05:39 +02:00
Arne Welzel
b4fdce8d5b btest/pop3: Add somewhat more elaborate testing
PCAP taken from here: https://tranalyzer.com/tutorial/pop and reference
added to Traces/README.
2024-09-18 17:31:13 +02:00
zeek-bot
2b21b101e1 Update doc submodule [nomail] [skip ci] 2024-09-18 00:13:17 +00:00
Arne Welzel
5a26a39d06 Merge remote-tracking branch 'origin/topic/awelzel/teredo-gtpv1-conn-removal-hook'
* origin/topic/awelzel/teredo-gtpv1-conn-removal-hook:
  btest: Update baselines for removal-hooks addition
  gtpv1: Replace connection_state_remove() with RemovalHook
  teredo: Replace connection_state_remove() with RemovalHook
  teredo: Move conn member from analyzer to encapsulation
2024-09-17 18:51:44 +02:00
Arne Welzel
f24bc1ee88 Merge remote-tracking branch 'origin/topic/awelzel/prom-callbacks-2'
* origin/topic/awelzel/prom-callbacks-2:
  Update broker submodule
  telemetry: Move callbacks to Zeek
  auxil/prometheus-cpp: Pin to 1.2.4
2024-09-17 18:51:12 +02:00
Arne Welzel
a5d93c4dec btest: Update baselines for removal-hooks addition
The removal_hooks field exists in bare mode (seems fine) and moved within the
connection record to earlier, so a bunch of baselines changed
2024-09-17 18:15:15 +02:00
Arne Welzel
9d4025804d gtpv1: Replace connection_state_remove() with RemovalHook 2024-09-17 18:15:09 +02:00
Arne Welzel
34956f4ca4 teredo: Replace connection_state_remove() with RemovalHook
Remove overhead of unconditionally calling remove_teredo_connection()
for *every* connection by installing a connection removal hook for only
when state was allocated.
2024-09-17 18:13:44 +02:00
Arne Welzel
6a930c1cf8 teredo: Move conn member from analyzer to encapsulation
There's only a single instance of the Teredo analyzer. Mutating the conn
member for every new packet and leaving it set after processing the
packet is confusing. Move conn into TeredoEncapsulation instead, or pass
it explicitly.
2024-09-17 18:13:33 +02:00
Evan Typanski
08348cd177 Add enum value negative check
There was one already at parse time, this adds a check later so that
cases like overflows or internal enums with negative values get caught.
2024-09-17 12:04:19 -04:00
Evan Typanski
d3dd8a155d Fix port/enum values SizeOf not being a count
Really, they both should be count. But, they were getting provided as an
integer. Port is easy since it is backed by an unsigned value. Enums
*should* be unsigned, but aren't. This doesn't address that, it just
takes the other name for this operator (absolute value) and makes the
enum value positive if it's negative.

This fixes a case where using the size of operator on enum/port values
in certain contexts (like the default parameter of a struct) would cause
an internal error.
2024-09-17 10:55:45 -04:00
Arne Welzel
617e7acd0f Update broker submodule
...to pin prometheus to 1.2.4
2024-09-12 13:06:02 +02:00
Tim Wojtulewicz
ba91de59b0 Merge remote-tracking branch 'mp/topic/mp-corelight/update-docker-env-syntax'
* mp/topic/mp-corelight/update-docker-env-syntax:
  Update Dockerfile to avoid LegacyKeyValueFormat warning
2024-09-12 09:18:56 +02:00
Arne Welzel
48dd89ef33 telemetry: Move callbacks to Zeek
Now that we run callbacks on the main loop, we can move callback support
for Counter and Gauge instances directly into Zeek and don't need to patch
prometheus-cpp anymore.
2024-09-12 09:12:24 +02:00
Tim Wojtulewicz
923ca7e817 Merge remote-tracking branch 'origin/topic/timw/strreplace-endless-loop'
* origin/topic/timw/strreplace-endless-loop:
  Fix potential endless loop in util::strreplace
2024-09-12 08:59:20 +02:00
Johanna Amann
899f7297d7 Merge remote-tracking branch 'origin/topic/timw/remove-negative-timestamp-test'
* origin/topic/timw/remove-negative-timestamp-test:
  Remove core.negative-time btest
2024-09-12 08:53:00 +02:00
Johanna Amann
a0ff0fb18b Merge remote-tracking branch 'origin/topic/johanna/reformat-spicy-ssl'
* origin/topic/johanna/reformat-spicy-ssl:
  Bump spicy-format to 0.16.2
  Bump spicy-format to 0.16.1
  Spicy SSL: reformat with new version of spicy format
2024-09-12 08:51:22 +02:00
Arne Welzel
c7fcdc4050 auxil/prometheus-cpp: Pin to 1.2.4 2024-09-12 08:28:24 +02:00
MP-Corelight
eed7982154
Update Dockerfile to avoid LegacyKeyValueFormat warning 2024-09-11 22:17:46 +02:00
Johanna Amann
0ef7a4e5dc Bump spicy-format to 0.16.2 2024-09-11 17:58:13 +02:00
Johanna Amann
c9e84883d6 Bump spicy-format to 0.16.1 2024-09-11 17:08:16 +02:00
Johanna Amann
86c542fd47 Spicy SSL: reformat with new version of spicy format 2024-09-11 17:06:01 +02:00
Johanna Amann
743e2a3663 Merge remote-tracking branch 'origin/topic/johanna/spicy-tls'
* origin/topic/johanna/spicy-tls: (31 commits)
  Spicy SSL: don't turn on compilation of Spicy SSL analyzer in all cases
  Spicy SSL analyzer - address feedback
  Spicy TLS: re-enable test and update test comments
  Spicy SSL: Skip private test suite for now.
  Spicy SSL - finish SSLv2 implementation
  Spicy TLS: SSLv2 client hello support.
  Spicy TLS - full test suite pass
  Spicy TLS - refactoring and partial connection fix
  Spicy SSL - run spicy-format
  Spicy-TLS: address review feedback re convert-functions
  Spicy TLS: address review feedback & run spicy-lint
  Spicy TLS: disable debug prints
  Add configure option to enable/disable spicy SSL
  Spicy TLS: inout/reference updates for recent spicy changes
  Spicy TLS: parse OCSP replies in TLS extension
  Spicy TLS: generate same file IDs as binpac analyzer
  Spicy TLS: skip CI; run performance tests
  Spicy TLS: fix parsing of no-extension hellos, port registration
  Spicy TLS: Re-enable starttls for RDP
  Spicy TLS: rename the analyzer to SSL
  ...
2024-09-11 16:59:17 +02:00
Johanna Amann
94f93d0704 Merge remote-tracking branch 'origin/master' into topic/johanna/spicy-tls
* origin/master: (27 commits)
  Update doc submodule [nomail] [skip ci]
  btest/ldap: Add regression test for #3919
  postgresql: Simplify SSL buffering and forwarding
  postgresql: Initial parser implementation
  testing/external: Update private baselines
  analyzer/syslog: Reformat with spicy-format
  analyzer/finger: Reformat with spicy-format
  scripts/spicy: Reformat with spicy-format
  pre-commit: Add spicy-format
  Check for netbios to avoid reporting extra bad DNS opcodes
  Add weird for unhandled opcodes in DNS analyzer
  Bump zeek-aux for zeek/zeek-aux#57
  Remove pre-commit exclusions for clang-format
  Bump clang-format
  Bump auxil/spicy to latest development snapshot
  RunState: Drop broker_mgr->Active() usage
  script_opt/ZAM/IterInfo.h: Add missing Dict.h dependency
  script_opt/ZAM: ZBody.h / Support.h: Cleanup includes, use forward declarations
  script_opt/ZAM/Profile: Remove Zeek header includes
  script_opt: Extend Support.h to break include dependencies
  ...
2024-09-11 14:13:19 +02:00
Johanna Amann
fc5047be94 Spicy SSL: don't turn on compilation of Spicy SSL analyzer in all cases
Turned out to be more complex than hoped.
2024-09-11 12:10:59 +02:00
Johanna Amann
cf1074518e Spicy SSL analyzer - address feedback
Minor proposed changes from https://github.com/zeek/zeek/pull/3765,
mostly cosmetic.

Changes CI to be part of an already existing spicy CI job.
2024-09-11 11:30:16 +02:00
Tim Wojtulewicz
6b11252b8f Fix potential endless loop in util::strreplace 2024-09-11 11:21:25 +02:00
Tim Wojtulewicz
50ce13b201 Remove core.negative-time btest 2024-09-11 10:14:34 +02:00
Arne Welzel
ede4e661cd Merge remote-tracking branch 'origin/topic/awelzel/script-opt-less-includes'
* origin/topic/awelzel/script-opt-less-includes:
  script_opt/ZAM/IterInfo.h: Add missing Dict.h dependency
  script_opt/ZAM: ZBody.h / Support.h: Cleanup includes, use forward declarations
  script_opt/ZAM/Profile: Remove Zeek header includes
  script_opt: Extend Support.h to break include dependencies
  script_opt: Do not include ZBody.h in ZAM/Validate.cc
2024-09-09 13:25:33 +02:00
zeek-bot
3dfd20ef50 Update doc submodule [nomail] [skip ci] 2024-09-07 00:11:33 +00:00
Arne Welzel
a339cfa4c0 Merge remote-tracking branch 'origin/topic/awelzel/3919-ldap-logs-missing'
* origin/topic/awelzel/3919-ldap-logs-missing:
  btest/ldap: Add regression test for #3919
2024-09-06 19:17:49 +02:00
Arne Welzel
26c4d0df8b btest/ldap: Add regression test for #3919
This works as expected in master, it's just that we forgot to backport
PR #3845 to 7.0.1. Add the PCAP from Martin anyhow.

Closes #3919.
2024-09-06 19:16:49 +02:00
Arne Welzel
b9ca50c6bb Merge remote-tracking branch 'origin/topic/awelzel/add-postgresql-parser'
* origin/topic/awelzel/add-postgresql-parser:
  postgresql: Simplify SSL buffering and forwarding
  postgresql: Initial parser implementation
2024-09-06 17:47:52 +02:00
Arne Welzel
d0da13413b postgresql: Simplify SSL buffering and forwarding
The ssl_sink can only be connected form the backend side, so don't
overcomplicate it.
2024-09-06 16:11:19 +02:00
Arne Welzel
85ca59484b postgresql: Initial parser implementation
This adds a protocol parser for the PostgreSQL protocol and a new
postgresql.log similar to the existing mysql.log.

This should be considered preliminary and hopefully during 7.1 and 7.2
with feedback from the community, we can improve on the events and logs.
Even if most PostgreSQL communication is encrypted in the real-world, this
will minimally allow monitoring of the SSLRequest and hand off further
analysis to the SSL analyzer.

This originates from github.com/awelzel/spicy-postgresql, with lots of
polishing happening in the past two days.
2024-09-06 16:10:48 +02:00
Arne Welzel
2907d9feee Merge remote-tracking branch 'origin/topic/awelzel/add-spicy-format'
* origin/topic/awelzel/add-spicy-format:
  testing/external: Update private baselines
  analyzer/syslog: Reformat with spicy-format
  analyzer/finger: Reformat with spicy-format
  scripts/spicy: Reformat with spicy-format
  pre-commit: Add spicy-format
2024-09-05 19:19:49 +02:00
Arne Welzel
f35835c8f9 testing/external: Update private baselines 2024-09-05 19:11:05 +02:00
Arne Welzel
526c903c01 analyzer/syslog: Reformat with spicy-format 2024-09-05 19:11:05 +02:00
Arne Welzel
dae4b1fcd9 analyzer/finger: Reformat with spicy-format 2024-09-05 19:11:05 +02:00
Arne Welzel
cde5662779 scripts/spicy: Reformat with spicy-format 2024-09-05 19:11:05 +02:00
Arne Welzel
01ea74f8a8 pre-commit: Add spicy-format
This excludes the larger protocol analyzers. These should be formatted
during the 7.2 cycle, shortly before 8.0.
2024-09-05 19:11:05 +02:00
Tim Wojtulewicz
d4a646cd21 Merge remote-tracking branch 'origin/topic/timw/dns-opcode-check'
* origin/topic/timw/dns-opcode-check:
  Check for netbios to avoid reporting extra bad DNS opcodes
  Add weird for unhandled opcodes in DNS analyzer
2024-09-04 14:53:31 -07:00
Tim Wojtulewicz
6394f9893e Check for netbios to avoid reporting extra bad DNS opcodes 2024-09-04 13:07:00 -07:00
Tim Wojtulewicz
269ca3189c Add weird for unhandled opcodes in DNS analyzer 2024-09-04 13:01:24 -07:00
Tim Wojtulewicz
cd10bd3747 Merge remote-tracking branch 'origin/topic/bbannier/bump-spicy'
* origin/topic/bbannier/bump-spicy:
  Bump auxil/spicy to latest development snapshot
2024-09-03 09:04:03 -07:00
Benjamin Bannier
dffef94d4d Merge branch 'topic/bbannier/bump-clang-format' 2024-09-03 10:18:39 +02:00
Arne Welzel
cdae755a0c Bump zeek-aux for zeek/zeek-aux#57 2024-09-03 10:03:22 +02:00
Benjamin Bannier
629d273f44 Remove pre-commit exclusions for clang-format
We previously would ignore any files under `auxil/`. Since pre-commit
only formats files tracked in this repo, and `auxil/` today contains
only submodules this exclusion did not exclude anything; if however we
ever end up adding C++ files under `auxil/` we would like them to be
formatted consistently.
2024-09-02 16:49:07 +02:00
Benjamin Bannier
db42b2cfe5 Bump clang-format
This patch contains a bump of the configured clang-format version from
17.0.3 to 18.1.8 and automatically generated C++ source updates. The
main difference we are seeing from this is fixes for previously
incomplete reformats.
2024-09-02 16:46:59 +02:00
Benjamin Bannier
06d2568c58 Bump auxil/spicy to latest development snapshot 2024-09-02 16:36:27 +02:00
Arne Welzel
c27e18631c Merge branch 'fix-http-password-capture' of https://github.com/p-l-/zeek
* 'fix-http-password-capture' of https://github.com/p-l-/zeek:
  http: fix password capture when enabled
2024-08-30 18:56:48 +02:00
Arne Welzel
435770f99a Merge remote-tracking branch 'origin/topic/awelzel/no-broker-mgr-active'
* origin/topic/awelzel/no-broker-mgr-active:
  RunState: Drop broker_mgr->Active() usage
2024-08-30 15:39:06 +02:00
Arne Welzel
f6fdd16b81 Merge remote-tracking branch 'origin/topic/awelzel/less-threading-star-star'
* origin/topic/awelzel/less-threading-star-star:
  logging/WriterFrontend: No need for explicit CleanupWriteBuffer()
  logging: Switch index-assignment of raw pointers to emplace_back()
  broker/logging: Change threading::Value** usage std::vector instead
  threading/Value: Support move and copy constructors
2024-08-30 15:38:47 +02:00
Arne Welzel
a9e4a45310 RunState: Drop broker_mgr->Active() usage
...and deprecate it. The communication_enabled flag doesn't really
make a difference in how the IO loop works.
2024-08-30 15:36:56 +02:00
Arne Welzel
c9ff8d0312 script_opt/ZAM/IterInfo.h: Add missing Dict.h dependency
Triggered when trying to remove some other includes elsewhere.
2024-08-30 14:20:17 +02:00
Arne Welzel
d843eb5c2b script_opt/ZAM: ZBody.h / Support.h: Cleanup includes, use forward declarations
Not sure the IsAny() convenience functions were really worth the
include zeek/Expr.h.
2024-08-30 14:20:17 +02:00
Arne Welzel
29536d6453 script_opt/ZAM/Profile: Remove Zeek header includes
This can stand by itself.
2024-08-30 14:19:26 +02:00
Arne Welzel
4e7bb59bb1 script_opt: Extend Support.h to break include dependencies
Rebuilding ZBody.cc is annoyingly slow with UBSAN or ASAN enabled. A rebuild
is currently triggered when touching Manager.h files like logging/Manager.h,
broker/Manager.h or file_analysis/Manager.h and various other headers that are
included from there or directly in ZBody.h.

Add tiny wrapper functions to Support.h that encapsulate the actual Zeek
functionality and move the includes to Support.cc instead. This will
cause frequent Support.cc rebuilds, but that is decently fast.

This comes at the expense of one indirect function call for some ops, but
its overhead should be negligible in comparison to a lookup for a
connection or component or a log_mgr->Write() call.
2024-08-30 14:19:26 +02:00
Arne Welzel
f0ab10a46c logging/WriterFrontend: No need for explicit CleanupWriteBuffer()
Any pending records will be cleaned in the destructor of WriterFrontend
and WriteBuffer, no need to do this explicitly.
2024-08-30 11:00:17 +02:00
Arne Welzel
a9290cc031 logging: Switch index-assignment of raw pointers to emplace_back() 2024-08-30 10:59:55 +02:00
Arne Welzel
245fd0c94f broker/logging: Change threading::Value** usage std::vector instead
This allows to leverage automatic memory management, less allocations
and using move semantics for expressing ownership.

This breaks the existing logging and broker API, but keeps the plugin
DoWrite() and HookLogWrite() methods functioning.

It further changes ValToLogVal to return a threading::Value rather than
a threading::Value*. The vector_val and set_val fields unfortunately
use the same pointer-to-array-of-pointers approach. this can'tbe changed
as it'd break backwards compatibility for plugin provided input readers
and log writers.
2024-08-30 10:58:57 +02:00
Arne Welzel
e79ce27c9f threading/Value: Support move and copy constructors 2024-08-30 10:58:23 +02:00
Arne Welzel
bbd7adc0dc script_opt: Do not include ZBody.h in ZAM/Validate.cc
Touching broker/Manager.h or logging/Manager.h or anything that's
included in ZBody.h results in a rebuild of a bunch of files in ZAM.
Particularly, ZAM/Validate.cc takes much too long to recompile for
me (45+ seconds) and apparently that's mostly by accident.

Clean up the ZAM/Validate.cc includes to prevent this.
2024-08-29 10:21:56 +02:00
Pierre Lalet
88368ae856 http: fix password capture when enabled
The current implementation would only log, if the password contains a
colon, the part before the first colon (e.g., the password
`password:password` would be logged as `password`).

A test has been added to confirm the expected behaviour.
2024-08-28 21:44:39 +02:00
zeek-bot
79ebce6e3c Update doc submodule [nomail] [skip ci] 2024-08-28 00:11:20 +00:00
Johanna Amann
cc82bdf87c Spicy TLS: re-enable test and update test comments
Enable a test that was forgotten, and update comments in some testcases
2024-08-27 14:30:47 +01:00
Johanna Amann
01eacb3fa0 Spicy SSL: Skip private test suite for now.
The reason that this is necessary is the end-of-connection-handling of
spicy. If spicy is in the middle of parsing some bytes while the
connection ends, an error is raised. This behavior cannot be changed,
and means that there will be a DPD-log entry, etc. for connections that
are completely valid TLS connections - that just happen to be truncated
and end in the middle.
2024-08-27 14:27:24 +01:00
Johanna Amann
c186726bfa Merge remote-tracking branch 'origin/master' into topic/johanna/spicy-tls
* origin/master:
  Update doc submodule [nomail] [skip ci]
  Analyzer: Do not add child analyzers when finished
  Fix parsing of version field in SSLv2 client hello
  TCP_Reassembler: Fix IsOrig() position in Match() call
  Spicy: Register well-known ports through an event handler.
  Update doc submodule [nomail] [skip ci]
  Revert "Remove deprecated port/ports fields for spicy analyzers"
  Make ssl_history work for SSLv2 handshakes/connections
2024-08-27 13:42:03 +01:00
Johanna Amann
d89c0d1ef7 Merge remote-tracking branch 'origin/topic/johanna/fix-ssl2-client-hello-version-parsing'
* origin/topic/johanna/fix-ssl2-client-hello-version-parsing:
  Fix parsing of version field in SSLv2 client hello
2024-08-27 13:31:12 +01:00
zeek-bot
617faa1d33 Update doc submodule [nomail] [skip ci] 2024-08-24 00:20:43 +00:00
Arne Welzel
45b33bf5c1 Merge remote-tracking branch 'origin/topic/awelzel/no-child-analyzer-on-finished-connections'
* origin/topic/awelzel/no-child-analyzer-on-finished-connections:
  Analyzer: Do not add child analyzers when finished
2024-08-23 14:19:00 +02:00
Arne Welzel
be9f170561 Analyzer: Do not add child analyzers when finished
Depending on an analyzer's implementation, its Done() method may
attempt to access analyzer or connection state when executing.
When this happens in the destructor of the parent analyzer during
the process of destructing a connection, this state may have been
deleted, resulting in use-after-free crashes or worse memory
corruption.

The following cases have been observed in the wild for when this happens.

  * PIA matching during Done() for undelivered TCP data enables a Spicy
    based analyzer which in turn attempts to raise an analyzer violation
    during Done()->EndOfData().

  * Spicy analyzers attaching new analyzers during their Done() processing
    which in turn attempt to use TCP() (to call FindChild()) during Done()
    while the analyzer tree / connection is being destructed.

The second scenario was previously found to happen in the HTTP analyzer
and fixed with 6ef9423f3c.

Plug these scenarios by short-circuiting AddChildAnalyzer() if the analyzer
or connection have finished or are being finished.
2024-08-23 09:57:20 +02:00
Arne Welzel
4a4cbf2576 Merge remote-tracking branch 'origin/topic/awelzel/tcp-reassembler-undelivered-data-match-bool-bool-bool-confusion'
* origin/topic/awelzel/tcp-reassembler-undelivered-data-match-bool-bool-bool-confusion:
  TCP_Reassembler: Fix IsOrig() position in Match() call
2024-08-23 09:41:07 +02:00
Robin Sommer
a2079bcda6
Merge remote-tracking branch 'origin/topic/robin/gh-3881-spicy-ports'
* origin/topic/robin/gh-3881-spicy-ports:
  Spicy: Register well-known ports through an event handler.
  Revert "Remove deprecated port/ports fields for spicy analyzers"
2024-08-23 08:10:02 +02:00
Johanna Amann
91885f7518 Spicy SSL - finish SSLv2 implementation
The events raised should be on-par with the Zeek TLS/SSL analyzer now.

DTLS support is still missing.
2024-08-22 15:28:14 +01:00
Johanna Amann
a6edbf8bcd Fix parsing of version field in SSLv2 client hello
It turns out that, for probably a long time, we have reported an
incorrect version when parsing an SSLv2 client hello. We always reported
this as SSLv2, no matter which version the client hello actually
contained.

This bug probably went unnoticed for a long time, as SSLv2 is
essentially unused nowadays, and as this field does not show up in the
default logs.

This was found due to a baseline difference when writing the Spicy SSL
analyzer.
2024-08-22 13:14:24 +01:00
Arne Welzel
4576741fe4 TCP_Reassembler: Fix IsOrig() position in Match() call
Found during a debug session with @rsmmr. Undelivered TCP data
would only be matched for the responder and eol set to IsOrig().
2024-08-22 13:43:44 +02:00
Robin Sommer
0d3296590d
Spicy: Register well-known ports through an event handler.
This avoids the earlier problem of not tracking ports correctly in
scriptland, while still supporting `port` in EVT files and `%port` in
Spicy files.

As it turns out we are already following the same approach for file
analyzers' MIME types, so I'm applying the same pattern: it's one
event per port, without further customization points. That leaves the
patch pretty small after all while fixing the original issue.
2024-08-22 10:24:55 +02:00
zeek-bot
4b369bad2d Update doc submodule [nomail] [skip ci] 2024-08-21 00:14:27 +00:00
Johanna Amann
2aae73ea75 Spicy TLS: SSLv2 client hello support.
This lets us parse traces that use the old SSLv2 client hello format,
while actually negotiating SSLv3 and above.
2024-08-20 16:06:46 +01:00
Johanna Amann
71d2e8d961 Merge remote-tracking branch 'origin/master' into topic/johanna/spicy-tls
* origin/master: (60 commits)
  Update gen-zam submodule [nomail] [skip ci]
  Update doc submodule [nomail] [skip ci]
  Remove unused wrapper packet analyzer
  Add DNS TKEY event
  ScriptOpt: Ensure global statements have non-null scope
  simpler and more robust identification of function parameters for AST profiling
  fixes to limit AST traversal in the face of recursive types
  address some script optimization compiler warnings under Linux
  fix for -O C++ construction of variable names that use multiple module namespaces
  fix for script optimization of "opaque" values that are run-time constants
  fix for script optimization of nested switch statements
  script optimization fix for complex "in" expressions in conditionals
  updates to typos allow-list reflecting ZAM regularization changes
  BTest updates for ZAM regularization changes
  convert new ZAM operations to use typed operands
  complete migration of ZAM to use only public ZVal methods
  "-O validate-ZAM" option to validate generated ZAM instructions
  internal option to suppress control-flow optimization
  exposing some functionality for greater flexibility in structuring run-time execution
  rework ZAM compilation of type switches to leverage value switches
  ...
2024-08-20 13:01:31 +01:00
Johanna Amann
2f07ca9e7f Merge remote-tracking branch 'origin/topic/johanna/ssl-history-also-for-sslv2-not-only-for-things-that-use-the-more-modern-handshake'
* origin/topic/johanna/ssl-history-also-for-sslv2-not-only-for-things-that-use-the-more-modern-handshake:
  Make ssl_history work for SSLv2 handshakes/connections
2024-08-20 11:40:20 +01:00
Arne Welzel
5ac5f5f24f Merge remote-tracking branch 'origin/topic/awelzel/broker-deprecate-valp-list-interface'
* origin/topic/awelzel/broker-deprecate-valp-list-interface:
  broker: Deprecate MakeEvent(ValPList*)
  Span: Remove deduction guideline for Iter, Iter, include cleanup
2024-08-20 10:11:11 +02:00
Arne Welzel
8920637397 Merge remote-tracking branch 'origin/topic/awelzel/global-stmts-scope-fixup'
* origin/topic/awelzel/global-stmts-scope-fixup:
  ScriptOpt: Ensure global statements have non-null scope
2024-08-20 10:10:27 +02:00
Tim Wojtulewicz
b26c44ae72 Update gen-zam submodule [nomail] [skip ci] 2024-08-19 14:15:18 -07:00
Robin Sommer
547144d07e
Revert "Remove deprecated port/ports fields for spicy analyzers"
This reverts commit 15d404dd19.
2024-08-19 09:57:04 +02:00
zeek-bot
9ea316e9a4 Update doc submodule [nomail] [skip ci] 2024-08-17 00:23:21 +00:00
Tim Wojtulewicz
00c2e9afce Merge remote-tracking branch 'J-Gras/topic/jgras/remove-wrapper-analyzer'
* J-Gras/topic/jgras/remove-wrapper-analyzer:
  Remove unused wrapper packet analyzer
2024-08-16 09:06:51 -07:00
Arne Welzel
f21da04c3e Merge remote-tracking branch 'origin/topic/etyp/dns-tkey'
* origin/topic/etyp/dns-tkey:
  Add DNS TKEY event
2024-08-16 16:51:58 +02:00
Jan Grashoefer
64bc852fbe Remove unused wrapper packet analyzer
This is a leftover from the migration to the packet analysis framework.
The analyzer wrapped the original packet analysis code for comparison.
2024-08-16 16:49:12 +02:00
Evan Typanski
170276807b Add DNS TKEY event 2024-08-16 10:20:42 -04:00
Arne Welzel
9d1d4e28b3 ScriptOpt: Ensure global statements have non-null scope
The ProfileFunc() logic assumed that GetScope() returned a non-nullptr.
This holds except for the synthetic global statements function.

Fix the latter and add an assert, also add a name to the type so it's
easier to recognize in a debugger what's going on, otherwise the name
is "".

This was found by UBSAN due to it seeing the ->OrderedVars() call on a
nullptr. Elsewhere, num_params == 0 shielded from that access and so
didn't lead to crashes.
2024-08-16 13:59:24 +02:00
Arne Welzel
ec1088c3ef Merge remote-tracking branch 'origin/topic/vern/zam-regularization'
* origin/topic/vern/zam-regularization: (33 commits)
  simpler and more robust identification of function parameters for AST profiling
  fixes to limit AST traversal in the face of recursive types
  address some script optimization compiler warnings under Linux
  fix for -O C++ construction of variable names that use multiple module namespaces
  fix for script optimization of "opaque" values that are run-time constants
  fix for script optimization of nested switch statements
  script optimization fix for complex "in" expressions in conditionals
  updates to typos allow-list reflecting ZAM regularization changes
  BTest updates for ZAM regularization changes
  convert new ZAM operations to use typed operands
  complete migration of ZAM to use only public ZVal methods
  "-O validate-ZAM" option to validate generated ZAM instructions
  internal option to suppress control-flow optimization
  exposing some functionality for greater flexibility in structuring run-time execution
  rework ZAM compilation of type switches to leverage value switches
  add tracking of control flow information
  factoring of ZAM operation specifications into separate files
  updates to ZAM operations / gen-zam regularization, other than the operations themselves
  type-checking fix for vector-of-string operations
  ZVal constructor for booleans
  ...
2024-08-16 12:10:33 +02:00
Vern Paxson
2477213619 simpler and more robust identification of function parameters for AST profiling 2024-08-16 11:19:02 +02:00
Vern Paxson
691a4003b7 fixes to limit AST traversal in the face of recursive types 2024-08-16 11:19:02 +02:00
Vern Paxson
910a2f6c59 address some script optimization compiler warnings under Linux 2024-08-16 11:19:02 +02:00
Vern Paxson
202c405a1e fix for -O C++ construction of variable names that use multiple module namespaces 2024-08-16 11:19:02 +02:00
Vern Paxson
6faad5e5ca fix for script optimization of "opaque" values that are run-time constants 2024-08-16 11:19:02 +02:00
Vern Paxson
3f52cbcbc7 fix for script optimization of nested switch statements 2024-08-16 11:19:02 +02:00
Vern Paxson
a947d96160 script optimization fix for complex "in" expressions in conditionals 2024-08-16 11:19:02 +02:00
Vern Paxson
42bf164dc4 updates to typos allow-list reflecting ZAM regularization changes 2024-08-16 11:19:02 +02:00
Vern Paxson
bf3cf9da48 BTest updates for ZAM regularization changes 2024-08-16 11:18:58 +02:00
Vern Paxson
3b6df1ab7f convert new ZAM operations to use typed operands 2024-08-16 11:18:58 +02:00
Vern Paxson
3e1b536810 complete migration of ZAM to use only public ZVal methods 2024-08-16 11:18:58 +02:00
Vern Paxson
1457099df3 "-O validate-ZAM" option to validate generated ZAM instructions 2024-08-16 11:18:58 +02:00
Vern Paxson
db22448270 internal option to suppress control-flow optimization 2024-08-16 11:18:58 +02:00
Vern Paxson
63f76c7f84 exposing some functionality for greater flexibility in structuring run-time execution 2024-08-16 11:18:58 +02:00
Vern Paxson
65e713e6ea rework ZAM compilation of type switches to leverage value switches 2024-08-16 11:18:58 +02:00
Vern Paxson
a1185ee6bb add tracking of control flow information 2024-08-16 11:18:58 +02:00
Vern Paxson
e94764982d factoring of ZAM operation specifications into separate files 2024-08-16 11:18:58 +02:00
Vern Paxson
5fc2c601b4 updates to ZAM operations / gen-zam regularization, other than the operations themselves 2024-08-16 11:18:58 +02:00
Vern Paxson
1d7e71b499 type-checking fix for vector-of-string operations 2024-08-16 11:18:57 +02:00
Vern Paxson
3cf3cc3c5e ZVal constructor for booleans 2024-08-16 11:18:57 +02:00
Vern Paxson
88740acffe fix for nit in base/protocols/krb/main.zeek 2024-08-16 11:18:57 +02:00
Vern Paxson
1253af42f9 mark functions skipped by ZAM compilation as such 2024-08-16 11:18:57 +02:00
Vern Paxson
11e9135f80 fix for avoiding inadvertent interpreter errors in CallExpr::IsPure() 2024-08-16 11:18:57 +02:00
Vern Paxson
37fcb231fa support for traversing ZAM code similar to AST traversal 2024-08-16 11:18:57 +02:00
Vern Paxson
85a8f0739c run-time warnings for scripts compiled to C++ 2024-08-16 11:18:57 +02:00
Vern Paxson
b333d24e0e allow C++ script compiler access to type internals 2024-08-16 11:18:57 +02:00
Vern Paxson
e93db75f78 fixes for script optimization of coerce-to-any expressions 2024-08-16 11:18:57 +02:00
Vern Paxson
cfb068a922 fix to correctly track whether a capture needs deep-copying 2024-08-16 11:18:57 +02:00
Vern Paxson
e6fe20f140 fix for -O report-C++ 2024-08-16 11:18:57 +02:00
Vern Paxson
857df9f063 support for more in-depth AST profiling 2024-08-16 11:18:57 +02:00
Vern Paxson
d2c6208421 allow profiling without updating of hash values 2024-08-16 11:18:57 +02:00
Vern Paxson
3962810e4b ListVal method to clear the list to allow reusing w/o new construction 2024-08-16 11:18:54 +02:00
Arne Welzel
ed0ba237a1 broker: Deprecate MakeEvent(ValPList*)
The variadic broker messaging BIFs currently convert @ARGS@ into a
ValPList before passing it on to MakeEvent(). This appears historic
plumbing. Implement the same functionality using Span<const ValPtr>
and do the extra copying in the now deprecated MakeEvent().

Further, make passing a frame optional as not all callers may
have one available.
2024-08-16 10:48:02 +02:00
Arne Welzel
8553fb96bd Span: Remove deduction guideline for Iter, Iter, include cleanup
We don't have a constructor for that, so that's confusing, also
<array> isn't used.
2024-08-16 10:47:45 +02:00
Arne Welzel
ac5cbcc43e Merge remote-tracking branch 'origin/topic/vern/cpp-init'
* origin/topic/vern/cpp-init:
  Func: Add SetCapturesVec()
  marked some recently added BTests as not suitable for -O gen-C++ testing
  robustness improvements for -O gen-C++ generation of lambdas / "when"s
  speedups for compilation of initializers in -O gen-C++ generated code
  fixes for -O gen-C++ generation of floating point constants
  -O gen-C++ fix for dealing with use of more than one module qualifier
  header tweaks to provide gen-C++ script optimization with more flexibility
  fix for script optimization of constants of type "opaque"
  fix for script optimization of "in" operations
  some minor tidying of -O gen-C++ sources
2024-08-15 10:30:48 +02:00
Arne Welzel
5e36709905 Func: Add SetCapturesVec()
Add an API to directly set captures_vec for use by C++ compilation. The
current code keys off or asserts on ZAM stmts, making it difficult to
leverage captures_vec in other contexts.
2024-08-15 10:10:00 +02:00
zeek-bot
0a495c996c Update doc submodule [nomail] [skip ci] 2024-08-15 00:11:45 +00:00
Arne Welzel
52d51f2c63 Merge remote-tracking branch 'origin/topic/awelzel/3880-mysql-caching-sha2-password-successful'
* origin/topic/awelzel/3880-mysql-caching-sha2-password-successful:
  mysql: Implement and test COM_CHANGE_USER
  mysql: Remove auth plugin state
  mysql: Handle server connection phase separately from command phase
2024-08-14 20:12:39 +02:00
Arne Welzel
02f4665e9b mysql: Implement and test COM_CHANGE_USER
This reworks the parser such that COM_CHANGE_USER switches the
connection back into the CONNECTION_PHASE so that we can remove the
EXPECT_AUTH_SWITCH special case in the COMMAND_PHASE. Adds two pcaps
produced with Python that actually do COM_CHANGE_USER as it seems
not possible from the MySQL CLI.
2024-08-14 10:20:01 +02:00
zeek-bot
6a997af9a1 Update doc submodule [nomail] [skip ci] 2024-08-14 00:16:13 +00:00
Vern Paxson
5e35334281 marked some recently added BTests as not suitable for -O gen-C++ testing 2024-08-13 14:46:08 -07:00
Vern Paxson
207b82ae4b robustness improvements for -O gen-C++ generation of lambdas / "when"s 2024-08-13 14:45:33 -07:00
Vern Paxson
0ca2f9a8b2 speedups for compilation of initializers in -O gen-C++ generated code 2024-08-13 14:43:17 -07:00
Vern Paxson
6daf9d5b88 fixes for -O gen-C++ generation of floating point constants 2024-08-13 14:42:25 -07:00
Vern Paxson
a93a69ba62 -O gen-C++ fix for dealing with use of more than one module qualifier 2024-08-13 14:41:51 -07:00
Vern Paxson
77c34787f3 header tweaks to provide gen-C++ script optimization with more flexibility 2024-08-13 14:37:06 -07:00
Vern Paxson
5a3b519fb4 fix for script optimization of constants of type "opaque" 2024-08-13 14:33:00 -07:00
Vern Paxson
03347e235b fix for script optimization of "in" operations 2024-08-13 14:32:23 -07:00
Vern Paxson
769a3d958a some minor tidying of -O gen-C++ sources 2024-08-13 14:29:26 -07:00
Arne Welzel
a4c79e7304 mysql: Remove auth plugin state
Now that we use CONNECTION_PHASE and interpret AuthSwitchRequest
correctly, we can remove reliance on the plugin discrepancy to
determine expectations.
2024-08-13 22:06:36 +02:00
Arne Welzel
b1c63ae4e0 mysql: Handle server connection phase separately from command phase
This avoids interpreting an AuthSwitchRequest (0xfe) during the command
phase as EOF_Packet.

Thanks @AmazingPP.

Closes #3880
2024-08-13 22:06:25 +02:00
Johanna Amann
1fe6a02169 Make ssl_history work for SSLv2 handshakes/connections
It turns out that the ssl_history field never was populated with C/S for
SSLv2 connections, or connections using the SSLv2 handshake. In our
testcases, the latter is especially common - with connections up to TLS1
using the old SSLv2 client hello for backwards compatibility.

This change resolves this issue. As the history is not by default
enabled in a lot of locations, baseline impact is minor.
2024-08-13 18:03:06 +01:00
Johanna Amann
84c4d53a4e Spicy TLS - full test suite pass
With this commit, the entire Zeek test suite passes using spicy TLS.
Tests that either use a SSLv2 handshake, or DTLS are skipped, as the
parser currently does not support either.

Similarly, tests that rely on behavior we cannot replicate (baseline,
hooks, exact error messages) are passed. Other than that, all the
TLS-based tests pass with 100% the exact same baseline results.

This necessitated a couple of small tweaks to the spicy file - the
testcases uncovered several small problems.

This commit also enables cirrus tests for Spicy SSL/TLS.
2024-08-13 14:41:37 +01:00
Arne Welzel
44a3ed676b Merge remote-tracking branch 'jgras/topic/jgras/packet-analyzer-history-rework'
* jgras/topic/jgras/packet-analyzer-history-rework:
  Deprecate old unknown_protocol event signature
  Use raw pointer for packet analyzer history
  Update external baselines for analyzer history
  Update btest baselines for analyzer history
  Add packet analyzer history
2024-08-13 12:37:41 +02:00
Johanna Amann
1e282989fe Merge remote-tracking branch 'origin/master' into topic/johanna/spicy-tls
* origin/master: (93 commits)
  spicyz: Add back message about removed support for port / ports in evt
  rule-parse: Remove id_to_str() lookup to squelch coverity warning
  Update doc submodule [nomail] [skip ci]
  Update zeekctl submodule [nomail]
  btest: Skip core.script-args under TSAN
  Update doc submodule [nomail] [skip ci]
  Update zeekctl submodule
  Add note to NEWS about the removal of OpaqueVal::DoSerialize and OpaqueVal::DoUnserialize
  Remove deprecated port/ports fields for spicy analyzers
  Remove deprecated Cluster::Node::interface field
  Remove deprecated signature definition format
  Return an error if GLOBAL:: prefix is used
  Remove deprecated BloomFilter serialization methods
  Remove deprecated OpaqueVal serialization methods
  Remove deprecated DECLARE_OPAQUE_VALUE macro
  Make TypePtr::Capture member variables private
  Remove deprecated Trigger constructor
  Remove deprecated Controller::auto_assign_ports and Controller::auto_assign_start_port
  Remove deprecated load-balacing policy script
  Remove deprecated prometheus telemetry policy script
  ...
2024-08-13 10:37:52 +01:00
Jan Grashoefer
e14f3bae70 Deprecate old unknown_protocol event signature 2024-08-12 21:44:02 +02:00
Jan Grashoefer
c73fcdec3d Use raw pointer for packet analyzer history 2024-08-12 16:08:18 +02:00
Jan Grashoefer
b4e83aca8c Update external baselines for analyzer history 2024-08-12 12:21:09 +02:00
Jan Grashoefer
f18c28cfe5 Update btest baselines for analyzer history 2024-08-12 12:21:09 +02:00
Jan Grashoefer
29bc84e1d6 Add packet analyzer history 2024-08-12 12:21:00 +02:00
Arne Welzel
f943366e8e Merge remote-tracking branch 'origin/topic/awelzel/spicyz-add-back-port-ports-message'
* origin/topic/awelzel/spicyz-add-back-port-ports-message:
  spicyz: Add back message about removed support for port / ports in evt
2024-08-12 11:07:40 +02:00
Arne Welzel
a5aadc11db spicyz: Add back message about removed support for port / ports in evt
spicy-dhcp, spicy-http and spicy-dns all have this still in their .evt files,
so it seems popular. Be more helpful than "unexpected token" to users.
2024-08-12 09:45:56 +02:00
Arne Welzel
32cbe953ba Merge remote-tracking branch 'origin/topic/awelzel/rule-parse-fix-coverity-leak'
* origin/topic/awelzel/rule-parse-fix-coverity-leak:
  rule-parse: Remove id_to_str() lookup to squelch coverity warning
2024-08-09 20:57:40 +02:00
Arne Welzel
fa9dc159a2 rule-parse: Remove id_to_str() lookup to squelch coverity warning
Coverity didn't like that id_to_str() allocates memory and we didn't
free it. Remote its usage wholesale.
2024-08-09 09:49:43 +02:00
zeek-bot
371dcdc94e Update doc submodule [nomail] [skip ci] 2024-08-09 00:10:26 +00:00
Arne Welzel
159f40a4bf Merge remote-tracking branch 'upstream/topic/awelzel/3774-skip-script-args-test-under-tsan'
* upstream/topic/awelzel/3774-skip-script-args-test-under-tsan:
  btest: Skip core.script-args under TSAN
2024-08-08 18:53:23 +02:00
Tim Wojtulewicz
4298fe16ca Update zeekctl submodule [nomail] 2024-08-08 09:44:07 -07:00
Arne Welzel
3e6511af41 btest: Skip core.script-args under TSAN
TSAN may re-execute the executable when the memory layout doesn't
fullfill requirements, causing argument confusion when that happens.

Closes #3774.
2024-08-08 15:32:20 +02:00
Arne Welzel
39a9b64219 Merge remote-tracking branch 'origin/topic/timw/remove-cluster-interface-field-zeekctl'
* origin/topic/timw/remove-cluster-interface-field-zeekctl:
  Update zeekctl submodule
2024-08-08 10:44:51 +02:00
zeek-bot
80cf06cb79 Update doc submodule [nomail] [skip ci] 2024-08-08 00:23:28 +00:00
Tim Wojtulewicz
bd611945e5 Update zeekctl submodule 2024-08-07 16:03:12 -07:00
Tim Wojtulewicz
c56c7af44e Add note to NEWS about the removal of OpaqueVal::DoSerialize and OpaqueVal::DoUnserialize 2024-08-07 12:27:56 -07:00
Tim Wojtulewicz
6041f74601 Merge remote-tracking branch 'origin/topic/timw/7.1-deprecation-removal'
* origin/topic/timw/7.1-deprecation-removal:
  Remove deprecated port/ports fields for spicy analyzers
  Remove deprecated Cluster::Node::interface field
  Remove deprecated signature definition format
  Return an error if GLOBAL:: prefix is used
  Remove deprecated BloomFilter serialization methods
  Remove deprecated OpaqueVal serialization methods
  Remove deprecated DECLARE_OPAQUE_VALUE macro
  Make TypePtr::Capture member variables private
  Remove deprecated Trigger constructor
  Remove deprecated Controller::auto_assign_ports and Controller::auto_assign_start_port
  Remove deprecated load-balacing policy script
  Remove deprecated prometheus telemetry policy script
  Remove deprecated policy/tuning/default package
  Remove deprecated time machine settings
  Remove deprecated json NullDoubleWriter class
  Remove deprecated modbus event definitions
  Remove Connection::AppendAddl
  Remove STMT_ANY statement type
  Remove EventRegistry::Used and EventRegistry::SetUsed
2024-08-07 12:20:44 -07:00
Tim Wojtulewicz
15d404dd19 Remove deprecated port/ports fields for spicy analyzers 2024-08-07 11:58:22 -07:00
Tim Wojtulewicz
4e9d843cec Remove deprecated Cluster::Node::interface field 2024-08-07 11:58:22 -07:00
Tim Wojtulewicz
9142a48725 Remove deprecated signature definition format 2024-08-07 11:58:22 -07:00
Tim Wojtulewicz
2d68b1d834 Return an error if GLOBAL:: prefix is used 2024-08-07 11:58:22 -07:00
Tim Wojtulewicz
ca69d9fb8f Remove deprecated BloomFilter serialization methods 2024-08-07 11:58:21 -07:00
Tim Wojtulewicz
dd982ee6c4 Remove deprecated OpaqueVal serialization methods 2024-08-07 11:58:21 -07:00
Tim Wojtulewicz
cbe612400c Remove deprecated DECLARE_OPAQUE_VALUE macro 2024-08-07 11:58:21 -07:00
Tim Wojtulewicz
260a8afebe Make TypePtr::Capture member variables private
The public versions were marked as deprecated for 7.0, and accessors
should be used to manage them now.
2024-08-07 11:58:21 -07:00
Tim Wojtulewicz
a53cc4d01b Remove deprecated Trigger constructor 2024-08-07 11:58:21 -07:00
Tim Wojtulewicz
535df5e263 Remove deprecated Controller::auto_assign_ports and Controller::auto_assign_start_port 2024-08-07 11:58:21 -07:00
Tim Wojtulewicz
7a5b29ea81 Remove deprecated load-balacing policy script 2024-08-07 11:58:21 -07:00
Tim Wojtulewicz
1d0f01d6bc Remove deprecated prometheus telemetry policy script 2024-08-07 11:58:21 -07:00
Tim Wojtulewicz
85b4dc773e Remove deprecated policy/tuning/default package 2024-08-07 11:58:21 -07:00
Tim Wojtulewicz
a716903f3a Remove deprecated time machine settings 2024-08-07 11:58:21 -07:00
Tim Wojtulewicz
aba1f431cf Remove deprecated json NullDoubleWriter class 2024-08-07 11:58:21 -07:00
Tim Wojtulewicz
401a074036 Remove deprecated modbus event definitions 2024-08-07 11:58:21 -07:00
Tim Wojtulewicz
6bb00f9e01 Remove Connection::AppendAddl 2024-08-07 11:58:21 -07:00
Tim Wojtulewicz
1d4bd2c70a Remove STMT_ANY statement type 2024-08-07 11:58:21 -07:00
Tim Wojtulewicz
e2b03681d1 Remove EventRegistry::Used and EventRegistry::SetUsed 2024-08-07 11:58:21 -07:00
Arne Welzel
97fa7cdc0a Merge remote-tracking branch 'origin/topic/awelzel/ldap-fix-uint8-shift'
* origin/topic/awelzel/ldap-fix-uint8-shift:
  ldap: Promote uint8 to uint64 before shifting
2024-08-07 14:11:30 +02:00
Arne Welzel
2be39cf0d0 ldap: Promote uint8 to uint64 before shifting
Relates to zeek/spicy#1829
2024-08-07 13:47:12 +02:00
Arne Welzel
2c62ecf57d Merge remote-tracking branch 'origin/topic/awelzel/ci-ubuntu-24-new-ccache'
* origin/topic/awelzel/ci-ubuntu-24-new-ccache:
  ci/ubuntu-24.04: Use ccache 4.10.2
2024-08-07 11:43:33 +02:00
Arne Welzel
84c9daafd1 ci/ubuntu-24.04: Use ccache 4.10.2
The ccache version shipped with Ubuntu 24.04 does not yet recognize
--fprofile-update=atomic, install one that does.

Now that the asan_sanitizer build also includes building Spicy and
running the spicyz test suite, ccache is quite important.

Reference ccache/ccache#1408 and zeek/zeek#3777.
2024-08-07 11:36:00 +02:00
Arne Welzel
b0df736ba7 Merge remote-tracking branch 'origin/topic/awelzel/threading-manager-metrics-follow-up'
* origin/topic/awelzel/threading-manager-metrics-follow-up:
  telemetry/Manager: Check RegisterFd() return value
  telemetry/Manager: Track sent_in and sent_out totals without callback
  threading/Manager: Switch inf bucket from infinity() to max()
  threading/Manager: "lt" to "le" and do not break
2024-08-07 10:55:13 +02:00
Arne Welzel
4fe9580a7e telemetry/Manager: Check RegisterFd() return value
Please coverity.
2024-08-07 09:48:29 +02:00
zeek-bot
60bdaffe0b Update doc submodule [nomail] [skip ci] 2024-08-07 00:20:16 +00:00
Arne Welzel
c845c7cce0 Merge remote-tracking branch 'origin/topic/awelzel/3860-ldap-fuzzer'
* origin/topic/awelzel/3860-ldap-fuzzer:
  Bump auxil/spicy to latest development snapshot
  spicy/runtime-support: Switch ParameterMismatch::_fmt to static
  coverage/lcov_html: Ignore testing/btest/.tmp
  cirrus: Do not disable Spicy for sanitizer builds
  ldap: Avoid unset m$opcode
  fuzzers: Add LDAP fuzzing
2024-08-06 20:09:09 +02:00
Arne Welzel
821d460c2e Bump auxil/spicy to latest development snapshot 2024-08-06 18:20:09 +02:00
Arne Welzel
9f5f8b809a spicy/runtime-support: Switch ParameterMismatch::_fmt to static
UBSAN's vptr sanitize isn't happy with the call to _fmt()
in its member initializer list.

    $ zeek -r Traces/ssh/single-conn.trace .tmp/spicy.event-args-mismatch/test.hlto .tmp/spicy.event-args-mismatch/event-args-mismatch.zeek
    <...>/src/include/zeek/spicy/runtime-support.h:80:29: runtime error: member call on address 0x511000369540 which does not point to an object of type 'zeek::spicy::rt::ParameterMismatch'
    0x511000369540: note: object has invalid vptr
     00 00 00 00  be be be be be be be be  be be be be be be be be  be be be be be be be be  be be be be
                  ^~~~~~~~~~~~~~~~~~~~~~~
                  invalid vptr
        #0 0x7f9c9977b019 in zeek::spicy::rt::ParameterMismatch::ParameterMismatch(std::basic_string_view<char, std::char_traits<char>>, zeek::IntrusivePtr<zeek::Type> const&, std::basic_string_view<char, std::char_traits<char>>) <...>/src/include/zeek/spicy/runtime-support.h:80:29
         #1 0x7f9c9977a6a2 in zeek::spicy::rt::to_val(hilti::rt::Bytes const&, zeek::IntrusivePtr<zeek::Type> const&) <...>/src/include/zeek/spicy/runtime-support.h:562:15
2024-08-06 18:20:09 +02:00
Arne Welzel
11bc233f45 coverage/lcov_html: Ignore testing/btest/.tmp
gcda/gcno files in the btest/.tmp directory are from .htlo files
referencing ephemeral cc files. No need to include these.
2024-08-06 18:20:09 +02:00
Arne Welzel
f1167fc87f cirrus: Do not disable Spicy for sanitizer builds 2024-08-06 18:20:09 +02:00
Arne Welzel
83a2eb3665 ldap: Avoid unset m$opcode
Initial fuzzing caused a bind response to arrive before a bind request,
resulting in an unset field expression error:

    expression error in base/protocols/ldap/main.zeek, line 270: field value missing (LDAP::m$opcode)

Prevent this by ensuring m$opcode is set and raising instead.
2024-08-06 18:20:09 +02:00
Arne Welzel
92d4e50b48 fuzzers: Add LDAP fuzzing
LDAP supports both, UDP and TCP as separate analyzers. The corpus
is identical, however. Started to hit the TLS analyzer fairly
quickly, too.

Closes #3860
2024-08-06 18:20:09 +02:00
Tim Wojtulewicz
d52ec28c89 Merge remote-tracking branch 'origin/topic/timw/dont-install-empty-zam-dirs'
* origin/topic/timw/dont-install-empty-zam-dirs:
  Don't install empty ZAM directories
2024-08-06 09:02:31 -07:00
Arne Welzel
bd8c5b7bbb Merge remote-tracking branch 'upstream/topic/awelzel/fix-btest-spicy-replaces-conflicts'
* upstream/topic/awelzel/fix-btest-spicy-replaces-conflicts:
  btest/spicy: Make replaces-conflicts trigger replaces code path
2024-08-06 12:03:18 +02:00
Arne Welzel
bae15230bb btest/spicy: Make replaces-conflicts trigger replaces code path
The current test attempts to instantiate two spicy::SSH_1 protocol
analyzers in the .evt file. The intention likely was to use two
distinct protocol analyzer both trying to replace the builtin SSH
analyzer.

Coincidentally, fixing this happens to workaround TSAN errors tickled
by the FatalError() call while loading the .hlto with two identically
named analyzers.

    $ cat .tmp/spicy.replaces-conflicts/output
    error: redefinition of protocol analyzer spicy::SSH_1
    ThreadSanitizer: main thread finished with ignores enabled
      One of the following ignores was not ended (in order of probability)
      Ignore was enabled at:
        #0 __llvm_gcov_init __linker___d192e45c25d5ee23-484d3e0fc2caf5b4.cc (ssh.hlto+0x34036) (BuildId: 091934ca4da885e7)
        #1 __llvm_gcov_init __linker___d192e45c25d5ee23-484d3e0fc2caf5b4.cc (ssh.hlto+0x34036) (BuildId: 091934ca4da885e7)
        ...

I was tempted to replace FatalError() with Error() and rely on
zeek-setup.cc's early exiting on any reporter errors, but this
seems easier for now.

Relates to #3865.
2024-08-06 11:52:52 +02:00
Arne Welzel
351f16c160 telemetry/Manager: Track sent_in and sent_out totals without callback
For terminated threads, the totals would go down once the threads are
removed, which isn't great. Move tracking of sent in and sent out
messages from callback to explicit `Inc()` calls.

Also fixes total_messages_in_metric being initialized twice rather
than total_messages_out_metric.
2024-08-06 11:06:38 +02:00
Arne Welzel
c55b2ece8f threading/Manager: Switch inf bucket from infinity() to max()
For uint64_t, std::numeric_limits<T>::has_infinity is false and infinity()
actually returns 0. Use uint64_t's max() instead. We could cast to double
and use the double infinity, but this seems reasonable, too.

This was found while trying to provoke some pending messages and being
confused why all but the "inf" bucket increased.
2024-08-06 11:05:42 +02:00
Arne Welzel
98480cf339 threading/Manager: "lt" to "le" and do not break
The buckets are specified as lower-equal (changed from lower-than now),
which means we shouldn't break: The larger "le" bucket contains all previous
buckets, too. The "inf" bucket represents the current number of threads.

For example, with a total of 10 threads, 5 threads with 0 messages pending,
another 4 threads with 50 messages, and on with 2000 messages, the metrics
would end end up as follows:

    pending_buckets{le=1}      = 5
    pending_buckets{le=10}     = 5
    pending_buckets{le=100}    = 9
    pending_buckets{le=1000}   = 9
    pending_buckets{le=10000}  = 10
    pending_buckets{le=inf}    = 10

This might be strange initially, but aligns with the Prometheus
histogram approach (though we're using gauges here).
2024-08-06 09:46:51 +02:00
Tim Wojtulewicz
2f8733e08d Don't install empty ZAM directories 2024-08-05 16:23:03 -07:00
Tim Wojtulewicz
25f65a705f Updating CHANGES and VERSION. 2024-08-05 14:40:31 -07:00
Tim Wojtulewicz
b483fad3d0 Merge remote-tracking branch 'origin/topic/timw/3081-prof-log-metrics'
* origin/topic/timw/3081-prof-log-metrics:
  Remove some unnecessary #includes
  Avoid capturing 'this' for callback in telemetry::Manager
  Make telemetry metrics out of MsgThread statistics
  Split cpu time metric into user/system components like prof.log
  Move broker statistics to be telemetry metrics
  Add timer counts as telemetry metrics
  Move thread manager stats to telemetry metric
  Add extra metrics to session_mgr
  Move dns_mgr stats to telemetry instruments
  Move trigger stats to telemetry instruments
  Move pulling of global state inside 'expensive' check for stats
2024-08-05 14:39:56 -07:00
Tim Wojtulewicz
1325e16a0d Remove some unnecessary #includes 2024-08-05 13:27:30 -07:00
Tim Wojtulewicz
7a1eb78b67 Avoid capturing 'this' for callback in telemetry::Manager 2024-08-05 13:27:30 -07:00
Tim Wojtulewicz
73f71e652d Make telemetry metrics out of MsgThread statistics 2024-08-05 13:27:30 -07:00
Tim Wojtulewicz
a6843067e9 Split cpu time metric into user/system components like prof.log
The total can be calculated from the two parts via Prometheus/Grafana
if desired, so it's more informative to pass them as separate parts.
2024-08-05 13:27:30 -07:00
Tim Wojtulewicz
206f5cd522 Move broker statistics to be telemetry metrics 2024-08-05 13:27:30 -07:00
Tim Wojtulewicz
44860676a2 Add timer counts as telemetry metrics 2024-08-05 13:21:44 -07:00
Tim Wojtulewicz
4face43462 Move thread manager stats to telemetry metric 2024-08-05 13:21:44 -07:00
Tim Wojtulewicz
a81f6ab9a6 Add extra metrics to session_mgr
- Sessions killed by activity
- Current number of sessions across all types
2024-08-05 13:21:44 -07:00
Vern Paxson
5d37e6bb5c accessor for smart-pointer version of FileVal's value 2024-08-05 09:12:36 +01:00
Tim Wojtulewicz
d1f7999f61 Move dns_mgr stats to telemetry instruments 2024-08-02 21:27:26 -07:00
Tim Wojtulewicz
8b4af06484 Move trigger stats to telemetry instruments 2024-08-02 21:27:26 -07:00
Tim Wojtulewicz
77c05357b5 Move pulling of global state inside 'expensive' check for stats 2024-08-02 21:27:26 -07:00
zeek-bot
8acc5ae15e Update doc submodule [nomail] [skip ci] 2024-08-03 00:12:18 +00:00
Tim Wojtulewicz
3c3853dc7d Merge remote-tracking branch 'origin/topic/timw/telemetry-threading'
* origin/topic/timw/telemetry-threading:
  Process metric callbacks from the main-loop thread
2024-08-02 15:50:47 -07:00
Tim Wojtulewicz
7ac7ce1d2b Process metric callbacks from the main-loop thread
This avoids the callbacks from being processed on the worker thread
spawned by Civetweb. It fixes data race issues with lookups involving
global variables, amongst other threading issues.
2024-08-02 15:30:47 -07:00
Arne Welzel
9d9cc51e9d Merge remote-tracking branch 'origin/topic/timw/use-more-memory-for-freebsd-builds'
* origin/topic/timw/use-more-memory-for-freebsd-builds:
  CI: Use 16GB of memory for FreeBSD builds
2024-08-01 11:14:46 +02:00
Tim Wojtulewicz
af65c29a3e CI: Use 16GB of memory for FreeBSD builds 2024-07-31 10:19:11 -07:00
Arne Welzel
ed4acd2437 Update doc submodule [nomail] [skip ci] 2024-07-31 12:22:08 +02:00
zeek-bot
e9adb8e462 Update doc submodule [nomail] [skip ci] 2024-07-30 00:10:33 +00:00
Tim Wojtulewicz
4c0c7581c8 Merge remote-tracking branch 'origin/topic/bbannier/bump-spicy'
* origin/topic/bbannier/bump-spicy:
  Bump auxil/spicy to latest development snapshot
2024-07-26 10:12:04 -07:00
Arne Welzel
152bbbd680 Merge remote-tracking branch 'origin/topic/awelzel/3853-ldap-spnego-ntlmssp'
* origin/topic/awelzel/3853-ldap-spnego-ntlmssp:
  ldap: Recognize SASL+SPNEGO+NTLMSSP
2024-07-26 15:14:52 +02:00
Arne Welzel
02e3d30227 ldap: Recognize SASL+SPNEGO+NTLMSSP
The ctu-sme-11-win7ad-1-ldap-tcp-50041.pcap file was harvested
from the CTU-SME-11 (Experiment-VM-Microsoft-Windows7AD-1) dataset
at https://zenodo.org/records/7958259 (DOI 10.5281/zenodo.7958258).

Closes #3853
2024-07-26 14:37:36 +02:00
Benjamin Bannier
666341fcbb Bump auxil/spicy to latest development snapshot
This in particular pulls in a fix for zeek/spicy#1808.
2024-07-26 13:28:31 +02:00
zeek-bot
7afb9b2afb Update doc submodule [nomail] [skip ci] 2024-07-26 00:10:24 +00:00
Tim Wojtulewicz
a40da34915 Merge remote-tracking branch 'botovq/opaque_x509_algor'
* botovq/opaque_x509_algor:
  Use accessor to reach into X509_ALGOR
2024-07-25 09:19:31 -07:00
Arne Welzel
93a430ce15 Merge remote-tracking branch 'origin/topic/awelzel/mysql-amazing-pp-issue-2716-additions'
* origin/topic/awelzel/mysql-amazing-pp-issue-2716-additions:
  mysql: Simplify length computation
  mysql: Improve date and time parsing
  btest/mysql: Clean query-attr.pcapng
  mysql: Support non-string query attributes
  btest/mysql: Add pcap with non-string query attributes
  mysql: Introduce mysql_ssl_request event
  mysql: Fix EOFIfLegacyThenResultSet
  mysql: Add data parameter to mysql_auth_plugin
  mysql: Add mysql_auth_plugin, mysql_auth_more_data and mysql_auth_switch_request events
  mysql: AuthSwitchRequest: &enforce a 0xfe / 254 status
  mysql: Make auth_plugin_ a std::string
  mysql: Fix auth_plugin_data_part2 length computation
  Refactored connection phase state handling
  Add support for "auth switch" and "query attrs"
  Add support for parsing the "caching_sha2_password" auth plugin
2024-07-25 12:18:31 +02:00
Arne Welzel
2e1e57033d mysql: Simplify length computation
Thanks Tim!
2024-07-25 11:53:41 +02:00
Fupeng Zhao
4adea7978c mysql: Improve date and time parsing 2024-07-25 11:53:41 +02:00
Arne Welzel
7b8bbc6d00 btest/mysql: Clean query-attr.pcapng
It contained some unrelated IntelliJ traffic.
2024-07-25 11:53:41 +02:00
Arne Welzel
2894ae38d0 mysql: Support non-string query attributes
The query attributes aren't exposed to script layer right now, but this
should at least parse over them once encountered and some fixups.
2024-07-25 11:53:41 +02:00
Arne Welzel
93f5813be3 btest/mysql: Add pcap with non-string query attributes
Pcap was generated as follows. Doesn't seem wireshark even parses
this properly right now.

    with common.get_connection() as c:
        with c.cursor() as cur:
            date1 = datetime.date(1987, 10, 18)
            datetime1 = datetime.datetime(1990, 9, 26, 12, 13, 14)
            cur.add_attribute("number1", 42)
            cur.add_attribute("string1", "a string")
            cur.add_attribute("date1", date1)
            cur.add_attribute("datetime1", datetime1)
            cur.execute("SELECT version()")
            result = cur.fetchall()
            print("result", result)
2024-07-25 11:53:41 +02:00
Arne Welzel
0a1568f1a1 mysql: Introduce mysql_ssl_request event
This should've been added with fa48c885 for completion. Do it now.
The MySQL spec calls it SSLRequest packet, so keep SSL in the name for
consistency.
2024-07-25 11:53:41 +02:00
Arne Welzel
6ea1045245 mysql: Fix EOFIfLegacyThenResultSet
Only expect a result next if an EOF was consumed.
2024-07-25 11:53:41 +02:00
Arne Welzel
320923418c mysql: Add data parameter to mysql_auth_plugin
This may contain salt from the server or a hashed password from the client.
2024-07-25 11:53:41 +02:00
Arne Welzel
40f1c2cb6d mysql: Add mysql_auth_plugin, mysql_auth_more_data and mysql_auth_switch_request events
Remove caching_sha2_password parsing/state from the analyzer and implement
the generic events. If we actually want to peak into the authentication
mechanism, we could write a separate analyzer for it. For now, treat it
as opaque values that are exposed to script land.

The added tests show the --get-server-public-key in use where
mysql_auth_more_data contains an RSA public key.
2024-07-25 11:53:41 +02:00
Arne Welzel
8a92945b06 mysql: AuthSwitchRequest: &enforce a 0xfe / 254 status 2024-07-25 11:53:41 +02:00
Arne Welzel
48e76f38cb mysql: Make auth_plugin_ a std::string 2024-07-25 11:53:40 +02:00
Arne Welzel
e98b80d140 mysql: Fix auth_plugin_data_part2 length computation 2024-07-25 11:53:40 +02:00
Fupeng Zhao
c82756bda4 Refactored connection phase state handling
Added `ConnectionExpected` enum for expected packet types during the connection phase.
2024-07-25 11:53:40 +02:00
Fupeng Zhao
e8bdf149f2 Add support for "auth switch" and "query attrs"
Also fix the issue where Resultset could not correctly distinguish between EOF_Packet and OK_Packet.
2024-07-25 11:53:40 +02:00
Fupeng Zhao
9cb618c718 Add support for parsing the "caching_sha2_password" auth plugin 2024-07-25 11:53:35 +02:00
Tim Wojtulewicz
6527850487 Merge remote-tracking branch 'origin/topic/timw/format-binpac-output-code'
* origin/topic/timw/format-binpac-output-code:
  Update binpac submodule to better format output code [nomail]
2024-07-24 15:29:08 -07:00
Tim Wojtulewicz
c4907c3f77 Update binpac submodule to better format output code [nomail] 2024-07-24 13:33:54 -07:00
Tim Wojtulewicz
bd208f4c54 Merge remote-tracking branch 'origin/topic/timw/smb2-ioctl-errors'
* origin/topic/timw/smb2-ioctl-errors:
  Update 7.0 NEWS with blurb about multi-PDU parsing causing increased load [nomail] [skip ci]
  Fix handling of zero-length SMB2 error responses
2024-07-24 13:26:07 -07:00
Tim Wojtulewicz
73fd12a76e Update 7.0 NEWS with blurb about multi-PDU parsing causing increased load [nomail] [skip ci] 2024-07-24 13:20:47 -07:00
Tim Wojtulewicz
2844d54f67 Fix handling of zero-length SMB2 error responses 2024-07-24 12:44:46 -07:00
Arne Welzel
52bcc92e40 Merge remote-tracking branch 'origin/topic/vern/script-opt-maint.Aug24'
* origin/topic/vern/script-opt-maint.Aug24:
  minor optimization of boolean comparisons
  fix & regression test for GH-3839 (spurious warnings for "when" constructs)
2024-07-24 11:18:18 +02:00
Christian Kreibich
c9d8ceaafa Merge branch 'topic/christian/bump-zeek-testing-cluster'
* topic/christian/bump-zeek-testing-cluster:
  Bump zeek-testing-cluster to reflect deprecation of prometheus.zeek
2024-07-23 19:18:52 -07:00
zeek-bot
8526914e4c Update doc submodule [nomail] [skip ci] 2024-07-24 00:19:23 +00:00
Christian Kreibich
146cf99ff6 Bump zeek-testing-cluster to reflect deprecation of prometheus.zeek 2024-07-23 16:58:52 -07:00
Vern Paxson
ff7466df6e minor optimization of boolean comparisons 2024-07-23 16:05:24 -07:00
Vern Paxson
e960c29acb fix & regression test for GH-3839 (spurious warnings for "when" constructs) 2024-07-23 15:18:21 -07:00
Tim Wojtulewicz
cb88f6316c Merge remote-tracking branch 'origin/topic/johanna/update-the-ct-list-and-the-ca-list-again'
* origin/topic/johanna/update-the-ct-list-and-the-ca-list-again:
  Update Mozilla CA list and CT list
2024-07-23 08:54:33 -07:00
Tim Wojtulewicz
da7c3d9138 Merge remote-tracking branch 'origin/topic/bbannier/bump-spicy'
* origin/topic/bbannier/bump-spicy:
  Bump auxil/spicy to latest development snapshot
2024-07-23 08:51:55 -07:00
Johanna Amann
da131fae60 Update Mozilla CA list and CT list 2024-07-23 16:05:30 +01:00
Johanna Amann
7c0c48b290 Spicy TLS - refactoring and partial connection fix
The analyzer now detects partial connections at the beginning of a
connection - and will skip them. This makes behavior more similar to the
binpac analyzer.

The decryption test is skipped.

And some minor refacoring.
2024-07-23 15:34:10 +01:00
Arne Welzel
6a6a5c3d0d Merge remote-tracking branch 'origin/topic/awelzel/ldap-extended-request-response-starttls'
* origin/topic/awelzel/ldap-extended-request-response-starttls:
  ldap: Add heuristic for wrap tokens
  ldap: Ignore ec/rrc for sealed wrap tokens
  ldap: Add LDAP sample with SASL-SRP mechanism
  ldap: Reintroduce encryption after SASL heuristic
  ldap: Fix assuming GSS-SPNEGO for all bindResponses
  ldap: Implement extended request/response and StartTLS support
2024-07-23 12:39:14 +02:00
Benjamin Bannier
dc61cd7a54 Bump auxil/spicy to latest development snapshot 2024-07-23 11:43:01 +02:00
Arne Welzel
d4778f451c ldap: Add heuristic for wrap tokens
Instead of dissecting the GSSAPI handshake, add another heuristic
into MaybeEncrypted to check for the WRAP token identifier.

After this change, the pcap on the following ticket is processed
nicely: https://gitlab.com/wireshark/migration-test/-/issues/9398
2024-07-23 11:29:00 +02:00
Arne Welzel
ca25516e03 ldap: Ignore ec/rrc for sealed wrap tokens
It shouldn't matter for the encrypted payload that we'll
just consume and ignore.
2024-07-23 11:29:00 +02:00
Arne Welzel
a70ccc51ab ldap: Add LDAP sample with SASL-SRP mechanism
This is what @dopheide-esnet actually saw. Produced with a custom
cyrus-sasl and openldap build :-(
2024-07-23 11:29:00 +02:00
Arne Welzel
3846db6ccf ldap: Reintroduce encryption after SASL heuristic
@dopheide-esnet provided sample captures where SASL SRP is used as
a SASL mechanism and the follow-up LDAP messages are encrypted. It's
not clear how to determine whether encryption will or will not happen,
so re-add a heuristic to determine this based on the first byte of
the first message *after* the successful bindResponse handshake. If
that byte is 0x30, assume cleartext.

I haven't been able to produce such pcaps, unfortunately, but the
cleartext path is tested via the existing sasl-ntlm.pcap.
2024-07-23 11:29:00 +02:00
Arne Welzel
724c08f286 ldap: Fix assuming GSS-SPNEGO for all bindResponses
In retrospect that's an obvious bug.
2024-07-23 11:29:00 +02:00
Arne Welzel
09a48c7028 ldap: Implement extended request/response and StartTLS support
PCAP was produced with a local OpenLDAP server configured to support StartTLS.

This puts the Zeek calls into a separate ldap_zeek.spicy file/module
to separate it from LDAP.
2024-07-23 11:29:00 +02:00
Johanna Amann
f95f5d2adb Merge remote-tracking branch 'origin/master' into topic/johanna/spicy-tls
* origin/master:
  Update broker submodule [nomail]
  telemetry: Deprecate prometheus.zeek policy script
  input/Manager: Improve type checks of record fields with type any
  Bump zeek-testing-cluster to pull in tee SIGPIPE fix
  ldap: Remove MessageWrapper with magic 0x30 searching
  ldap: Harden parsing a bit
  ldap: Handle integrity-only KRB wrap tokens
  Bump auxil/spicy to latest development snapshot
  CI: Set FETCH_CONTENT_FULLY_DISCONNECTED flag for configure
  Update broker and cmake submodules [nomail]
  Fix a broken merge
  Do not emit hook files for builtin modules
  Fix warning about grealpath when running 'make dist' on Linux
  Start of 7.1.0 development
  Updating submodule(s) [nomail]
  Update the scripts.base.frameworks.telemetry.internal-metrics test
  Revert "Temporarily disable the scripts/base/frameworks/telemetry/internal-metrics btest"
  Bump Broker to pull in new Prometheus support and pass in Zeek's registry
  Do not emit hook files for builtin modules
2024-07-23 10:21:49 +01:00
Arne Welzel
f4a79fa703 Merge remote-tracking branch 'origin/topic/awelzel/deprecate-prometheus-script'
* origin/topic/awelzel/deprecate-prometheus-script:
  telemetry: Deprecate prometheus.zeek policy script
2024-07-23 10:03:13 +02:00
Tim Wojtulewicz
f500c424fe Update broker submodule [nomail] 2024-07-22 14:59:17 -07:00
Arne Welzel
bf9704f339 telemetry: Deprecate prometheus.zeek policy script
With Cluster::Node$metrics_port being optional, there's not really
a need for the extra script. New rule, if a metrics_port is set, the
node will attempt to listen on it.

Users can still redef Telemetry::metrics_port *after*
base/frameworks/telemetry was loaded to change the port defined
in cluster-layout.zeek.
2024-07-21 17:49:21 +02:00
Arne Welzel
e982a18792 Merge remote-tracking branch 'origin/topic/awelzel/3836-input-create-any-abort-crash'
* origin/topic/awelzel/3836-input-create-any-abort-crash:
  input/Manager: Improve type checks of record fields with type any
2024-07-19 19:51:52 +02:00
Arne Welzel
3797622152 input/Manager: Improve type checks of record fields with type any
Calling AsRecordType() or AsFunc() on a Val of type any isn't safe.

Closes #3836
2024-07-19 11:35:54 +02:00
Christian Kreibich
0ba80d13b4 Merge branch 'topic/christian/bump-cluster-testsuite'
* topic/christian/bump-cluster-testsuite:
  Bump zeek-testing-cluster to pull in tee SIGPIPE fix
2024-07-17 15:37:29 -07:00
Christian Kreibich
b51a46f94d Bump zeek-testing-cluster to pull in tee SIGPIPE fix 2024-07-17 15:34:24 -07:00
Arne Welzel
2ea3a651bd Merge remote-tracking branch 'origin/topic/awelzel/spicy-ldap-krb-wrap-tokens'
* origin/topic/awelzel/spicy-ldap-krb-wrap-tokens:
  ldap: Remove MessageWrapper with magic 0x30 searching
  ldap: Harden parsing a bit
  ldap: Handle integrity-only KRB wrap tokens
2024-07-17 16:48:58 +02:00
Arne Welzel
e7aca5b388 ldap: Remove MessageWrapper with magic 0x30 searching
This unit implements a heuristic to search for the 0x30 sequence
byte if Message couldn't readily be parsed. Remove it with the
idea of explicit and predictable support for SASL mechanisms.
2024-07-17 15:28:27 +02:00
Arne Welzel
0cab87c185 ldap: Harden parsing a bit
ASN1Message(True) may go off parsing arbitrary input data as
"something ASN.1" This could be GBs of octet strings or just very
long sequences. Avoid this by open-coding some top-level types expected.

This also tries to avoid some of the &parse-from usages that result
in unnecessary copies of data.

Adds a locally generated PCAP with addRequest/addResponse that we
don't currently handle.
2024-07-17 15:27:14 +02:00
Arne Welzel
31122f335f ldap: Handle integrity-only KRB wrap tokens
Mostly staring at the PCAPs and opened a few RFCs. For now, only if the
MS_KRB5 OID is used and accepted in a bind response, start stripping
KRB5 wrap tokens for both, client and server traffic.

Would probably be nice to forward the GSS-API data to the analyzer...

Closes zeek/spicy-ldap#29.
2024-07-17 15:26:30 +02:00
Johanna Amann
990c97b5ba Spicy SSL - run spicy-format 2024-07-17 12:51:13 +01:00
Johanna Amann
f36be3dafc Spicy-TLS: address review feedback re convert-functions
This switches convert-functions from being called in the evt file to
being called directly in the spicy file.

See GH-3765 for details.
2024-07-17 12:44:14 +01:00
Tim Wojtulewicz
9ba7c2ddaf Merge remote-tracking branch 'origin/topic/bbannier/bump-spicy'
* origin/topic/bbannier/bump-spicy:
  Bump auxil/spicy to latest development snapshot
2024-07-16 10:16:15 -07:00
Theo Buehler
3ea67a3109 Use accessor to reach into X509_ALGOR
Despite already having an accessor, X509_ALGOR wasn't made opaque
during OpenSSL 1.1.0 development. It would be nice if this could be
fixed at some point, so avoid reaching into that struct by using the
accessor
2024-07-16 18:06:10 +02:00
Benjamin Bannier
41db05238b Bump auxil/spicy to latest development snapshot
This patch bump Spicy to the latest development snapshot. This
introduces a backwards-incompatible change in that it removes support
for a never officially supported syntax to specify unit fields (so I
would argue: not strictly a breaking change).
2024-07-16 08:17:31 +02:00
Tim Wojtulewicz
cb56837f07 Merge remote-tracking branch 'origin/topic/timw/fetchcontent_mkdir'
* origin/topic/timw/fetchcontent_mkdir:
  CI: Set FETCH_CONTENT_FULLY_DISCONNECTED flag for configure
  Update broker and cmake submodules [nomail]
2024-07-12 16:02:37 -07:00
Tim Wojtulewicz
4757536d7d CI: Set FETCH_CONTENT_FULLY_DISCONNECTED flag for configure 2024-07-12 15:14:31 -07:00
Tim Wojtulewicz
a46be1ea29 Update broker and cmake submodules [nomail] 2024-07-12 15:14:31 -07:00
Tim Wojtulewicz
f3bcf1a55d Fix a broken merge
I merged an old version of the branch on accident and then merged the right
one over top of it, but git ended up including both versions. This fixes
that mistake.
2024-07-12 10:00:13 -07:00
Tim Wojtulewicz
b935d2f59a Merge remote-tracking branch 'origin/topic/bbannier/lib-spicy-hooks'
* origin/topic/bbannier/lib-spicy-hooks:
  Do not emit hook files for builtin modules
2024-07-12 09:51:55 -07:00
Tim Wojtulewicz
7a38cee81f Merge remote-tracking branch 'origin/topic/bbannier/lib-spicy-hooks'
* origin/topic/bbannier/lib-spicy-hooks:
  Do not emit hook files for builtin modules
2024-07-12 09:48:12 -07:00
Tim Wojtulewicz
e4716b6c91 Merge remote-tracking branch 'origin/topic/timw/grealpath-make-dist-warning'
* origin/topic/timw/grealpath-make-dist-warning:
  Fix warning about grealpath when running 'make dist' on Linux
2024-07-12 09:46:51 -07:00
Benjamin Bannier
24d3454d61 Do not emit hook files for builtin modules
We would previously emit a C++ file with hooks for at least the builtin
`spicy` module even though that module like any other builtin module
never contains implementations of hooks for types in user code.

This patch prevents modules with skipped implementations (such as our
builtin modules) from being added to the compilation which prevents
generating their hook files.
2024-07-12 09:06:12 +02:00
Tim Wojtulewicz
5fd563da79 Fix warning about grealpath when running 'make dist' on Linux 2024-07-11 13:45:14 -07:00
Tim Wojtulewicz
822102382c Start of 7.1.0 development 2024-07-11 13:19:15 -07:00
Johanna Amann
4acd0297b0 Merge remote-tracking branch 'origin/master' into topic/johanna/spicy-tls
* origin/master: (89 commits)
  Update doc submodule [nomail] [skip ci]
  Bump cmake submodule [nomail]
  testing/btest: Default to HILTI_JIT_PARALLELISM=1
  Revert "CI: Use ccache and a single CPU when building spicy analyzers for btests"
  Update doc submodule [nomail] [skip ci]
  CI: Use ccache and a single CPU when building spicy analyzers for btests
  Extend btest for logging of disabled analyzers
  Update zeek-aux submodule [nomail]
  Add logging of disabled analyzers to analyzer.log
  Bump auxil/spicy to latest development snapshot
  Management framework: bump cluster testsuite to pull in telemetry tests
  Management framework: bump zeek-client
  Management framework: augment deployed configs with instance IP addresses
  Management framework: add auto-enumeration of metrics ports
  Management framework: propagate metrics port from agent
  Management framework: add metrics port in management & Supervisor node records
  Harden the telemetry manager against unset Telemetry::metrics_address
  Comment-only tweaks for telemetry-related settings.
  Fix for --display-cmake in configure Moved build directory creation further down in the script so that --display-cmake has a chance to happen before build tree setup.
  Update submodules [nomail]
  ...
2024-07-11 14:02:28 +01:00
Benjamin Bannier
596f4114fc Do not emit hook files for builtin modules
We would previously emit a C++ file with hooks for at least the builtin
`spicy` module even though that module like any other builtin module
never contains implementations of hooks for types in user code.

This patch adds a blocklist of builtin modules which are skipped for
generating hook files.
2024-07-11 14:15:21 +02:00
Johanna Amann
0f27657418 Spicy TLS: address review feedback & run spicy-lint 2024-06-20 10:10:10 +01:00
Johanna Amann
95506ab149 Spicy TLS: disable debug prints 2024-06-04 14:50:52 +01:00
Johanna Amann
4cce4a4c5f Add configure option to enable/disable spicy SSL
Spicy SSL is now only enabled when specifying the --enable-spicy-ssl
configure-time option.

This should allow merging this into Zeek on an experimental basis.
2024-06-04 14:13:59 +01:00
Johanna Amann
adab894d31 Merge remote-tracking branch 'origin/master' into topic/johanna/spicy-tls
* origin/master: (173 commits)
  Bump Spicy to latest dev snapshot
  Update docs submodule [nomail] [skip ci]
  Add type aliases for instrument and family shared_ptrs
  Update NEWS for double and is_sum changes
  Remove is_sum arguments from counters and gauges
  Change all instruments to only handle doubles
  Add comment to telemetry::Manager::InitPostScript
  Remove all of the ZEEK_METRICS_ environment variables
  Fix header comments in scripts/policy/frameworks/telemetry/prometheus.zeek
  Change all prometheus #includes to use angle brackets
  Update zeekctl submodule for metrics_port node.cfg option
  Regenerate docs [nomail]
  Remove the is_sum argument from BIF histogram creation methods
  Update NEWS for Telemetry rework
  Remove Telemetry::metrics_export_prefixes option
  Validate that label names are constant in non-zeek metrics
  Avoid calling Collect() in counter/gauge Value() methods if not needed
  Fix some determinism issues with btests
  Temporarily disable the scripts/base/frameworks/telemetry/internal-metrics btest
  Fix the scripts.policy.frameworks.telemetry.prometheus btest to use the service discovery endpoint
  ...
2024-06-04 13:27:35 +01:00
Johanna Amann
be9bbff6b9 Spicy TLS: inout/reference updates for recent spicy changes 2024-04-16 08:28:05 +01:00
Johanna Amann
83a1165675 Merge remote-tracking branch 'origin/master' into topic/johanna/spicy-tls
* origin/master: (352 commits)
  Bump Spicy.
  Remove support for old Spicy versions from QUIC analyzer.
  Make sure that vcpkg isn't preferred if pcap_root_dir is passed in
  Remove some unused Spicy state.
  Bump Spicy.
  ZAM fix for concretizing vectors in record constructors
  improve ZAM's estimation of profiling overheads
  CI: Remove commented openssl 1.1 workaround from macOS preparation script
  CI: Fix installation of python package on macOS
  Address review feedback for configure error change
  Raise configure error message for unsupported archives
  fix ZAM "cat" of doubles/times to include trailing ".0" per normal BiF behavior
  CI: Specify the xcode version of the macOS Sonoma instance
  Remove vestigial Conan bit in CMakeLists.txt
  When configuring Spicy, be prepated for zeek_lib or zeek_exe targets.
  Fix a typo in CMakeLists.txt when building Zeek as a library
  Bump Spicy to current `main`.
  tie into updates to gen-zam
  ZAM documentation updated to reflect finer-grained profiling
  ZAM-specific BTest baseline changes for tweak to how ZAM bodies print
  ...
2024-04-16 08:08:16 +01:00
Johanna Amann
fdb8e9a7ca Spicy TLS: parse OCSP replies in TLS extension
Add support for parsing stapled OCSP responses sent by the server.
2023-11-27 17:03:19 +00:00
Johanna Amann
4ed4b1d0a9 Spicy TLS: generate same file IDs as binpac analyzer
This reduces the amount of failing tests to... still 39. A lot of them
are due to QUIC nowadays.
2023-11-27 15:14:11 +00:00
Johanna Amann
f31e39efe2 Merge remote-tracking branch 'origin/master' into topic/johanna/spicy-tls
* origin/master: (73 commits)
  Spicy: allow providing file id in zeek::file_begin
  Spicy: allow providing file id in zeek::file_begin
  Update doc submodule [nomail] [skip ci]
  Spicy: allow providing file id in zeek::file_begin
  Spicy: allow providing file id in zeek::file_begin
  Bump cmake submodule for INCLUDE_DIRS fix
  Update doc submodule [nomail] [skip ci]
  Integrate review feedback
  Add jq to final.Dockerfile
  TableVal: Replace raw subnets/pattern_matcher with unique_ptr
  TablePatternMatcher: Drop Insert()/Remove(), use Clear()
  TableType: Simplify and inline Is...Index tests
  NEWS: Add small table[pattern] section
  Expr/Val: Add support for in set[pattern]
  zeek.bif: Implement table_pattern_matcher_stats() bif for introspection
  DFA: Extract inner Stats struct from DFA_State_Cache
  Expr: Implement string in table[pattern] of X
  RE: Remove RE_DisjunctiveMatcher and re-use MatchAll()
  TablePatternMatcher: Use const StringValPtr& instead of const StringVal*
  Val: Move TablePatternMatcher into detail namespace
  ...
2023-11-27 14:55:57 +00:00
Johanna Amann
5fffc1586a Spicy TLS: skip CI; run performance tests 2023-11-08 13:14:35 +00:00
Johanna Amann
dda1bbb7fc Spicy TLS: fix parsing of no-extension hellos, port registration
Parsing of client/server hellos that do not contain extensions should
now work correctly.

The port registration is now done Zeek-side, wich fixes some test
failures.
2023-11-08 08:00:49 +00:00
Johanna Amann
32d27b1b3f Spicy TLS: Re-enable starttls for RDP 2023-11-06 13:32:27 +00:00
Johanna Amann
c682e5723b Spicy TLS: rename the analyzer to SSL
Naming the analyzer different than the old one was a mistake that
required unnecessary code changes; keeping the old name makes things
like StartTLS in other protocol work without additional code changes.
2023-11-06 12:54:45 +00:00
Johanna Amann
283d900758 Merge remote-tracking branch 'origin/master' into topic/johanna/spicy-tls
* origin/master:
  Update doc submodule [nomail] [skip ci]
  build_inner_connection: Use the outer packet's timestamp
  build_inner_connection: Avoid one extra Init()
  packet_analysis: Do not run DetectProtocol() on disabled analyzers
  packet_analysis/Dispatcher: Do not index table twice
  packet_analysis: Avoid shared_ptr copying for analyzer lookups
  Update doc submodule [nomail] [skip ci]
  Update doc submodule [nomail] [skip ci]
  SSL: Add new extension types and ECH test
  Update `.git-blame-ignore-revs`
  Format JSON with clang-format
  Bump pre-commit hooks
  Reformat Zeek in Spicy style
2023-11-06 11:34:48 +00:00
Johanna Amann
36741c2fbf Reformat 2023-11-06 09:42:46 +00:00
Johanna Amann
0afe94154d Merge remote-tracking branch 'origin/master' into topic/johanna/spicy-tls
* origin/master: (386 commits)
  Normalize version strings in test
  Update doc submodule [nomail] [skip ci]
  Update external testing baseline hashes
  fuzzers: Add DTLS fuzzer
  generic-analyzer-fuzzer: Support NextPacket() fuzzing
  Require `truncate` for a test using it
  Bump outdated baseline
  Fix tests so they work both with GNU and BSD tools
  Install libmaxminddb in macOS CI
  Bump auxil/spicy to latest release
  Supervisor: Handle EAGAIN error on stem pipe
  fuzzer-setup: Allow customization without recompiling
  ssl: Prevent unbounded ssl_history growth
  ssl: Cap number of alerts parsed from SSL record
  subdir-btest: Allow setting build_dir
  Update doc submodule [nomail] [skip ci]
  CI: Pass -A flag to btest for cluster-testing builds
  Update doc submodule [nomail] [skip ci]
  Update baselines
  ftp: Do not base seq on number of pending commands
  ...
2023-10-30 12:28:40 +00:00
Johanna Amann
5937ebf36d Spicy TLS: event ordering
This commit mostly changes the ordering of some the events, so that they
fit the event order of the old analyzer (and also are more
representative of the order of how things are happening on the wire).
2023-06-22 15:58:40 +01:00
Johanna Amann
0d25de926a Spicy TLS: add ssl_extension event 2023-06-22 14:46:59 +01:00
Johanna Amann
3f91557c3e Spicy TLS: raise ssl_established event for TLS 1.3 2023-06-22 14:46:34 +01:00
Johanna Amann
061dc73e8f Merge remote-tracking branch 'origin/master' into topic/johanna/spicy-tls
* origin/master: (82 commits)
  Update doc submodule [nomail] [skip ci]
  Update zeekjs submodule
  Update broker submodule
  telemetry: Disable metrics centralization by default
  GSSAPI: basic support for MIC/WRAP tokens
  CI: Force rebuild of tumbleweed VM to pick up newer version of python
  formatters/JSON: Make JSON::NullDoubleWriter use zeek::json::detail version
  formatters/JSON: Remove surrounding_braces
  formatters/JSON: Prepare to remove rapidjson from installed Zeek headers
  Stmt/Assert: Use std::move() for backtrace element
  Update cmake submodule [nomail]
  Update external testing hashes for 6.1 deprecation changes
  Remove leftover baseline files from 6.1 deprecation removal
  Update doc submodule [nomail] [skip ci]
  Update external testing repo hashes to current master commits
  Update dce-rpc constants
  -O gen-C++ refinements for BiF failures, negative vector indices, boolean vector operations
  Update docs submodule [nomail] [skip ci]
  Force -std=c++17 mode for plugin targets, remove use of RequireCXX17.cmake
  Add Spicy updates to NEWS for 6.0.
  ...
2023-06-22 10:08:14 +01:00
Johanna Amann
0d462c37fa Merge remote-tracking branch 'origin/master' into topic/johanna/spicy-tls
* origin/master: (200 commits)
  Update link to slack in README.md
  Update bifcl, binpac, and broker repos for cmake changes
  bison_target argument changes from HEADER to DEFINES_FILE
  Update cmake submodule [nomail]
  Start of 6.1.0 development
  Switch broker submodule back to master
  Update broker submodule to 2.6.0 release tag [nomail] [skip ci]
  Update docs submodule [nomail] [skip ci]
  Updating CHANGES and VERSION.
  Update baseline for coverage.test-all-policy-cluster test
  catch-and-release: Mark cr_check_rule as is_used
  Add test-all-policy-cluster
  Revert "Merge remote-tracking branch 'origin/topic/vern/at-if-analyze'"
  Simplify code generated for Spicy analyzer port ranges.
  Register test analyzer only for required ports.
  Update doc submodule [nomail] [skip ci]
  Update broker submodule [nomail]
  Update ZeekJS submodule to 0.9.1
  Fix disappearing unit fields in Spicy type export.
  Bump cluster testsuite to latest main
  ...
2023-06-01 14:41:10 +02:00
Johanna Amann
c50f68f414 Spicy TLS: track when encryption starts better
crashes currently
2023-06-01 14:28:06 +02:00
Johanna Amann
977e0bbae6 Spicy TLS: add connection flipping tracking 2023-04-27 12:45:01 +01:00
Johanna Amann
4184b6235b Spicy TLS: switch to passing a unit, instead of accessing context()
This is mostly preparation work that allows us to have several differing
top-level units - which we need to distinguish DTLS from TLS.
2023-04-27 10:43:58 +01:00
Johanna Amann
dc46dbe645 Spicy TLS: More TLS 1.3 parsing 2023-04-25 14:53:02 +01:00
Johanna Amann
82bcc2dbb3 Spicy TLS: more extensions, start of DTLS support. 2023-04-25 12:27:44 +01:00
Johanna Amann
63a4cc824a Merge remote-tracking branch 'origin/master' into topic/johanna/spicy-tls
* origin/master: (139 commits)
  Given the -C flag, set script-layer ignore_checksums to true.
  Add btest for "-C" flag vs the script-layer ignore_checksums global.
  Update doc submodule [nomail] [skip ci]
  Remove references to bro_broker in broker/Manager.h
  cmake: Fixup BRO_PLUGIN_INSTALL_PATH references
  testing/external: Bump hashes for community_id addition
  NEWS: Add entry for Community ID
  policy: Import zeek-community-id scripts into protocols/conn frameworks/notice
  Add irc_dcc_send_ack event and fix missing fields
  Fix install directory for plugins
  Update doc submodule [nomail] [skip ci]
  Add community_id_v1() based on corelight/zeek-community-id
  Update NEWS to cover cluster framework changes.
  Add cluster_started restart tests.
  Add basic cluster_started tests.
  Add cluster_started and node_fully_connected events.
  Add hook into cluster connection setup.
  Add broadcast_topics set.
  Generalize Cluster::worker_count.
  Edit pass over the current 6.0 NEWS entries. [nomail] [skip ci]
  ...
2023-04-25 12:27:32 +01:00
Johanna Amann
b510b0d8d1 Spicy TLS analyzer: basic functionality working
It compiles, it creates some log - but it is not anywhere near on par
with the old SSL analyzer.
2023-04-05 15:39:54 +01:00
Johanna Amann
71cd4b2cf4 Start porting the old spicy TLS analyzer into Zeek
This is very WIP and currently produces a link error.
2023-03-17 13:20:58 +01:00
4089 changed files with 490972 additions and 177464 deletions

View file

@ -10,13 +10,16 @@ btest_jobs: &BTEST_JOBS 4
btest_retries: &BTEST_RETRIES 2 btest_retries: &BTEST_RETRIES 2
memory: &MEMORY 16GB memory: &MEMORY 16GB
config: &CONFIG --build-type=release --disable-broker-tests --prefix=$CIRRUS_WORKING_DIR/install --ccache --enable-werror config: &CONFIG --build-type=release --disable-broker-tests --prefix=$CIRRUS_WORKING_DIR/install --ccache --enable-werror -D FETCHCONTENT_FULLY_DISCONNECTED:BOOL=ON
no_spicy_config: &NO_SPICY_CONFIG --build-type=release --disable-broker-tests --disable-spicy --prefix=$CIRRUS_WORKING_DIR/install --ccache --enable-werror no_spicy_config: &NO_SPICY_CONFIG --build-type=release --disable-broker-tests --disable-spicy --prefix=$CIRRUS_WORKING_DIR/install --ccache --enable-werror
static_config: &STATIC_CONFIG --build-type=release --disable-broker-tests --enable-static-broker --enable-static-binpac --prefix=$CIRRUS_WORKING_DIR/install --ccache --enable-werror static_config: &STATIC_CONFIG --build-type=release --disable-broker-tests --enable-static-broker --enable-static-binpac --prefix=$CIRRUS_WORKING_DIR/install --ccache --enable-werror
binary_config: &BINARY_CONFIG --prefix=$CIRRUS_WORKING_DIR/install --libdir=$CIRRUS_WORKING_DIR/install/lib --binary-package --enable-static-broker --enable-static-binpac --disable-broker-tests --build-type=Release --ccache --enable-werror binary_config: &BINARY_CONFIG --prefix=$CIRRUS_WORKING_DIR/install --libdir=$CIRRUS_WORKING_DIR/install/lib --binary-package --enable-static-broker --enable-static-binpac --disable-broker-tests --build-type=Release --ccache --enable-werror
asan_sanitizer_config: &ASAN_SANITIZER_CONFIG --build-type=debug --disable-broker-tests --sanitizers=address --enable-fuzzers --enable-coverage --disable-spicy --ccache spicy_ssl_config: &SPICY_SSL_CONFIG --build-type=release --disable-broker-tests --enable-spicy-ssl --prefix=$CIRRUS_WORKING_DIR/install --ccache --enable-werror
ubsan_sanitizer_config: &UBSAN_SANITIZER_CONFIG --build-type=debug --disable-broker-tests --sanitizers=undefined --enable-fuzzers --disable-spicy --ccache --enable-werror asan_sanitizer_config: &ASAN_SANITIZER_CONFIG --build-type=debug --disable-broker-tests --sanitizers=address --enable-fuzzers --enable-coverage --ccache --enable-werror
tsan_sanitizer_config: &TSAN_SANITIZER_CONFIG --build-type=debug --disable-broker-tests --sanitizers=thread --enable-fuzzers --disable-spicy --ccache --enable-werror ubsan_sanitizer_config: &UBSAN_SANITIZER_CONFIG --build-type=debug --disable-broker-tests --sanitizers=undefined --enable-fuzzers --ccache --enable-werror
tsan_sanitizer_config: &TSAN_SANITIZER_CONFIG --build-type=debug --disable-broker-tests --sanitizers=thread --enable-fuzzers --ccache --enable-werror
macos_config: &MACOS_CONFIG --build-type=release --disable-broker-tests --prefix=$CIRRUS_WORKING_DIR/install --ccache --enable-werror --with-krb5=/opt/homebrew/opt/krb5
clang_tidy_config: &CLANG_TIDY_CONFIG --build-type=debug --disable-broker-tests --prefix=$CIRRUS_WORKING_DIR/install --ccache --enable-werror --enable-clang-tidy
resources_template: &RESOURCES_TEMPLATE resources_template: &RESOURCES_TEMPLATE
cpu: *CPUS cpu: *CPUS
@ -32,11 +35,11 @@ macos_environment: &MACOS_ENVIRONMENT
ZEEK_CI_BTEST_JOBS: 12 ZEEK_CI_BTEST_JOBS: 12
# No permission to write to default location of /zeek # No permission to write to default location of /zeek
CIRRUS_WORKING_DIR: /tmp/zeek CIRRUS_WORKING_DIR: /tmp/zeek
ZEEK_CI_CONFIGURE_FLAGS: *MACOS_CONFIG
freebsd_resources_template: &FREEBSD_RESOURCES_TEMPLATE freebsd_resources_template: &FREEBSD_RESOURCES_TEMPLATE
cpu: 8 cpu: 8
# Not allowed to request less than 8GB for an 8 CPU FreeBSD VM. memory: *MEMORY
memory: 8GB
# For greediness, see https://medium.com/cirruslabs/introducing-greedy-container-instances-29aad06dc2b4 # For greediness, see https://medium.com/cirruslabs/introducing-greedy-container-instances-29aad06dc2b4
greedy: true greedy: true
@ -45,40 +48,108 @@ freebsd_environment: &FREEBSD_ENVIRONMENT
ZEEK_CI_CPUS: 8 ZEEK_CI_CPUS: 8
ZEEK_CI_BTEST_JOBS: 8 ZEEK_CI_BTEST_JOBS: 8
builds_only_if_template: &BUILDS_ONLY_IF_TEMPLATE only_if_pr_master_release: &ONLY_IF_PR_MASTER_RELEASE
# Rules for skipping builds:
# - Do not run builds for anything that's cron triggered
# - Don't do darwin builds on zeek-security repo because they use up a ton of compute credits.
# - Always build PRs, but not if they come from dependabot
# - Always build master and release/* builds from the main repo
only_if: > only_if: >
( $CIRRUS_CRON == '' ) &&
( ( $CIRRUS_PR != '' && $CIRRUS_BRANCH !=~ 'dependabot/.*' ) ||
( ( $CIRRUS_REPO_NAME == 'zeek' || $CIRRUS_REPO_NAME == 'zeek-security' ) && ( ( $CIRRUS_REPO_NAME == 'zeek' || $CIRRUS_REPO_NAME == 'zeek-security' ) &&
( ( $CIRRUS_CRON != 'weekly' ) &&
( $CIRRUS_PR != '' ||
$CIRRUS_BRANCH == 'master' || $CIRRUS_BRANCH == 'master' ||
$CIRRUS_BRANCH =~ 'release/.*' $CIRRUS_BRANCH =~ 'release/.*'
) )
) ) )
skip_task_on_pr: &SKIP_TASK_ON_PR only_if_pr_master_release_nightly: &ONLY_IF_PR_MASTER_RELEASE_NIGHTLY
# Skip this task on PRs if it does not have the fullci label,
# it continues to run for direct pushes to master/release.
skip: >
($CIRRUS_PR != '' && $CIRRUS_PR_LABELS !=~ '.*fullci.*')
benchmark_only_if_template: &BENCHMARK_ONLY_IF_TEMPLATE
# only_if condition for cron-triggered benchmarking tests.
# These currently do not run for release/.*
only_if: > only_if: >
( $CIRRUS_REPO_NAME == 'zeek' || $CIRRUS_REPO_NAME == 'zeek-security' ) && ( ( $CIRRUS_REPO_NAME == 'zeek' || $CIRRUS_REPO_NAME == 'zeek-security' ) &&
( $CIRRUS_CRON == 'benchmark-nightly' || ( $CIRRUS_CRON != 'weekly' ) &&
$CIRRUS_PR_LABELS =~ '.*fullci.*' || ( $CIRRUS_PR != '' ||
$CIRRUS_PR_LABELS =~ '.*benchmark.*' ) $CIRRUS_BRANCH == 'master' ||
$CIRRUS_BRANCH =~ 'release/.*' ||
( $CIRRUS_CRON == 'nightly' && $CIRRUS_BRANCH == 'master' )
)
)
only_if_pr_release_and_nightly: &ONLY_IF_PR_RELEASE_AND_NIGHTLY
only_if: >
( ( $CIRRUS_REPO_NAME == 'zeek' || $CIRRUS_REPO_NAME == 'zeek-security' ) &&
( $CIRRUS_CRON != 'weekly' ) &&
( $CIRRUS_PR != '' ||
$CIRRUS_BRANCH =~ 'release/.*' ||
( $CIRRUS_CRON == 'nightly' && $CIRRUS_BRANCH == 'master' )
)
)
only_if_pr_nightly: &ONLY_IF_PR_NIGHTLY
only_if: >
( ( $CIRRUS_REPO_NAME == 'zeek' || $CIRRUS_REPO_NAME == 'zeek-security' ) &&
( $CIRRUS_CRON != 'weekly' ) &&
( $CIRRUS_PR != '' ||
( $CIRRUS_CRON == 'nightly' && $CIRRUS_BRANCH == 'master' )
)
)
only_if_release_tag_nightly: &ONLY_IF_RELEASE_TAG_NIGHTLY
only_if: >
( ( $CIRRUS_REPO_NAME == 'zeek' ) &&
( $CIRRUS_CRON != 'weekly' ) &&
( ( $CIRRUS_BRANCH =~ 'release/.*' && $CIRRUS_TAG =~ 'v[0-9]+\.[0-9]+\.[0-9]+(-rc[0-9]+)?$' ) ||
( $CIRRUS_CRON == 'nightly' && $CIRRUS_BRANCH == 'master' )
)
)
only_if_nightly: &ONLY_IF_NIGHTLY
only_if: >
( ( $CIRRUS_REPO_NAME == 'zeek' ) &&
( $CIRRUS_CRON == 'nightly' && $CIRRUS_BRANCH == 'master' )
)
only_if_weekly: &ONLY_IF_WEEKLY
only_if: >
( ( $CIRRUS_REPO_NAME == 'zeek' || $CIRRUS_REPO_NAME == 'zeek-security' ) &&
( $CIRRUS_CRON == 'weekly' && $CIRRUS_BRANCH == 'master' )
)
skip_if_pr_skip_all: &SKIP_IF_PR_SKIP_ALL
skip: >
( $CIRRUS_PR != '' && $CIRRUS_PR_LABELS =~ ".*CI: Skip All.*" )
skip_if_pr_not_full_ci: &SKIP_IF_PR_NOT_FULL_CI
skip: >
( ( $CIRRUS_PR != '' && $CIRRUS_PR_LABELS !=~ ".*CI: Full.*") ||
( $CIRRUS_PR_LABELS =~ ".*CI: Skip All.*" )
)
skip_if_pr_not_full_or_benchmark: &SKIP_IF_PR_NOT_FULL_OR_BENCHMARK
skip: >
( ( $CIRRUS_PR != '' && $CIRRUS_PR_LABELS !=~ ".*CI: (Full|Benchmark).*" ) ||
( $CIRRUS_PR_LABELS =~ ".*CI: Skip All.*" )
)
skip_if_pr_not_full_or_cluster_test: &SKIP_IF_PR_NOT_FULL_OR_CLUSTER_TEST
skip: >
( ( $CIRRUS_PR != '' && $CIRRUS_PR_LABELS !=~ ".*CI: (Full|Cluster Test).*" ) ||
( $CIRRUS_PR_LABELS =~ ".*CI: Skip All.*" )
)
skip_if_pr_not_full_or_zam: &SKIP_IF_PR_NOT_FULL_OR_ZAM
skip: >
( ( $CIRRUS_PR != '' && $CIRRUS_PR_LABELS !=~ ".*CI: (Full|ZAM).*" ) ||
( $CIRRUS_PR_LABELS =~ ".*CI: Skip All.*" )
)
skip_if_pr_not_full_or_zeekctl: &SKIP_IF_PR_NOT_FULL_OR_ZEEKCTL
skip: >
( ( $CIRRUS_PR != '' && $CIRRUS_PR_LABELS !=~ ".*CI: (Full|Zeekctl).*" ) ||
( $CIRRUS_PR_LABELS =~ ".*CI: Skip All.*" )
)
skip_if_pr_not_full_or_windows: &SKIP_IF_PR_NOT_FULL_OR_WINDOWS
skip: >
( ( $CIRRUS_PR != '' && $CIRRUS_PR_LABELS !=~ ".*CI: (Full|Windows).*" ) ||
( $CIRRUS_PR_LABELS =~ ".*CI: Skip All.*" )
)
ci_template: &CI_TEMPLATE ci_template: &CI_TEMPLATE
<< : *BUILDS_ONLY_IF_TEMPLATE
# Default timeout is 60 minutes, Cirrus hard limit is 120 minutes for free # Default timeout is 60 minutes, Cirrus hard limit is 120 minutes for free
# tasks, so may as well ask for full time. # tasks, so may as well ask for full time.
timeout_in: 120m timeout_in: 120m
@ -122,6 +193,7 @@ ci_template: &CI_TEMPLATE
env: env:
CIRRUS_WORKING_DIR: /zeek CIRRUS_WORKING_DIR: /zeek
CIRRUS_LOG_TIMESTAMP: true
ZEEK_CI_CPUS: *CPUS ZEEK_CI_CPUS: *CPUS
ZEEK_CI_BTEST_JOBS: *BTEST_JOBS ZEEK_CI_BTEST_JOBS: *BTEST_JOBS
ZEEK_CI_BTEST_RETRIES: *BTEST_RETRIES ZEEK_CI_BTEST_RETRIES: *BTEST_RETRIES
@ -166,27 +238,88 @@ env:
# Linux EOL timelines: https://linuxlifecycle.com/ # Linux EOL timelines: https://linuxlifecycle.com/
# Fedora (~13 months): https://fedoraproject.org/wiki/Fedora_Release_Life_Cycle # Fedora (~13 months): https://fedoraproject.org/wiki/Fedora_Release_Life_Cycle
fedora40_task: fedora42_task:
container: container:
# Fedora 40 EOL: Around May 2025 # Fedora 42 EOL: Around May 2026
dockerfile: ci/fedora-40/Dockerfile dockerfile: ci/fedora-42/Dockerfile
<< : *RESOURCES_TEMPLATE << : *RESOURCES_TEMPLATE
<< : *CI_TEMPLATE << : *CI_TEMPLATE
<< : *ONLY_IF_PR_MASTER_RELEASE
<< : *SKIP_IF_PR_SKIP_ALL
env:
ZEEK_CI_CONFIGURE_FLAGS: *BINARY_CONFIG
fedora39_task: fedora41_task:
container: container:
# Fedora 39 EOL: Around Nov 2024 # Fedora 41 EOL: Around Nov 2025
dockerfile: ci/fedora-39/Dockerfile dockerfile: ci/fedora-41/Dockerfile
<< : *RESOURCES_TEMPLATE << : *RESOURCES_TEMPLATE
<< : *CI_TEMPLATE << : *CI_TEMPLATE
<< : *SKIP_TASK_ON_PR << : *ONLY_IF_PR_MASTER_RELEASE
<< : *SKIP_IF_PR_NOT_FULL_CI
centosstream9_task: centosstream9_task:
container: container:
# Stream 9 EOL: Around Dec 2027 # Stream 9 EOL: 31 May 2027
dockerfile: ci/centos-stream-9/Dockerfile dockerfile: ci/centos-stream-9/Dockerfile
<< : *RESOURCES_TEMPLATE << : *RESOURCES_TEMPLATE
<< : *CI_TEMPLATE << : *CI_TEMPLATE
<< : *ONLY_IF_PR_MASTER_RELEASE
<< : *SKIP_IF_PR_NOT_FULL_CI
centosstream10_task:
container:
# Stream 10 EOL: 01 January 2030
dockerfile: ci/centos-stream-10/Dockerfile
<< : *RESOURCES_TEMPLATE
<< : *CI_TEMPLATE
<< : *ONLY_IF_PR_MASTER_RELEASE
<< : *SKIP_IF_PR_NOT_FULL_CI
debian13_task:
container:
# Debian 13 (trixie) EOL: TBD
dockerfile: ci/debian-13/Dockerfile
<< : *RESOURCES_TEMPLATE
<< : *CI_TEMPLATE
<< : *ONLY_IF_PR_MASTER_RELEASE
<< : *SKIP_IF_PR_NOT_FULL_CI
arm_debian13_task:
arm_container:
# Debian 13 (trixie) EOL: TBD
dockerfile: ci/debian-13/Dockerfile
<< : *RESOURCES_TEMPLATE
<< : *CI_TEMPLATE
<< : *ONLY_IF_PR_MASTER_RELEASE
<< : *SKIP_IF_PR_SKIP_ALL
debian13_static_task:
container:
# Just use a recent/common distro to run a static compile test.
# Debian 13 (trixie) EOL: TBD
dockerfile: ci/debian-13/Dockerfile
<< : *RESOURCES_TEMPLATE
<< : *CI_TEMPLATE
<< : *ONLY_IF_PR_MASTER_RELEASE
<< : *SKIP_IF_PR_NOT_FULL_CI
env:
ZEEK_CI_CONFIGURE_FLAGS: *STATIC_CONFIG
debian13_binary_task:
container:
# Just use a recent/common distro to run binary mode compile test.
# As of 2024-03, the used configure flags are equivalent to the flags
# that we use to create binary packages.
# Just use a recent/common distro to run a static compile test.
# Debian 13 (trixie) EOL: TBD
dockerfile: ci/debian-13/Dockerfile
<< : *RESOURCES_TEMPLATE
<< : *CI_TEMPLATE
<< : *ONLY_IF_PR_MASTER_RELEASE
<< : *SKIP_IF_PR_NOT_FULL_CI
env:
ZEEK_CI_CONFIGURE_FLAGS: *BINARY_CONFIG
debian12_task: debian12_task:
container: container:
@ -194,56 +327,8 @@ debian12_task:
dockerfile: ci/debian-12/Dockerfile dockerfile: ci/debian-12/Dockerfile
<< : *RESOURCES_TEMPLATE << : *RESOURCES_TEMPLATE
<< : *CI_TEMPLATE << : *CI_TEMPLATE
<< : *ONLY_IF_PR_MASTER_RELEASE
arm_debian12_task: << : *SKIP_IF_PR_NOT_FULL_CI
arm_container:
# Debian 12 (bookworm) EOL: TBD
dockerfile: ci/debian-12/Dockerfile
<< : *RESOURCES_TEMPLATE
<< : *CI_TEMPLATE
env:
ZEEK_CI_CONFIGURE_FLAGS: *NO_SPICY_CONFIG
debian12_static_task:
container:
# Just use a recent/common distro to run a static compile test.
# Debian 12 (bookworm) EOL: TBD
dockerfile: ci/debian-12/Dockerfile
<< : *RESOURCES_TEMPLATE
<< : *CI_TEMPLATE
<< : *SKIP_TASK_ON_PR
env:
ZEEK_CI_CONFIGURE_FLAGS: *STATIC_CONFIG
debian12_binary_task:
container:
# Just use a recent/common distro to run binary mode compile test.
# As of 2024-03, the used configure flags are equivalent to the flags
# that we use to create binary packages.
# Just use a recent/common distro to run a static compile test.
# Debian 12 (bookworm) EOL: TBD
dockerfile: ci/debian-12/Dockerfile
<< : *RESOURCES_TEMPLATE
<< : *CI_TEMPLATE
<< : *SKIP_TASK_ON_PR
env:
ZEEK_CI_CONFIGURE_FLAGS: *BINARY_CONFIG
debian11_task:
container:
# Debian 11 EOL: June 2026
dockerfile: ci/debian-11/Dockerfile
<< : *RESOURCES_TEMPLATE
<< : *CI_TEMPLATE
<< : *SKIP_TASK_ON_PR
opensuse_leap_15_5_task:
container:
# Opensuse Leap 15.5 EOL: ~Dec 2024
dockerfile: ci/opensuse-leap-15.5/Dockerfile
<< : *RESOURCES_TEMPLATE
<< : *CI_TEMPLATE
<< : *SKIP_TASK_ON_PR
opensuse_leap_15_6_task: opensuse_leap_15_6_task:
container: container:
@ -251,6 +336,8 @@ opensuse_leap_15_6_task:
dockerfile: ci/opensuse-leap-15.6/Dockerfile dockerfile: ci/opensuse-leap-15.6/Dockerfile
<< : *RESOURCES_TEMPLATE << : *RESOURCES_TEMPLATE
<< : *CI_TEMPLATE << : *CI_TEMPLATE
<< : *ONLY_IF_PR_MASTER_RELEASE
<< : *SKIP_IF_PR_NOT_FULL_CI
opensuse_tumbleweed_task: opensuse_tumbleweed_task:
container: container:
@ -259,75 +346,140 @@ opensuse_tumbleweed_task:
<< : *RESOURCES_TEMPLATE << : *RESOURCES_TEMPLATE
prepare_script: ./ci/opensuse-tumbleweed/prepare.sh prepare_script: ./ci/opensuse-tumbleweed/prepare.sh
<< : *CI_TEMPLATE << : *CI_TEMPLATE
# << : *SKIP_TASK_ON_PR << : *ONLY_IF_PR_MASTER_RELEASE
<< : *SKIP_IF_PR_NOT_FULL_CI
ubuntu24_task: weekly_current_gcc_task:
container:
# Opensuse Tumbleweed has no EOL
dockerfile: ci/opensuse-tumbleweed/Dockerfile
<< : *RESOURCES_TEMPLATE
prepare_script: ./ci/opensuse-tumbleweed/prepare-weekly.sh
<< : *CI_TEMPLATE
<< : *ONLY_IF_WEEKLY
env:
ZEEK_CI_COMPILER: gcc
weekly_current_clang_task:
container:
# Opensuse Tumbleweed has no EOL
dockerfile: ci/opensuse-tumbleweed/Dockerfile
<< : *RESOURCES_TEMPLATE
prepare_script: ./ci/opensuse-tumbleweed/prepare-weekly.sh
<< : *CI_TEMPLATE
<< : *ONLY_IF_WEEKLY
env:
ZEEK_CI_COMPILER: clang
ubuntu25_04_task:
container:
# Ubuntu 25.04 EOL: 2026-01-31
dockerfile: ci/ubuntu-25.04/Dockerfile
<< : *RESOURCES_TEMPLATE
<< : *CI_TEMPLATE
<< : *ONLY_IF_PR_MASTER_RELEASE
<< : *SKIP_IF_PR_NOT_FULL_CI
ubuntu24_04_task:
container: container:
# Ubuntu 24.04 EOL: Jun 2029 # Ubuntu 24.04 EOL: Jun 2029
dockerfile: ci/ubuntu-24.04/Dockerfile dockerfile: ci/ubuntu-24.04/Dockerfile
<< : *RESOURCES_TEMPLATE << : *RESOURCES_TEMPLATE
<< : *CI_TEMPLATE << : *CI_TEMPLATE
<< : *ONLY_IF_PR_MASTER_RELEASE
ubuntu22_task: << : *SKIP_IF_PR_SKIP_ALL
container:
# Ubuntu 22.04 EOL: June 2027
dockerfile: ci/ubuntu-22.04/Dockerfile
<< : *RESOURCES_TEMPLATE
<< : *CI_TEMPLATE
env: env:
ZEEK_CI_CREATE_ARTIFACT: 1 ZEEK_CI_CREATE_ARTIFACT: 1
upload_binary_artifacts: upload_binary_artifacts:
path: build.tgz path: build.tgz
benchmark_script: ./ci/benchmark.sh benchmark_script: ./ci/benchmark.sh
# Run on PRs, merges to master and release/.* and benchmark-nightly cron.
only_if: >
( $CIRRUS_PR != '' && $CIRRUS_BRANCH !=~ 'dependabot/.*' ) ||
( ( $CIRRUS_REPO_NAME == 'zeek' || $CIRRUS_REPO_NAME == 'zeek-security' ) &&
$CIRRUS_BRANCH == 'master' ||
$CIRRUS_BRANCH =~ 'release/.*' ||
$CIRRUS_CRON == 'benchmark-nightly' )
ubuntu22_spicy_task: # Same as above, but running the ZAM tests instead of the regular tests.
ubuntu24_04_zam_task:
container: container:
# Ubuntu 22.04 EOL: April 2027 # Ubuntu 24.04 EOL: Jun 2029
dockerfile: ci/ubuntu-22.04/Dockerfile dockerfile: ci/ubuntu-24.04/Dockerfile
<< : *RESOURCES_TEMPLATE << : *RESOURCES_TEMPLATE
<< : *CI_TEMPLATE << : *CI_TEMPLATE
<< : *ONLY_IF_PR_MASTER_RELEASE
<< : *SKIP_IF_PR_NOT_FULL_OR_ZAM
env:
ZEEK_CI_SKIP_UNIT_TESTS: 1
ZEEK_CI_SKIP_EXTERNAL_BTESTS: 1
ZEEK_CI_BTEST_EXTRA_ARGS: -a zam
# Use a lower number of jobs due to OOM issues with ZAM tasks
ZEEK_CI_BTEST_JOBS: 3
# Same as above, but using Clang and libc++
ubuntu24_04_clang_libcpp_task:
container:
# Ubuntu 24.04 EOL: Jun 2029
dockerfile: ci/ubuntu-24.04/Dockerfile
<< : *RESOURCES_TEMPLATE
<< : *CI_TEMPLATE
<< : *ONLY_IF_PR_MASTER_RELEASE
<< : *SKIP_IF_PR_NOT_FULL_CI
env:
CC: clang-19
CXX: clang++-19
CXXFLAGS: -stdlib=libc++
ubuntu24_04_clang_tidy_task:
container:
# Ubuntu 24.04 EOL: Jun 2029
dockerfile: ci/ubuntu-24.04/Dockerfile
<< : *RESOURCES_TEMPLATE
<< : *CI_TEMPLATE
<< : *ONLY_IF_PR_MASTER_RELEASE
<< : *SKIP_IF_PR_NOT_FULL_CI
env:
CC: clang-19
CXX: clang++-19
ZEEK_CI_CONFIGURE_FLAGS: *CLANG_TIDY_CONFIG
# Also enable Spicy SSL for this
ubuntu24_04_spicy_task:
container:
# Ubuntu 24.04 EOL: Jun 2029
dockerfile: ci/ubuntu-24.04/Dockerfile
<< : *RESOURCES_TEMPLATE
<< : *CI_TEMPLATE
<< : *ONLY_IF_PR_MASTER_RELEASE
<< : *SKIP_IF_PR_NOT_FULL_OR_BENCHMARK
env: env:
ZEEK_CI_CREATE_ARTIFACT: 1 ZEEK_CI_CREATE_ARTIFACT: 1
test_script: true # Don't run tests, these are redundant. ZEEK_CI_CONFIGURE_FLAGS: *SPICY_SSL_CONFIG
spicy_install_analyzers_script: ./ci/spicy-install-analyzers.sh spicy_install_analyzers_script: ./ci/spicy-install-analyzers.sh
upload_binary_artifacts: upload_binary_artifacts:
path: build.tgz path: build.tgz
benchmark_script: ./ci/benchmark.sh benchmark_script: ./ci/benchmark.sh
<< : *BENCHMARK_ONLY_IF_TEMPLATE
ubuntu22_spicy_head_task: ubuntu24_04_spicy_head_task:
container: container:
# Ubuntu 22.04 EOL: April 2027 # Ubuntu 24.04 EOL: Jun 2029
dockerfile: ci/ubuntu-22.04/Dockerfile dockerfile: ci/ubuntu-24.04/Dockerfile
<< : *RESOURCES_TEMPLATE << : *RESOURCES_TEMPLATE
<< : *CI_TEMPLATE << : *CI_TEMPLATE
<< : *ONLY_IF_PR_MASTER_RELEASE_NIGHTLY
<< : *SKIP_IF_PR_NOT_FULL_OR_BENCHMARK
env: env:
ZEEK_CI_CREATE_ARTIFACT: 1 ZEEK_CI_CREATE_ARTIFACT: 1
ZEEK_CI_CONFIGURE_FLAGS: *SPICY_SSL_CONFIG
# Pull auxil/spicy to the latest head version. May or may not build. # Pull auxil/spicy to the latest head version. May or may not build.
ZEEK_CI_PREBUILD_COMMAND: 'cd auxil/spicy && git fetch && git reset --hard origin/main && git submodule update --init --recursive' ZEEK_CI_PREBUILD_COMMAND: 'cd auxil/spicy && git fetch && git reset --hard origin/main && git submodule update --init --recursive'
spicy_install_analyzers_script: ./ci/spicy-install-analyzers.sh spicy_install_analyzers_script: ./ci/spicy-install-analyzers.sh
upload_binary_artifacts: upload_binary_artifacts:
path: build.tgz path: build.tgz
benchmark_script: ./ci/benchmark.sh benchmark_script: ./ci/benchmark.sh
# Don't run this job on release branches. It tests against spicy HEAD, which
# will frequently require other fixes that won't be in a release branch.
skip: $CIRRUS_BRANCH =~ 'release/.*'
<< : *BENCHMARK_ONLY_IF_TEMPLATE
ubuntu20_task: ubuntu22_04_task:
container: container:
# Ubuntu 20.04 EOL: April 2025 # Ubuntu 22.04 EOL: June 2027
dockerfile: ci/ubuntu-20.04/Dockerfile dockerfile: ci/ubuntu-22.04/Dockerfile
<< : *RESOURCES_TEMPLATE << : *RESOURCES_TEMPLATE
<< : *CI_TEMPLATE << : *CI_TEMPLATE
<< : *SKIP_TASK_ON_PR << : *ONLY_IF_PR_MASTER_RELEASE
<< : *SKIP_IF_PR_NOT_FULL_CI
alpine_task: alpine_task:
container: container:
@ -337,40 +489,47 @@ alpine_task:
dockerfile: ci/alpine/Dockerfile dockerfile: ci/alpine/Dockerfile
<< : *RESOURCES_TEMPLATE << : *RESOURCES_TEMPLATE
<< : *CI_TEMPLATE << : *CI_TEMPLATE
<< : *ONLY_IF_PR_MASTER_RELEASE
<< : *SKIP_IF_PR_NOT_FULL_CI
# Cirrus only supports the following macos runner currently, selecting # Cirrus only supports the following macos runner currently, selecting
# anything else automatically upgrades to this one. # anything else automatically upgrades to this one.
# #
# ghcr.io/cirruslabs/macos-runner:sonoma # ghcr.io/cirruslabs/macos-runner:sequoia
# #
# See also: https://cirrus-ci.org/guide/macOS/ # See also: https://cirrus-ci.org/guide/macOS/
macos_sonoma_task: macos_sequoia_task:
macos_instance: macos_instance:
image: ghcr.io/cirruslabs/macos-runner:sonoma image: ghcr.io/cirruslabs/macos-runner:sequoia
prepare_script: ./ci/macos/prepare.sh prepare_script: ./ci/macos/prepare.sh
<< : *CI_TEMPLATE << : *CI_TEMPLATE
<< : *ONLY_IF_PR_MASTER_RELEASE
<< : *SKIP_IF_PR_SKIP_ALL
<< : *MACOS_ENVIRONMENT << : *MACOS_ENVIRONMENT
# FreeBSD EOL timelines: https://www.freebsd.org/security/#sup # FreeBSD EOL timelines: https://www.freebsd.org/security/#sup
freebsd14_task: freebsd14_task:
freebsd_instance: freebsd_instance:
# FreeBSD 14 EOL: Nov 30 2028 # FreeBSD 14 EOL: Nov 30 2028
image_family: freebsd-14-0 image_family: freebsd-14-2
<< : *FREEBSD_RESOURCES_TEMPLATE << : *FREEBSD_RESOURCES_TEMPLATE
prepare_script: ./ci/freebsd/prepare.sh prepare_script: ./ci/freebsd/prepare.sh
<< : *CI_TEMPLATE << : *CI_TEMPLATE
<< : *ONLY_IF_PR_MASTER_RELEASE
<< : *SKIP_IF_PR_SKIP_ALL
<< : *FREEBSD_ENVIRONMENT << : *FREEBSD_ENVIRONMENT
freebsd13_task: freebsd13_task:
freebsd_instance: freebsd_instance:
# FreeBSD 13 EOL: January 31, 2026 # FreeBSD 13 EOL: January 31, 2026
image_family: freebsd-13-3 image_family: freebsd-13-4
<< : *FREEBSD_RESOURCES_TEMPLATE << : *FREEBSD_RESOURCES_TEMPLATE
prepare_script: ./ci/freebsd/prepare.sh prepare_script: ./ci/freebsd/prepare.sh
<< : *CI_TEMPLATE << : *CI_TEMPLATE
<< : *SKIP_TASK_ON_PR << : *ONLY_IF_PR_MASTER_RELEASE
<< : *SKIP_IF_PR_NOT_FULL_CI
<< : *FREEBSD_ENVIRONMENT << : *FREEBSD_ENVIRONMENT
asan_sanitizer_task: asan_sanitizer_task:
@ -380,6 +539,8 @@ asan_sanitizer_task:
<< : *RESOURCES_TEMPLATE << : *RESOURCES_TEMPLATE
<< : *CI_TEMPLATE << : *CI_TEMPLATE
<< : *ONLY_IF_PR_MASTER_RELEASE
<< : *SKIP_IF_PR_SKIP_ALL
test_fuzzers_script: ./ci/test-fuzzers.sh test_fuzzers_script: ./ci/test-fuzzers.sh
coverage_script: ./ci/upload-coverage.sh coverage_script: ./ci/upload-coverage.sh
env: env:
@ -389,6 +550,24 @@ asan_sanitizer_task:
# Use absolute paths for coverage files. # Use absolute paths for coverage files.
CCACHE_BASEDIR: CCACHE_BASEDIR:
# ASAN task executing btests with zam alternative.
asan_sanitizer_zam_task:
container:
dockerfile: ci/ubuntu-24.04/Dockerfile
<< : *RESOURCES_TEMPLATE
<< : *CI_TEMPLATE
<< : *ONLY_IF_PR_NIGHTLY
<< : *SKIP_IF_PR_NOT_FULL_OR_ZAM
env:
ZEEK_CI_CONFIGURE_FLAGS: *ASAN_SANITIZER_CONFIG
ASAN_OPTIONS: detect_leaks=1:detect_odr_violation=0
ZEEK_CI_SKIP_UNIT_TESTS: 1
ZEEK_CI_SKIP_EXTERNAL_BTESTS: 1
ZEEK_CI_BTEST_EXTRA_ARGS: -a zam
# Use a lower number of jobs due to OOM issues with ZAM tasks
ZEEK_CI_BTEST_JOBS: 3
ubsan_sanitizer_task: ubsan_sanitizer_task:
container: container:
# Just uses a recent/common distro to run undefined behavior checks. # Just uses a recent/common distro to run undefined behavior checks.
@ -396,16 +575,37 @@ ubsan_sanitizer_task:
<< : *RESOURCES_TEMPLATE << : *RESOURCES_TEMPLATE
<< : *CI_TEMPLATE << : *CI_TEMPLATE
<< : *SKIP_TASK_ON_PR << : *ONLY_IF_PR_NIGHTLY
<< : *SKIP_IF_PR_NOT_FULL_CI
test_fuzzers_script: ./ci/test-fuzzers.sh test_fuzzers_script: ./ci/test-fuzzers.sh
env: env:
CC: clang-18 CC: clang-19
CXX: clang++-18 CXX: clang++-19
CXXFLAGS: -DZEEK_DICT_DEBUG CXXFLAGS: -DZEEK_DICT_DEBUG
ZEEK_CI_CONFIGURE_FLAGS: *UBSAN_SANITIZER_CONFIG ZEEK_CI_CONFIGURE_FLAGS: *UBSAN_SANITIZER_CONFIG
ZEEK_TAILORED_UB_CHECKS: 1 ZEEK_TAILORED_UB_CHECKS: 1
UBSAN_OPTIONS: print_stacktrace=1 UBSAN_OPTIONS: print_stacktrace=1
ubsan_sanitizer_zam_task:
container:
dockerfile: ci/ubuntu-24.04/Dockerfile
<< : *RESOURCES_TEMPLATE
<< : *CI_TEMPLATE
<< : *ONLY_IF_PR_NIGHTLY
<< : *SKIP_IF_PR_NOT_FULL_OR_ZAM
env:
CC: clang-19
CXX: clang++-19
ZEEK_CI_CONFIGURE_FLAGS: *UBSAN_SANITIZER_CONFIG
ZEEK_TAILORED_UB_CHECKS: 1
UBSAN_OPTIONS: print_stacktrace=1
ZEEK_CI_SKIP_UNIT_TESTS: 1
ZEEK_CI_SKIP_EXTERNAL_BTESTS: 1
ZEEK_CI_BTEST_EXTRA_ARGS: -a zam
# Use a lower number of jobs due to OOM issues with ZAM tasks
ZEEK_CI_BTEST_JOBS: 3
tsan_sanitizer_task: tsan_sanitizer_task:
container: container:
# Just uses a recent/common distro to run memory error/leak checks. # Just uses a recent/common distro to run memory error/leak checks.
@ -413,10 +613,11 @@ tsan_sanitizer_task:
<< : *RESOURCES_TEMPLATE << : *RESOURCES_TEMPLATE
<< : *CI_TEMPLATE << : *CI_TEMPLATE
<< : *SKIP_TASK_ON_PR << : *ONLY_IF_PR_NIGHTLY
<< : *SKIP_IF_PR_NOT_FULL_CI
env: env:
CC: clang-18 CC: clang-19
CXX: clang++-18 CXX: clang++-19
ZEEK_CI_CONFIGURE_FLAGS: *TSAN_SANITIZER_CONFIG ZEEK_CI_CONFIGURE_FLAGS: *TSAN_SANITIZER_CONFIG
ZEEK_CI_DISABLE_SCRIPT_PROFILING: 1 ZEEK_CI_DISABLE_SCRIPT_PROFILING: 1
# If this is defined directly in the environment, configure fails to find # If this is defined directly in the environment, configure fails to find
@ -437,11 +638,12 @@ windows_task:
prepare_script: ci/windows/prepare.cmd prepare_script: ci/windows/prepare.cmd
build_script: ci/windows/build.cmd build_script: ci/windows/build.cmd
test_script: ci/windows/test.cmd test_script: ci/windows/test.cmd
<< : *ONLY_IF_PR_MASTER_RELEASE
<< : *SKIP_IF_PR_NOT_FULL_OR_WINDOWS
env: env:
ZEEK_CI_CPUS: 8 ZEEK_CI_CPUS: 8
# Give verbose error output on a test failure. # Give verbose error output on a test failure.
CTEST_OUTPUT_ON_FAILURE: 1 CTEST_OUTPUT_ON_FAILURE: 1
<< : *BUILDS_ONLY_IF_TEMPLATE
# Container images # Container images
@ -522,22 +724,18 @@ arm64_container_image_docker_builder:
env: env:
CIRRUS_ARCH: arm64 CIRRUS_ARCH: arm64
<< : *DOCKER_BUILD_TEMPLATE << : *DOCKER_BUILD_TEMPLATE
<< : *SKIP_TASK_ON_PR << : *ONLY_IF_RELEASE_TAG_NIGHTLY
amd64_container_image_docker_builder: amd64_container_image_docker_builder:
env: env:
CIRRUS_ARCH: amd64 CIRRUS_ARCH: amd64
<< : *DOCKER_BUILD_TEMPLATE << : *DOCKER_BUILD_TEMPLATE
<< : *SKIP_TASK_ON_PR << : *ONLY_IF_PR_MASTER_RELEASE_NIGHTLY
<< : *SKIP_IF_PR_NOT_FULL_OR_CLUSTER_TEST
container_image_manifest_docker_builder: container_image_manifest_docker_builder:
cpu: 1 cpu: 1
# Push master builds to zeek/zeek-dev, or tagged release branches to zeek/zeek << : *ONLY_IF_RELEASE_TAG_NIGHTLY
only_if: >
( $CIRRUS_CRON == '' ) &&
( $CIRRUS_REPO_FULL_NAME == 'zeek/zeek' &&
( $CIRRUS_BRANCH == 'master' ||
$CIRRUS_TAG =~ 'v[0-9]+\.[0-9]+\.[0-9]+$' ) )
env: env:
DOCKER_USERNAME: ENCRYPTED[!505b3dee552a395730a7e79e6aab280ffbe1b84ec62ae7616774dfefe104e34f896d2e20ce3ad701f338987c13c33533!] DOCKER_USERNAME: ENCRYPTED[!505b3dee552a395730a7e79e6aab280ffbe1b84ec62ae7616774dfefe104e34f896d2e20ce3ad701f338987c13c33533!]
DOCKER_PASSWORD: ENCRYPTED[!6c4b2f6f0e5379ef1091719cc5d2d74c90cfd2665ac786942033d6d924597ffb95dbbc1df45a30cc9ddeec76c07ac620!] DOCKER_PASSWORD: ENCRYPTED[!6c4b2f6f0e5379ef1091719cc5d2d74c90cfd2665ac786942033d6d924597ffb95dbbc1df45a30cc9ddeec76c07ac620!]
@ -556,8 +754,12 @@ container_image_manifest_docker_builder:
# for tags, or zeek/zeek-dev:latest for pushes to master. # for tags, or zeek/zeek-dev:latest for pushes to master.
set -x set -x
if [ -n "${CIRRUS_TAG}" ]; then if [ -n "${CIRRUS_TAG}" ]; then
echo "IMAGE_TAG=$(cat VERSION)" >> $CIRRUS_ENV
echo "IMAGE_NAME=zeek" >> $CIRRUS_ENV echo "IMAGE_NAME=zeek" >> $CIRRUS_ENV
echo "IMAGE_TAG=$(cat VERSION)" >> $CIRRUS_ENV
if [ "${CIRRUS_TAG}" != "v$(cat VERSION)" ]; then
echo "CIRRUS_TAG '${CIRRUS_TAG}' and VERSION '$(cat VERSION)' inconsistent!" >&2
exit 1
fi
elif [ "${CIRRUS_BRANCH}" = "master" ]; then elif [ "${CIRRUS_BRANCH}" = "master" ]; then
echo "IMAGE_NAME=zeek-dev" >> $CIRRUS_ENV echo "IMAGE_NAME=zeek-dev" >> $CIRRUS_ENV
echo "IMAGE_TAG=latest" >> $CIRRUS_ENV echo "IMAGE_TAG=latest" >> $CIRRUS_ENV
@ -584,31 +786,7 @@ container_image_manifest_docker_builder:
'+refs/heads/release/*:refs/remotes/origin/release/*' \ '+refs/heads/release/*:refs/remotes/origin/release/*' \
'+refs/heads/master:refs/remotes/origin/master' '+refs/heads/master:refs/remotes/origin/master'
# Find current versions for lts and feature depending on branches and ./ci/container-images-addl-tags.sh "${CIRRUS_TAG}" | tee -a $CIRRUS_ENV
# tags in the repo. sed for escaping the dot in the version for using
# it in the regex below to match against CIRRUS_TAG.
lts_ver=$(./ci/find-current-version.sh lts)
lts_pat="^v$(echo $lts_ver | sed 's,\.,\\.,g')\.[0-9]+\$"
feature_ver=$(./ci/find-current-version.sh feature)
feature_pat="^v$(echo $feature_ver | sed 's,\.,\\.,g')\.[0-9]+\$"
# Construct additional tags for the image. At most this will
# be "lts x.0 feature" for an lts branch x.0 that is currently
# also the latest feature branch.
ADDL_MANIFEST_TAGS=
if echo "${CIRRUS_TAG}" | grep -E "${lts_pat}"; then
ADDL_MANIFEST_TAGS="${ADDL_MANIFEST_TAGS} lts ${lts_ver}"
fi
if echo "${CIRRUS_TAG}" | grep -E "${feature_pat}"; then
ADDL_MANIFEST_TAGS="${ADDL_MANIFEST_TAGS} latest"
if [ "${feature_ver}" != "${lts_ver}" ]; then
ADDL_MANIFEST_TAGS="${ADDL_MANIFEST_TAGS} ${feature_ver}"
fi
fi
# Let downstream know about it.
echo "ADDITIONAL_MANIFEST_TAGS=${ADDL_MANIFEST_TAGS}" >> $CIRRUS_ENV
# These should've been populated by the previous jobs # These should've been populated by the previous jobs
zeek_image_arm64_cache: zeek_image_arm64_cache:
@ -636,8 +814,7 @@ container_image_manifest_docker_builder:
# images from the public ECR repository to stay within free-tier bounds. # images from the public ECR repository to stay within free-tier bounds.
public_ecr_cleanup_docker_builder: public_ecr_cleanup_docker_builder:
cpu: 1 cpu: 1
only_if: > << : *ONLY_IF_NIGHTLY
$CIRRUS_CRON == '' && $CIRRUS_REPO_FULL_NAME == 'zeek/zeek' && $CIRRUS_BRANCH == 'master'
env: env:
AWS_ACCESS_KEY_ID: ENCRYPTED[!eff52f6442e1bc78bce5b15a23546344df41bf519f6201924cb70c7af12db23f442c0e5f2b3687c2d856ceb11fcb8c49!] AWS_ACCESS_KEY_ID: ENCRYPTED[!eff52f6442e1bc78bce5b15a23546344df41bf519f6201924cb70c7af12db23f442c0e5f2b3687c2d856ceb11fcb8c49!]
AWS_SECRET_ACCESS_KEY: ENCRYPTED[!748bc302dd196140a5fa8e89c9efd148882dc846d4e723787d2de152eb136fa98e8dea7e6d2d6779d94f72dd3c088228!] AWS_SECRET_ACCESS_KEY: ENCRYPTED[!748bc302dd196140a5fa8e89c9efd148882dc846d4e723787d2de152eb136fa98e8dea7e6d2d6779d94f72dd3c088228!]
@ -677,27 +854,23 @@ cluster_testing_docker_builder:
path: "testing/external/zeek-testing-cluster/.tmp/**" path: "testing/external/zeek-testing-cluster/.tmp/**"
depends_on: depends_on:
- amd64_container_image - amd64_container_image
<< : *SKIP_TASK_ON_PR << : *ONLY_IF_PR_RELEASE_AND_NIGHTLY
<< : *SKIP_IF_PR_NOT_FULL_OR_CLUSTER_TEST
# Test zeekctl upon master and release pushes and also when # Test zeekctl upon master and release pushes and also when
# a PR has a zeekctlci or fullci label. # a PR has a "CI: Zeekctl" or "CI: Full" label.
# #
# Also triggers on CIRRUS_CRON == 'zeekctl-nightly' if that is configured # Also triggers on CIRRUS_CRON == 'zeekctl-nightly' if that is configured
# through the Cirrus Web UI. # through the Cirrus Web UI.
zeekctl_debian11_task: zeekctl_debian12_task:
cpu: *CPUS cpu: *CPUS
memory: *MEMORY memory: *MEMORY
only_if: > << : *ONLY_IF_PR_MASTER_RELEASE
( $CIRRUS_CRON == 'zeekctl-nightly' ) || << : *SKIP_IF_PR_NOT_FULL_OR_ZEEKCTL
( $CIRRUS_PR != '' && $CIRRUS_PR_LABELS =~ '.*(zeekctlci|fullci).*' ) ||
( $CIRRUS_REPO_NAME == 'zeek' && (
$CIRRUS_BRANCH == 'master' ||
$CIRRUS_BRANCH =~ 'release/.*' )
)
container: container:
# Debian 11 EOL: June 2026 # Debian 13 (trixie) EOL: TBD
dockerfile: ci/debian-11/Dockerfile dockerfile: ci/debian-13/Dockerfile
<< : *RESOURCES_TEMPLATE << : *RESOURCES_TEMPLATE
sync_submodules_script: git submodule update --recursive --init sync_submodules_script: git submodule update --recursive --init
always: always:
@ -711,31 +884,46 @@ zeekctl_debian11_task:
build_script: build_script:
- cd auxil/zeekctl/testing && ./Scripts/build-zeek - cd auxil/zeekctl/testing && ./Scripts/build-zeek
test_script: test_script:
- cd auxil/zeekctl/testing && ../../btest/btest -A -d -j ${BTEST_JOBS} - cd auxil/zeekctl/testing && ../../btest/btest -A -d -j ${ZEEK_CI_BTEST_JOBS}
on_failure: on_failure:
upload_zeekctl_testing_artifacts: upload_zeekctl_testing_artifacts:
path: "auxil/zeekctl/testing/.tmp/**" path: "auxil/zeekctl/testing/.tmp/**"
# Test building Zeek with builtin plugins available in include_plugins_debian12_task:
# testing/builtin-plugins/Files/
include_plugins_debian11_task:
cpu: *CPUS cpu: *CPUS
memory: *MEMORY memory: *MEMORY
container: container:
# Debian 11 EOL: June 2026 # Debian 13 (trixie) EOL: TBD
dockerfile: ci/debian-11/Dockerfile dockerfile: ci/debian-13/Dockerfile
<< : *RESOURCES_TEMPLATE << : *RESOURCES_TEMPLATE
sync_submodules_script: git submodule update --recursive --init sync_submodules_script: git submodule update --recursive --init
fetch_external_plugins_script:
- cd /zeek/testing/builtin-plugins/external && git clone https://github.com/zeek/zeek-perf-support.git
- cd zeek-perf-support && echo "Cloned $(git rev-parse HEAD) for $(basename $(pwd))"
- cd /zeek/testing/builtin-plugins/external && git clone https://github.com/zeek/zeek-more-hashes.git
- cd zeek-more-hashes && echo "Cloned $(git rev-parse HEAD) for $(basename $(pwd))"
- cd /zeek/testing/builtin-plugins/external && git clone https://github.com/zeek/zeek-cluster-backend-nats.git
- cd zeek-cluster-backend-nats && echo "Cloned $(git rev-parse HEAD) for $(basename $(pwd))"
- cd /zeek/testing/builtin-plugins/external && git clone https://github.com/SeisoLLC/zeek-kafka.git
- cd zeek-kafka && echo "Cloned $(git rev-parse HEAD) for $(basename $(pwd))"
always: always:
ccache_cache: ccache_cache:
folder: /tmp/ccache folder: /tmp/ccache
fingerprint_script: echo builtin-plugins-ccache-$ZEEK_CCACHE_EPOCH-$CIRRUS_TASK_NAME-$CIRRUS_OS fingerprint_script: echo builtin-plugins-ccache-$ZEEK_CCACHE_EPOCH-$CIRRUS_TASK_NAME-$CIRRUS_OS
reupload_on_changes: true reupload_on_changes: true
build_script: ZEEK_CI_CONFIGURE_FLAGS="${ZEEK_CI_CONFIGURE_FLAGS} --include-plugins='/zeek/testing/builtin-plugins/Files/protocol-plugin;/zeek/testing/builtin-plugins/Files/py-lib-plugin;/zeek/testing/builtin-plugins/Files/zeek-version-plugin'" ./ci/build.sh build_script: ZEEK_CI_CONFIGURE_FLAGS="${ZEEK_CI_CONFIGURE_FLAGS} --include-plugins='/zeek/testing/builtin-plugins/Files/protocol-plugin;/zeek/testing/builtin-plugins/Files/py-lib-plugin;/zeek/testing/builtin-plugins/Files/zeek-version-plugin;/zeek/testing/builtin-plugins/external/zeek-perf-support;/zeek/testing/builtin-plugins/external/zeek-more-hashes;/zeek/testing/builtin-plugins/external/zeek-cluster-backend-nats;/zeek/testing/builtin-plugins/external/zeek-kafka'" ./ci/build.sh
test_script: test_script:
- cd testing/builtin-plugins && ../../auxil/btest/btest -d -b -j ${ZEEK_CI_BTEST_JOBS} - cd testing/builtin-plugins && ../../auxil/btest/btest -d -b -j ${ZEEK_CI_BTEST_JOBS}
test_external_plugins_script: |
. /zeek/build/zeek-path-dev.sh
set -ex
# For now, just check if the external plugins are available.
zeek -N Zeek::PerfSupport
zeek -N Zeek::MoreHashes
zeek -N Zeek::Cluster_Backend_NATS
zeek -N Seiso::Kafka
on_failure: on_failure:
upload_include_plugins_testing_artifacts: upload_include_plugins_testing_artifacts:
path: "testing/builtin-plugins/.tmp/**" path: "testing/builtin-plugins/.tmp/**"
<< : *BUILDS_ONLY_IF_TEMPLATE << : *ONLY_IF_PR_MASTER_RELEASE
<< : *SKIP_TASK_ON_PR << : *SKIP_IF_PR_NOT_FULL_CI

View file

@ -1,4 +1,4 @@
# Copyright (c) 2020-2023 by the Zeek Project. See LICENSE for details. # See the file "COPYING" in the main distribution directory for copyright.
--- ---
Language: Cpp Language: Cpp
@ -71,6 +71,7 @@ IncludeBlocks: Regroup
# 4: any header that starts with "zeek/" # 4: any header that starts with "zeek/"
# 5: everything else, which should catch any of the auto-generated code from the # 5: everything else, which should catch any of the auto-generated code from the
# build directory as well # build directory as well
# 6: third party doctest header
# #
# Sections 0-1 and 2-3 get grouped together in their respective blocks # Sections 0-1 and 2-3 get grouped together in their respective blocks
IncludeCategories: IncludeCategories:
@ -86,6 +87,8 @@ IncludeCategories:
- Regex: '^<[[:print:]]+>' - Regex: '^<[[:print:]]+>'
Priority: 2 Priority: 2
SortPriority: 3 SortPriority: 3
- Regex: '^"zeek/3rdparty/doctest.h'
Priority: 6
- Regex: '^"zeek/' - Regex: '^"zeek/'
Priority: 4 Priority: 4
- Regex: '.*' - Regex: '.*'

View file

@ -1,5 +1,76 @@
Checks: '-*, Checks: [-*,
bugprone-*, bugprone-*,
performance-*,
modernize-*,
readability-isolate-declaration,
readability-container-contains,
# Enable a very limited number of the cppcoreguidelines checkers.
# See the notes for some of the rest of them below.
cppcoreguidelines-macro-usage,
cppcoreguidelines-misleading-capture-default-by-value,
cppcoreguidelines-virtual-class-destructor,
# Skipping these temporarily because they are very noisy
-bugprone-forward-declaration-namespace,
-bugprone-narrowing-conversions,
-bugprone-unchecked-optional-access,
-performance-unnecessary-value-param,
-modernize-use-equals-default,
-modernize-use-integer-sign-comparison,
# The following cause either lots of pointless or advisory warnings
-bugprone-easily-swappable-parameters, -bugprone-easily-swappable-parameters,
clang-analyzer-*, -bugprone-nondeterministic-pointer-iteration-order,
performance-*'
# bifcl generates a lot of code with double underscores in their name.
# ZAM uses a few identifiers that start with underscores or have
# double-underscores in the name.
-bugprone-reserved-identifier,
# bifcl generates almost every switch statement without a default case
# and so this one generates a lot of warnings.
-bugprone-switch-missing-default-case,
# These report warnings that are rather difficult to fix or are things
# we simply don't want to fix.
-bugprone-undefined-memory-manipulation,
-bugprone-pointer-arithmetic-on-polymorphic-object,
-bugprone-empty-catch,
-bugprone-exception-escape,
-bugprone-suspicious-include,
-modernize-avoid-c-arrays,
-modernize-concat-nested-namespaces,
-modernize-raw-string-literal,
-modernize-use-auto,
-modernize-use-nodiscard,
-modernize-use-trailing-return-type,
-modernize-use-designated-initializers,
# This one returns a bunch of findings in DFA and the sqlite library.
# We're unlikely to fix either of them.
-performance-no-int-to-ptr,
# These cppcoreguidelines checkers are things we should investigate
# and possibly fix, but there are so many findings that we're holding
# off doing it for now.
#cppcoreguidelines-init-variables,
#cppcoreguidelines-prefer-member-initializer,
#cppcoreguidelines-pro-type-member-init,
#cppcoreguidelines-pro-type-cstyle-cast,
#cppcoreguidelines-pro-type-static-cast-downcast,
#cppcoreguidelines-special-member-functions,
# These are features in newer version of C++ that we don't have
# access to yet.
-modernize-use-std-format,
-modernize-use-std-print,
]
HeaderFilterRegex: '.h'
ExcludeHeaderFilterRegex: '.*(auxil|3rdparty)/.*'
SystemHeaders: false
CheckOptions:
- key: modernize-use-default-member-init.UseAssignment
value: 'true'
WarningsAsErrors: '*'

View file

@ -72,10 +72,23 @@
"SOURCES": "*", "SOURCES": "*",
"MODULES": "*" "MODULES": "*"
} }
},
"zeek_add_plugin": {
"kwargs": {
"INCLUDE_DIRS": "*",
"DEPENDENCIES": "*",
"SOURCES": "*",
"BIFS": "*",
"PAC": "*"
}
} }
} }
}, },
"format": { "format": {
"always_wrap": [
"spicy_add_analyzer",
"zeek_add_plugin"
],
"line_width": 100, "line_width": 100,
"tab_size": 4, "tab_size": 4,
"separate_ctrl_name_with_space": true, "separate_ctrl_name_with_space": true,

View file

@ -33,3 +33,6 @@ f5a76c1aedc7f8886bc6abef0dfaa8065684b1f6
# clang-format: Format JSON with clang-format # clang-format: Format JSON with clang-format
e6256446ddef5c5d5240eefff974556f2e12ac46 e6256446ddef5c5d5240eefff974556f2e12ac46
# analyzer/protocol: Reformat with spicy-format
d70bcd07b9b26036b16092fe950eca40e2f5a032

View file

@ -10,10 +10,10 @@ permissions:
jobs: jobs:
scan: scan:
if: github.repository == 'zeek/zeek' if: github.repository == 'zeek/zeek'
runs-on: ubuntu-20.04 runs-on: ubuntu-24.04
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v4
with: with:
submodules: "recursive" submodules: "recursive"
@ -21,58 +21,71 @@ jobs:
run: | run: |
sudo apt-get update sudo apt-get update
sudo apt-get -y install \ sudo apt-get -y install \
git \
cmake \
make \
gcc \
g++ \
flex \
bison \ bison \
bsdmainutils \
cmake \
curl \
flex \
g++ \
gcc \
git \
jq \
libfl-dev \
libfl2 \
libkrb5-dev \
libmaxminddb-dev \
libpcap-dev \ libpcap-dev \
libssl-dev \ libssl-dev \
libzmq3-dev \
make \
python3 \ python3 \
python3-dev \ python3-dev \
python3-pip \ python3-pip \
swig \
zlib1g-dev \
libmaxminddb-dev \
libkrb5-dev \
bsdmainutils \
sqlite3 \ sqlite3 \
curl \ swig \
wget zlib1g-dev
- name: Configure - name: Configure
run: ./configure --build-type=debug --disable-broker-tests --disable-spicy run: ./configure --build-type=debug --disable-broker-tests
- name: Fetch Coverity Tools - name: Fetch Coverity Tools
env: env:
COVERITY_TOKEN: ${{ secrets.COVERITY_TOKEN }} COVERITY_TOKEN: ${{ secrets.COVERITY_TOKEN }}
run: | run: |
wget \ curl \
-nv https://scan.coverity.com/download/cxx/linux64 \ -o coverity_tool.tgz \
--post-data "token=${COVERITY_TOKEN}&project=Bro" \ -d token=${COVERITY_TOKEN} \
-O coverity_tool.tgz -d project=Bro \
https://scan.coverity.com/download/cxx/linux64
tar xzf coverity_tool.tgz tar xzf coverity_tool.tgz
rm coverity_tool.tgz rm coverity_tool.tgz
mv cov-analysis* coverity-tools mv cov-analysis* coverity-tools
- name: Build - name: Build
run: | run: |
export PATH=`pwd`/coverity-tools/bin:$PATH export PATH=$(pwd)/coverity-tools/bin:$PATH
( cd build && cov-build --dir cov-int make -j $(nproc) ) ( cd build && cov-build --dir cov-int make -j "$(nproc)" )
cat build/cov-int/build-log.txt cat build/cov-int/build-log.txt
- name: Submit - name: Submit
env: env:
COVERITY_TOKEN: ${{ secrets.COVERITY_TOKEN }} COVERITY_TOKEN: ${{ secrets.COVERITY_TOKEN }}
run: | run: |
cd build ( cd build && tar czf myproject.tgz cov-int )
tar czf myproject.tgz cov-int curl -X POST \
curl \ -d version=$(cat VERSION) \
--form token=${COVERITY_TOKEN} \ -d description=$(git rev-parse HEAD) \
--form email=zeek-commits-internal@zeek.org \ -d email=zeek-commits-internal@zeek.org \
--form file=@myproject.tgz \ -d token=${COVERITY_TOKEN} \
--form "version=`cat ../VERSION`" \ -d file_name=myproject.tgz \
--form "description=`git rev-parse HEAD`" \ -o response \
https://scan.coverity.com/builds?project=Bro https://scan.coverity.com/projects/641/builds/init
upload_url=$(jq -r '.url' response)
build_id=$(jq -r '.build_id' response)
curl -X PUT \
--header 'Content-Type: application/json' \
--upload-file build/myproject.tgz \
${upload_url}
curl -X PUT \
-d token=${COVERITY_TOKEN} \
https://scan.coverity.com/projects/641/builds/${build_id}/enqueue

View file

@ -16,20 +16,20 @@ jobs:
generate: generate:
permissions: permissions:
contents: write # for Git to git push contents: write # for Git to git push
if: github.repository == 'zeek/zeek' if: "github.repository == 'zeek/zeek' && contains(github.event.pull_request.labels.*.name, 'CI: Skip All') == false"
runs-on: ubuntu-latest runs-on: ubuntu-24.04
steps: steps:
# We only perform a push if the action was triggered via a schedule # We only perform a push if the action was triggered via a schedule
# event, so we only need to authenticate in that case. Use # event, so we only need to authenticate in that case. Use
# unauthenticated access otherwise so this action can e.g., also run from # unauthenticated access otherwise so this action can e.g., also run from
# clones. # clones.
- uses: actions/checkout@v3 - uses: actions/checkout@v4
if: github.event_name == 'schedule' if: github.event_name == 'schedule'
with: with:
submodules: "recursive" submodules: "recursive"
token: ${{ secrets.ZEEK_BOT_TOKEN }} token: ${{ secrets.ZEEK_BOT_TOKEN }}
- uses: actions/checkout@v3 - uses: actions/checkout@v4
if: github.event_name != 'schedule' if: github.event_name != 'schedule'
with: with:
submodules: "recursive" submodules: "recursive"
@ -51,27 +51,29 @@ jobs:
bsdmainutils \ bsdmainutils \
ccache \ ccache \
cmake \ cmake \
cppzmq-dev \
flex \ flex \
g++ \ g++ \
gcc \ gcc \
git \ git \
libhiredis-dev \
libfl-dev \ libfl-dev \
libfl2 \ libfl2 \
libkrb5-dev \ libkrb5-dev \
libnode-dev \
libpcap-dev \ libpcap-dev \
libssl-dev \ libssl-dev \
make \ make \
python3 \ python3 \
python3-dev \ python3-dev \
python3-pip\ python3-pip \
sqlite3 \ sqlite3 \
swig \ swig \
zlib1g-dev zlib1g-dev
# Many distros adhere to PEP 394's recommendation for `python` = python3 -m venv ci-docs-venv
# `python2` so this is a simple workaround until we drop Python 2 source ci-docs-venv/bin/activate
# support and explicitly use `python3` for all invocations. pip3 install -r doc/requirements.txt
sudo ln -sf /usr/bin/python3 /usr/local/bin/python pip3 install pre-commit
sudo pip3 install -r doc/requirements.txt
- name: ccache - name: ccache
uses: hendrikmuhs/ccache-action@v1.2 uses: hendrikmuhs/ccache-action@v1.2
@ -79,25 +81,48 @@ jobs:
key: 'docs-gen-${{ github.job }}' key: 'docs-gen-${{ github.job }}'
max-size: '2000M' max-size: '2000M'
# Github runners have node installed on them by default in /usr/local. This
# causes problems with configure finding the version from the apt package,
# plus gcc using it by default if we pass the right cmake variables to
# configure. The easiest solution is to move the directory away prior to
# running our build. It's moved back after just in case some workflow action
# expects it to exist.
- name: Move default node install to backup
run: sudo mv /usr/local/include/node /usr/local/include/node.bak
- name: Configure - name: Configure
run: ./configure --disable-broker-tests --disable-cpp-tests --ccache run: ./configure --disable-broker-tests --disable-cpp-tests --ccache
- name: Build - name: Build
run: cd build && make -j $(nproc) run: cd build && make -j $(nproc)
- name: Move default node install to original location
run: sudo mv /usr/local/include/node.bak /usr/local/include/node
- name: Check Spicy docs - name: Check Spicy docs
run: cd doc && make check-spicy-docs run: cd doc && make check-spicy-docs
# Cache pre-commit environment for reuse.
- uses: actions/cache@v4
with:
path: ~/.cache/pre-commit
key: doc-pre-commit-3|${{ env.pythonLocation }}|${{ hashFiles('doc/.pre-commit-config.yaml') }}
- name: Generate Docs - name: Generate Docs
run: | run: |
source ci-docs-venv/bin/activate
git config --global user.name zeek-bot git config --global user.name zeek-bot
git config --global user.email info@zeek.org git config --global user.email info@zeek.org
echo "*** Generating Zeekygen Docs ***" echo "*** Generating Zeekygen Docs ***"
./ci/update-zeekygen-docs.sh || exit 1 ./ci/update-zeekygen-docs.sh || exit 1
echo "*** Generating Sphinx Docs ***"
cd doc cd doc
echo "*** Running pre-commit ***"
pre-commit run -a --show-diff-on-failure --color=always
echo "*** Generating Sphinx Docs ***"
make > make.out 2>&1 make > make.out 2>&1
make_status=$? make_status=$?
echo "*** Sphinx Build Output ***" echo "*** Sphinx Build Output ***"
@ -131,7 +156,7 @@ jobs:
# Only send notifications for scheduled runs. Runs from pull requests # Only send notifications for scheduled runs. Runs from pull requests
# show failures in the GitHub UI. # show failures in the GitHub UI.
if: failure() && github.event_name == 'schedule' if: failure() && github.event_name == 'schedule'
uses: dawidd6/action-send-mail@v3.7.0 uses: dawidd6/action-send-mail@v3.12.0
with: with:
server_address: ${{secrets.SMTP_HOST}} server_address: ${{secrets.SMTP_HOST}}
server_port: ${{secrets.SMTP_PORT}} server_port: ${{secrets.SMTP_PORT}}

View file

@ -7,8 +7,8 @@ on:
jobs: jobs:
pre-commit: pre-commit:
runs-on: ubuntu-latest runs-on: ubuntu-22.04
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v4
- uses: actions/setup-python@v4 - uses: actions/setup-python@v5
- uses: pre-commit/action@v3.0.0 - uses: pre-commit/action@v3.0.1

27
.gitmodules vendored
View file

@ -1,9 +1,6 @@
[submodule "auxil/zeek-aux"] [submodule "auxil/zeek-aux"]
path = auxil/zeek-aux path = auxil/zeek-aux
url = https://github.com/zeek/zeek-aux url = https://github.com/zeek/zeek-aux
[submodule "auxil/binpac"]
path = auxil/binpac
url = https://github.com/zeek/binpac
[submodule "auxil/zeekctl"] [submodule "auxil/zeekctl"]
path = auxil/zeekctl path = auxil/zeekctl
url = https://github.com/zeek/zeekctl url = https://github.com/zeek/zeekctl
@ -13,18 +10,12 @@
[submodule "cmake"] [submodule "cmake"]
path = cmake path = cmake
url = https://github.com/zeek/cmake url = https://github.com/zeek/cmake
[submodule "src/3rdparty"]
path = src/3rdparty
url = https://github.com/zeek/zeek-3rdparty
[submodule "auxil/broker"] [submodule "auxil/broker"]
path = auxil/broker path = auxil/broker
url = https://github.com/zeek/broker url = https://github.com/zeek/broker
[submodule "auxil/netcontrol-connectors"] [submodule "auxil/netcontrol-connectors"]
path = auxil/netcontrol-connectors path = auxil/netcontrol-connectors
url = https://github.com/zeek/zeek-netcontrol url = https://github.com/zeek/zeek-netcontrol
[submodule "auxil/bifcl"]
path = auxil/bifcl
url = https://github.com/zeek/bifcl
[submodule "doc"] [submodule "doc"]
path = doc path = doc
url = https://github.com/zeek/zeek-docs url = https://github.com/zeek/zeek-docs
@ -46,9 +37,6 @@
[submodule "auxil/zeek-client"] [submodule "auxil/zeek-client"]
path = auxil/zeek-client path = auxil/zeek-client
url = https://github.com/zeek/zeek-client url = https://github.com/zeek/zeek-client
[submodule "auxil/gen-zam"]
path = auxil/gen-zam
url = https://github.com/zeek/gen-zam
[submodule "auxil/c-ares"] [submodule "auxil/c-ares"]
path = auxil/c-ares path = auxil/c-ares
url = https://github.com/c-ares/c-ares url = https://github.com/c-ares/c-ares
@ -58,12 +46,6 @@
[submodule "auxil/spicy"] [submodule "auxil/spicy"]
path = auxil/spicy path = auxil/spicy
url = https://github.com/zeek/spicy url = https://github.com/zeek/spicy
[submodule "auxil/filesystem"]
path = auxil/filesystem
url = https://github.com/gulrak/filesystem.git
[submodule "auxil/zeek-af_packet-plugin"]
path = auxil/zeek-af_packet-plugin
url = https://github.com/zeek/zeek-af_packet-plugin.git
[submodule "auxil/libunistd"] [submodule "auxil/libunistd"]
path = auxil/libunistd path = auxil/libunistd
url = https://github.com/zeek/libunistd url = https://github.com/zeek/libunistd
@ -76,3 +58,12 @@
[submodule "auxil/prometheus-cpp"] [submodule "auxil/prometheus-cpp"]
path = auxil/prometheus-cpp path = auxil/prometheus-cpp
url = https://github.com/zeek/prometheus-cpp url = https://github.com/zeek/prometheus-cpp
[submodule "src/cluster/backend/zeromq/auxil/cppzmq"]
path = src/cluster/backend/zeromq/auxil/cppzmq
url = https://github.com/zeromq/cppzmq
[submodule "src/cluster/websocket/auxil/IXWebSocket"]
path = src/cluster/websocket/auxil/IXWebSocket
url = https://github.com/machinezone/IXWebSocket
[submodule "auxil/expected-lite"]
path = auxil/expected-lite
url = https://github.com/martinmoene/expected-lite.git

View file

@ -2,34 +2,58 @@
# See https://pre-commit.com/hooks.html for more hooks # See https://pre-commit.com/hooks.html for more hooks
# #
repos: repos:
- repo: local
hooks:
- id: license
name: Check for license headers
entry: ./ci/license-header.py
language: python
files: '\.(h|c|cpp|cc|spicy|evt)$'
types: [file]
exclude: '^(testing/btest/(Baseline|plugins|spicy|scripts)/.*|testing/builtin-plugins/.*|src/3rdparty/.*)$'
- id: btest-command-commented
name: Check that all BTest command lines are commented out
entry: '^\s*@TEST-'
language: pygrep
files: '^testing/btest/.*$'
- repo: https://github.com/pre-commit/mirrors-clang-format - repo: https://github.com/pre-commit/mirrors-clang-format
rev: 'v17.0.3' rev: v20.1.8
hooks: hooks:
- id: clang-format - id: clang-format
types_or: types_or:
- "c" - "c"
- "c++" - "c++"
- "json" - "json"
exclude: '^src/3rdparty/.*'
- repo: https://github.com/maxwinterstein/shfmt-py - repo: https://github.com/maxwinterstein/shfmt-py
rev: v3.7.0.1 rev: v3.12.0.1
hooks: hooks:
- id: shfmt - id: shfmt
args: ["-w", "-i", "4", "-ci"] args: ["-w", "-i", "4", "-ci"]
- repo: https://github.com/google/yapf - repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.40.2 rev: v0.12.8
hooks: hooks:
- id: yapf - id: ruff-check
args: ["--fix"]
- id: ruff-format
- repo: https://github.com/cheshirekow/cmake-format-precommit - repo: https://github.com/cheshirekow/cmake-format-precommit
rev: v0.6.13 rev: v0.6.13
hooks: hooks:
- id: cmake-format - id: cmake-format
exclude: '^auxil/.*$'
- repo: https://github.com/crate-ci/typos - repo: https://github.com/crate-ci/typos
rev: v1.16.21 rev: v1.35.3
hooks: hooks:
- id: typos - id: typos
exclude: '^(.typos.toml|src/SmithWaterman.cc|testing/.*|auxil/.*|scripts/base/frameworks/files/magic/.*|CHANGES)$' exclude: '^(.typos.toml|src/SmithWaterman.cc|testing/.*|auxil/.*|scripts/base/frameworks/files/magic/.*|CHANGES|scripts/base/protocols/ssl/mozilla-ca-list.zeek|src/3rdparty/.*)$'
- repo: https://github.com/bbannier/spicy-format
rev: v0.26.0
hooks:
- id: spicy-format
exclude: '^testing/.*'

View file

@ -1,2 +0,0 @@
[style]
column_limit=100

View file

@ -6,9 +6,9 @@ extend-ignore-re = [
# ALLO is a valid FTP command # ALLO is a valid FTP command
"\"ALLO\".*200", "\"ALLO\".*200",
"des-ede3-cbc-Env-OID", "des-ede3-cbc-Env-OID",
"Remove in v6.1.*SupressWeird",
"max_repititions:.*Remove in v6.1",
"mis-aliasing of", "mis-aliasing of",
"mis-indexing",
"compilability",
# On purpose # On purpose
"\"THE NETBIOS NAM\"", "\"THE NETBIOS NAM\"",
# NFS stuff. # NFS stuff.
@ -20,16 +20,25 @@ extend-ignore-re = [
"ot->Tag\\(\\) == TYPE_.*", "ot->Tag\\(\\) == TYPE_.*",
"auto.* ot =", "auto.* ot =",
"ot = OP_.*", "ot = OP_.*",
"ot\\[",
"ot.size",
"ot.empty",
"ot_i",
"ot.c_str",
"have_ot",
"if \\( ot == OP_.*", "if \\( ot == OP_.*",
"ot->Yield\\(\\)->InternalType\\(\\)", "ot->Yield\\(\\)->InternalType\\(\\)",
"switch \\( ot \\)", "switch \\( ot \\)",
"\\(ZAMOpType ot\\)", "\\(ZAMOpType ot\\)",
"exat", # Redis expire at
"EXAT",
# News stuff # News stuff
"SupressWeirds.*deprecated", "SupressWeirds.*deprecated",
"\"BaR\"", "\"BaR\"",
"\"xFoObar\"", "\"xFoObar\"",
"\"FoO\"", "\"FoO\"",
"Smoot",
] ]
extend-ignore-identifiers-re = [ extend-ignore-identifiers-re = [
@ -41,6 +50,17 @@ extend-ignore-identifiers-re = [
"ND_ROUTER_.*", "ND_ROUTER_.*",
"ND_NEIGHBOR_.*", "ND_NEIGHBOR_.*",
".*_ND_option.*", ".*_ND_option.*",
"bck", # Used with same length as `fwd`
"pn", # Use for `PoolNode` variables
"ffrom_[ip|port|mac]", # Used in netcontrol.
"complte_flag", # Existing use in exported record in base.
"VidP(n|N)", # In SMB.
"iin", # In DNP3.
"SCN[dioux]", # sccanf fixed-width identifiers
"(ScValidatePnPService|ScSendPnPMessage)", # In DCE-RPC.
"snet", # Used as shorthand for subnet in base scripts.
"typ",
"(e|i)it", # Used as name for some iterators.
] ]
[default.extend-identifiers] [default.extend-identifiers]
@ -53,7 +73,7 @@ ND_REDIRECT = "ND_REDIRECT"
NED_ACK = "NED_ACK" NED_ACK = "NED_ACK"
NFS3ERR_ACCES = "NFS3ERR_ACCES" NFS3ERR_ACCES = "NFS3ERR_ACCES"
NO_SEH = "NO_SEH" NO_SEH = "NO_SEH"
OP_SWITCHS_VVV = "OP_SWITCHS_VVV" OP_SWITCHS_Vii = "OP_SWITCHS_Vii"
O_WRONLY = "O_WRONLY" O_WRONLY = "O_WRONLY"
RPC_NT_CALL_FAILED_DNE = "RPC_NT_CALL_FAILED_DNE" RPC_NT_CALL_FAILED_DNE = "RPC_NT_CALL_FAILED_DNE"
RpcAddPrintProvidor = "RpcAddPrintProvidor" RpcAddPrintProvidor = "RpcAddPrintProvidor"
@ -64,6 +84,9 @@ have_2nd = "have_2nd"
ot1 = "ot1" ot1 = "ot1"
ot2 = "ot2" ot2 = "ot2"
uses_seh = "uses_seh" uses_seh = "uses_seh"
ect0 = "ect0"
ect1 = "ect1"
tpe = "tpe"
[default.extend-words] [default.extend-words]
caf = "caf" caf = "caf"

6890
CHANGES

File diff suppressed because it is too large Load diff

View file

@ -18,6 +18,22 @@ if (WIN32)
set(CMAKE_TOOLCHAIN_FILE ${_toolchain} CACHE STRING "Vcpkg toolchain file") set(CMAKE_TOOLCHAIN_FILE ${_toolchain} CACHE STRING "Vcpkg toolchain file")
endif () endif ()
if (APPLE AND CMAKE_VERSION VERSION_GREATER_EQUAL 4.0.0 AND NOT CMAKE_OSX_SYSROOT)
# Spicy needs having CMAKE_OSX_SYSROOT point to the macOS SDK
# path, but starting with CMake 4.0 CMAKE_OSX_SYSROOT is not set
# automatically anymore. So we follow the guidance from the CMake 4.0
# release notes here:
#
# Builds targeting macOS no longer choose any SDK or pass an "-isysroot"
# flag to the compiler by default. [...] users must now specify
# "-DCMAKE_OSX_SYSROOT=macosx" when configuring their build.
#
# Note that this needs to happen before the project() call below, meaning
# we cannot rely on the corresponding code inside the Spicy CMake
# configuration.
set(CMAKE_OSX_SYSROOT "macosx")
endif ()
project(Zeek C CXX) project(Zeek C CXX)
# We want to set ENABLE_DEBUG to ON by default if the build type is Debug. # We want to set ENABLE_DEBUG to ON by default if the build type is Debug.
@ -43,6 +59,8 @@ option(ENABLE_DEBUG "Build Zeek with additional debugging support." ${ENABLE_DEB
option(ENABLE_JEMALLOC "Link against jemalloc." OFF) option(ENABLE_JEMALLOC "Link against jemalloc." OFF)
option(ENABLE_PERFTOOLS "Build with support for Google perftools." OFF) option(ENABLE_PERFTOOLS "Build with support for Google perftools." OFF)
option(ENABLE_ZEEK_UNIT_TESTS "Build the C++ unit tests." ON) option(ENABLE_ZEEK_UNIT_TESTS "Build the C++ unit tests." ON)
option(ENABLE_IWYU "Enable include-what-you-use for the main Zeek target." OFF)
option(ENABLE_CLANG_TIDY "Enable clang-tidy for the main Zeek target." OFF)
option(INSTALL_AUX_TOOLS "Install additional tools from auxil." ${ZEEK_INSTALL_TOOLS_DEFAULT}) option(INSTALL_AUX_TOOLS "Install additional tools from auxil." ${ZEEK_INSTALL_TOOLS_DEFAULT})
option(INSTALL_BTEST "Install btest alongside Zeek." ${ZEEK_INSTALL_TOOLS_DEFAULT}) option(INSTALL_BTEST "Install btest alongside Zeek." ${ZEEK_INSTALL_TOOLS_DEFAULT})
option(INSTALL_BTEST_PCAPS "Install pcap files for testing." ${ZEEK_INSTALL_TOOLS_DEFAULT}) option(INSTALL_BTEST_PCAPS "Install pcap files for testing." ${ZEEK_INSTALL_TOOLS_DEFAULT})
@ -50,7 +68,8 @@ option(INSTALL_ZEEKCTL "Install zeekctl." ${ZEEK_INSTALL_TOOLS_DEFAULT})
option(INSTALL_ZEEK_CLIENT "Install the zeek-client." ${ZEEK_INSTALL_TOOLS_DEFAULT}) option(INSTALL_ZEEK_CLIENT "Install the zeek-client." ${ZEEK_INSTALL_TOOLS_DEFAULT})
option(INSTALL_ZKG "Install zkg." ${ZEEK_INSTALL_TOOLS_DEFAULT}) option(INSTALL_ZKG "Install zkg." ${ZEEK_INSTALL_TOOLS_DEFAULT})
option(PREALLOCATE_PORT_ARRAY "Pre-allocate all ports for zeek::Val." ON) option(PREALLOCATE_PORT_ARRAY "Pre-allocate all ports for zeek::Val." ON)
option(ZEEK_STANDALONE "Build Zeek as stand-alone binary?" ON) option(ZEEK_STANDALONE "Build Zeek as stand-alone binary." ON)
option(ZEEK_ENABLE_FUZZERS "Build Zeek fuzzing targets." OFF)
# Non-boolean options. # Non-boolean options.
if (NOT WIN32) if (NOT WIN32)
@ -71,8 +90,6 @@ set(ZEEK_ETC_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/etc"
set(CMAKE_EXPORT_COMPILE_COMMANDS ON CACHE INTERNAL set(CMAKE_EXPORT_COMPILE_COMMANDS ON CACHE INTERNAL
"Whether to write a JSON compile commands database") "Whether to write a JSON compile commands database")
set(ZEEK_CXX_STD cxx_std_17 CACHE STRING "The C++ standard to use.")
set(ZEEK_SANITIZERS "" CACHE STRING "Sanitizers to use when building.") set(ZEEK_SANITIZERS "" CACHE STRING "Sanitizers to use when building.")
set(CPACK_SOURCE_IGNORE_FILES "" CACHE STRING "Files to be ignored by CPack") set(CPACK_SOURCE_IGNORE_FILES "" CACHE STRING "Files to be ignored by CPack")
@ -175,21 +192,53 @@ if (MSVC)
# TODO: This is disabled for now because there a bunch of known # TODO: This is disabled for now because there a bunch of known
# compiler warnings on Windows that we don't have good fixes for. # compiler warnings on Windows that we don't have good fixes for.
#set(WERROR_FLAG "/WX") #set(WERROR_FLAG "/WX")
#set(WERROR_FLAG "/WX") #set(WNOERROR_FLAG "/WX:NO")
endif () endif ()
# Always build binpac in static mode if building on Windows
set(BUILD_STATIC_BINPAC true)
else () else ()
include(GNUInstallDirs) include(GNUInstallDirs)
if (BUILD_WITH_WERROR) if (BUILD_WITH_WERROR)
set(WERROR_FLAG "-Werror") set(WERROR_FLAG "-Werror")
set(WNOERROR_FLAG "-Wno-error")
# With versions >=13.0 GCC gained `-Warray-bounds` which reports false
# positives, see e.g., https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111273.
if (CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 13.0)
list(APPEND WERROR_FLAG "-Wno-error=array-bounds")
endif ()
# With versions >=11.0 GCC is returning false positives for -Wrestrict. See
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100366. It's more prevalent
# building with -std=c++20.
if (CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 11.0)
list(APPEND WERROR_FLAG "-Wno-error=restrict")
endif ()
endif () endif ()
endif () endif ()
include(cmake/CommonCMakeConfig.cmake) include(cmake/CommonCMakeConfig.cmake)
include(cmake/FindClangTidy.cmake)
include(cmake/CheckCompilerArch.cmake) include(cmake/CheckCompilerArch.cmake)
include(cmake/RequireCXXStd.cmake)
string(TOLOWER ${CMAKE_BUILD_TYPE} CMAKE_BUILD_TYPE_LOWER) string(TOLOWER ${CMAKE_BUILD_TYPE} CMAKE_BUILD_TYPE_LOWER)
if (ENABLE_IWYU)
find_program(ZEEK_IWYU_PATH NAMES include-what-you-use iwyu)
if (NOT ZEEK_IWYU_PATH)
message(FATAL_ERROR "Could not find the program include-what-you-use")
endif ()
endif ()
if (ENABLE_CLANG_TIDY)
find_program(ZEEK_CLANG_TIDY_PATH NAMES clang-tidy)
if (NOT ZEEK_CLANG_TIDY_PATH)
message(FATAL_ERROR "Could not find the program clang-tidy")
endif ()
endif ()
# ############################################################################## # ##############################################################################
# Main targets and utilities. # Main targets and utilities.
@ -201,7 +250,7 @@ set(ZEEK_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
# zeek-plugin-create-package.sh. Needed by ZeekPluginConfig.cmake.in. # zeek-plugin-create-package.sh. Needed by ZeekPluginConfig.cmake.in.
set(ZEEK_PLUGIN_SCRIPTS_PATH "${PROJECT_SOURCE_DIR}/cmake") set(ZEEK_PLUGIN_SCRIPTS_PATH "${PROJECT_SOURCE_DIR}/cmake")
# Our C++17 base target for propagating compiler and linker flags. Note: for # Our C++ base target for propagating compiler and linker flags. Note: for
# now, we only use it for passing library dependencies around. # now, we only use it for passing library dependencies around.
add_library(zeek_internal INTERFACE) add_library(zeek_internal INTERFACE)
add_library(Zeek::Internal ALIAS zeek_internal) add_library(Zeek::Internal ALIAS zeek_internal)
@ -289,6 +338,16 @@ function (zeek_target_link_libraries lib_target)
endforeach () endforeach ()
endfunction () endfunction ()
function (zeek_target_add_linters lib_target)
if (ZEEK_IWYU_PATH)
set_target_properties(${lib_target} PROPERTIES CXX_INCLUDE_WHAT_YOU_USE ${ZEEK_IWYU_PATH})
endif ()
if (ZEEK_CLANG_TIDY_PATH)
set_target_properties(${lib_target} PROPERTIES CXX_CLANG_TIDY ${ZEEK_CLANG_TIDY_PATH})
endif ()
endfunction ()
function (zeek_include_directories) function (zeek_include_directories)
foreach (name zeek_exe zeek_lib zeek_fuzzer_shared) foreach (name zeek_exe zeek_lib zeek_fuzzer_shared)
if (TARGET ${name}) if (TARGET ${name})
@ -310,7 +369,7 @@ endfunction ()
find_package(Threads REQUIRED) find_package(Threads REQUIRED)
# Interface library for propagating extra flags and include paths to dynamically # Interface library for propagating extra flags and include paths to dynamically
# loaded plugins. Also propagates include paths and C++17 mode on the install # loaded plugins. Also propagates include paths and c++ standard mode on the install
# interface. # interface.
add_library(zeek_dynamic_plugin_base INTERFACE) add_library(zeek_dynamic_plugin_base INTERFACE)
target_include_directories( target_include_directories(
@ -337,21 +396,17 @@ endfunction ()
add_zeek_dynamic_plugin_build_interface_include_directories( add_zeek_dynamic_plugin_build_interface_include_directories(
${PROJECT_SOURCE_DIR}/src/include ${PROJECT_SOURCE_DIR}/src/include
${PROJECT_SOURCE_DIR}/auxil/binpac/lib ${PROJECT_SOURCE_DIR}/tools/binpac/lib
${PROJECT_SOURCE_DIR}/auxil/broker/libbroker ${PROJECT_SOURCE_DIR}/auxil/broker/libbroker
${PROJECT_SOURCE_DIR}/auxil/paraglob/include ${PROJECT_SOURCE_DIR}/auxil/paraglob/include
${PROJECT_SOURCE_DIR}/auxil/rapidjson/include
${PROJECT_SOURCE_DIR}/auxil/prometheus-cpp/core/include ${PROJECT_SOURCE_DIR}/auxil/prometheus-cpp/core/include
${PROJECT_SOURCE_DIR}/auxil/expected-lite/include
${CMAKE_BINARY_DIR}/src ${CMAKE_BINARY_DIR}/src
${CMAKE_BINARY_DIR}/src/include ${CMAKE_BINARY_DIR}/src/include
${CMAKE_BINARY_DIR}/auxil/binpac/lib ${CMAKE_BINARY_DIR}/tools/binpac/lib
${CMAKE_BINARY_DIR}/auxil/broker/libbroker ${CMAKE_BINARY_DIR}/auxil/broker/libbroker
${CMAKE_BINARY_DIR}/auxil/prometheus-cpp/core/include) ${CMAKE_BINARY_DIR}/auxil/prometheus-cpp/core/include)
# threading/formatters/JSON.h includes rapidjson headers and may be used
# by external plugins, extend the include path.
target_include_directories(zeek_dynamic_plugin_base SYSTEM
INTERFACE $<INSTALL_INTERFACE:include/zeek/3rdparty/rapidjson/include>)
target_include_directories( target_include_directories(
zeek_dynamic_plugin_base SYSTEM zeek_dynamic_plugin_base SYSTEM
INTERFACE $<INSTALL_INTERFACE:include/zeek/3rdparty/prometheus-cpp/include>) INTERFACE $<INSTALL_INTERFACE:include/zeek/3rdparty/prometheus-cpp/include>)
@ -377,7 +432,6 @@ function (zeek_add_subdir_library name)
target_compile_definitions(${target_name} PRIVATE ZEEK_CONFIG_SKIP_VERSION_H) target_compile_definitions(${target_name} PRIVATE ZEEK_CONFIG_SKIP_VERSION_H)
add_dependencies(${target_name} zeek_autogen_files) add_dependencies(${target_name} zeek_autogen_files)
target_link_libraries(${target_name} PRIVATE $<BUILD_INTERFACE:zeek_internal>) target_link_libraries(${target_name} PRIVATE $<BUILD_INTERFACE:zeek_internal>)
add_clang_tidy_files(${FN_ARGS_SOURCES})
target_compile_options(${target_name} PRIVATE ${WERROR_FLAG}) target_compile_options(${target_name} PRIVATE ${WERROR_FLAG})
# Take care of compiling BIFs. # Take care of compiling BIFs.
@ -401,6 +455,9 @@ function (zeek_add_subdir_library name)
# Feed into the main Zeek target(s). # Feed into the main Zeek target(s).
zeek_target_link_libraries(${target_name}) zeek_target_link_libraries(${target_name})
# Add IWYU and clang-tidy to the target if enabled.
zeek_target_add_linters(${target_name})
endfunction () endfunction ()
# ############################################################################## # ##############################################################################
@ -609,6 +666,7 @@ if (ENABLE_DEBUG)
set(VERSION_C_IDENT "${VERSION_C_IDENT}_debug") set(VERSION_C_IDENT "${VERSION_C_IDENT}_debug")
target_compile_definitions(zeek_internal INTERFACE DEBUG) target_compile_definitions(zeek_internal INTERFACE DEBUG)
target_compile_definitions(zeek_dynamic_plugin_base INTERFACE DEBUG) target_compile_definitions(zeek_dynamic_plugin_base INTERFACE DEBUG)
set(SPICYZ_FLAGS "-d" CACHE STRING "Additional flags to pass to spicyz for builtin analyzers")
endif () endif ()
if (NOT BINARY_PACKAGING_MODE) if (NOT BINARY_PACKAGING_MODE)
@ -777,16 +835,13 @@ if (NOT SED_EXE)
endif () endif ()
endif () endif ()
set(ZEEK_PYTHON_MIN 3.5.0) set(ZEEK_PYTHON_MIN 3.9.0)
set(Python_FIND_UNVERSIONED_NAMES FIRST) set(Python_FIND_UNVERSIONED_NAMES FIRST)
find_package(Python ${ZEEK_PYTHON_MIN} REQUIRED COMPONENTS Interpreter) find_package(Python ${ZEEK_PYTHON_MIN} REQUIRED COMPONENTS Interpreter)
find_package(FLEX REQUIRED) find_package(FLEX REQUIRED)
find_package(BISON 2.5 REQUIRED) find_package(BISON 2.5 REQUIRED)
find_package(PCAP REQUIRED) find_package(PCAP REQUIRED)
find_package(OpenSSL REQUIRED) find_package(OpenSSL REQUIRED)
if (NOT MSVC)
find_package(BIND REQUIRED)
endif ()
find_package(ZLIB REQUIRED) find_package(ZLIB REQUIRED)
if (NOT BINARY_PACKAGING_MODE) if (NOT BINARY_PACKAGING_MODE)
@ -828,46 +883,35 @@ endif ()
set(PY_MOD_INSTALL_DIR ${py_mod_install_dir} CACHE STRING "Installation path for Python modules" set(PY_MOD_INSTALL_DIR ${py_mod_install_dir} CACHE STRING "Installation path for Python modules"
FORCE) FORCE)
if (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/auxil/binpac/CMakeLists.txt) # BinPAC uses the same 'ENABLE_STATIC_ONLY' variable to define whether
# to build statically. Save a local copy so it can be set based on the
# configure flag before we add the subdirectory.
set(ENABLE_STATIC_ONLY_SAVED ${ENABLE_STATIC_ONLY})
set(ENABLE_STATIC_ONLY_SAVED ${ENABLE_STATIC_ONLY}) if (BUILD_STATIC_BINPAC)
if (MSVC)
set(BUILD_STATIC_BINPAC true)
endif ()
if (BUILD_STATIC_BINPAC)
set(ENABLE_STATIC_ONLY true) set(ENABLE_STATIC_ONLY true)
endif ()
add_subdirectory(auxil/binpac)
set(ENABLE_STATIC_ONLY ${ENABLE_STATIC_ONLY_SAVED})
# FIXME: avoid hard-coding a path for multi-config generator support. See the
# TODO in ZeekPluginConfig.cmake.in.
set(BINPAC_EXE_PATH "${CMAKE_BINARY_DIR}/auxil/binpac/src/binpac${CMAKE_EXECUTABLE_SUFFIX}")
endif () endif ()
find_package(BinPAC REQUIRED) add_subdirectory(tools/binpac)
set(ENABLE_STATIC_ONLY ${ENABLE_STATIC_ONLY_SAVED})
# Add an alias (used by our plugin setup). # FIXME: avoid hard-coding a path for multi-config generator support. See the
# TODO in ZeekPluginConfig.cmake.in.
set(BINPAC_EXE_PATH "${CMAKE_BINARY_DIR}/tools/binpac/src/binpac${CMAKE_EXECUTABLE_SUFFIX}")
set(_binpac_exe_path "included")
# Need to call find_package so it sets up the include paths used by plugin builds.
find_package(BinPAC REQUIRED)
add_executable(Zeek::BinPAC ALIAS binpac) add_executable(Zeek::BinPAC ALIAS binpac)
if (NOT BIFCL_EXE_PATH) add_subdirectory(tools/bifcl)
add_subdirectory(auxil/bifcl) add_executable(Zeek::BifCl ALIAS bifcl)
add_executable(Zeek::BifCl ALIAS bifcl) # FIXME: avoid hard-coding a path for multi-config generator support. See the
# FIXME: avoid hard-coding a path for multi-config generator support. See the # TODO in ZeekPluginConfig.cmake.in.
# TODO in ZeekPluginConfig.cmake.in. set(BIFCL_EXE_PATH "${CMAKE_BINARY_DIR}/tools/bifcl/bifcl${CMAKE_EXECUTABLE_SUFFIX}")
set(BIFCL_EXE_PATH "${CMAKE_BINARY_DIR}/auxil/bifcl/bifcl${CMAKE_EXECUTABLE_SUFFIX}") set(_bifcl_exe_path "included")
set(_bifcl_exe_path "included")
else ()
add_executable(Zeek::BifCl IMPORTED)
set_property(TARGET Zeek::BifCl PROPERTY IMPORTED_LOCATION "${BIFCL_EXE_PATH}")
set(_bifcl_exe_path "BIFCL_EXE_PATH")
endif ()
if (NOT GEN_ZAM_EXE_PATH) add_subdirectory(tools/gen-zam)
add_subdirectory(auxil/gen-zam)
endif ()
if (ENABLE_JEMALLOC) if (ENABLE_JEMALLOC)
if (${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD") if (${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD")
@ -972,6 +1016,7 @@ if (NOT DISABLE_SPICY)
set(Python3_EXECUTABLE ${Python_EXECUTABLE} CACHE STRING "Python3_EXECUTABLE hint") set(Python3_EXECUTABLE ${Python_EXECUTABLE} CACHE STRING "Python3_EXECUTABLE hint")
endif () endif ()
set(SPICY_ENABLE_TESTS OFF)
add_subdirectory(auxil/spicy) add_subdirectory(auxil/spicy)
include(ConfigureSpicyBuild) # set some options different for building Spicy include(ConfigureSpicyBuild) # set some options different for building Spicy
@ -1010,27 +1055,24 @@ include(BuiltInSpicyAnalyzer)
include_directories(BEFORE ${PCAP_INCLUDE_DIR} ${BIND_INCLUDE_DIR} ${BinPAC_INCLUDE_DIR} include_directories(BEFORE ${PCAP_INCLUDE_DIR} ${BIND_INCLUDE_DIR} ${BinPAC_INCLUDE_DIR}
${ZLIB_INCLUDE_DIR} ${JEMALLOC_INCLUDE_DIR}) ${ZLIB_INCLUDE_DIR} ${JEMALLOC_INCLUDE_DIR})
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/auxil/rapidjson/include/rapidjson
DESTINATION include/zeek/3rdparty/rapidjson/include)
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/auxil/filesystem/include/ghc
DESTINATION include/zeek/3rdparty/)
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/auxil/prometheus-cpp/core/include/prometheus install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/auxil/prometheus-cpp/core/include/prometheus
DESTINATION include/zeek/3rdparty/prometheus-cpp/include) DESTINATION include/zeek/3rdparty/prometheus-cpp/include)
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/auxil/prometheus-cpp/core/include/prometheus install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/auxil/prometheus-cpp/core/include/prometheus
DESTINATION include/zeek/3rdparty/prometheus-cpp/include) DESTINATION include/zeek/3rdparty/prometheus-cpp/include)
# Create 3rdparty/ghc within the build directory so that the include for install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/auxil/expected-lite/include/nonstd
# "zeek/3rdparty/ghc/filesystem.hpp" works within the build tree. DESTINATION include/zeek/3rdparty/)
execute_process(COMMAND "${CMAKE_COMMAND}" -E make_directory execute_process(COMMAND "${CMAKE_COMMAND}" -E make_directory
"${CMAKE_CURRENT_BINARY_DIR}/3rdparty/") "${CMAKE_CURRENT_BINARY_DIR}/3rdparty/")
# Do the same for nonstd.
execute_process( execute_process(
COMMAND COMMAND
"${CMAKE_COMMAND}" -E create_symlink "${CMAKE_COMMAND}" -E create_symlink
"${CMAKE_CURRENT_SOURCE_DIR}/auxil/filesystem/include/ghc" "${CMAKE_CURRENT_SOURCE_DIR}/auxil/expected-lite/include/nonstd"
"${CMAKE_CURRENT_BINARY_DIR}/3rdparty/ghc") "${CMAKE_CURRENT_BINARY_DIR}/3rdparty/nonstd")
# Optional Dependencies # Optional Dependencies
@ -1038,18 +1080,16 @@ set(USE_GEOIP false)
find_package(LibMMDB) find_package(LibMMDB)
if (LIBMMDB_FOUND) if (LIBMMDB_FOUND)
set(USE_GEOIP true) set(USE_GEOIP true)
include_directories(BEFORE ${LibMMDB_INCLUDE_DIR}) include_directories(BEFORE SYSTEM ${LibMMDB_INCLUDE_DIR})
list(APPEND OPTLIBS ${LibMMDB_LIBRARY}) list(APPEND OPTLIBS ${LibMMDB_LIBRARY})
endif () endif ()
set(USE_KRB5 false) set(USE_KRB5 false)
if (${CMAKE_SYSTEM_NAME} MATCHES Linux) find_package(LibKrb5)
find_package(LibKrb5) if (LIBKRB5_FOUND)
if (LIBKRB5_FOUND)
set(USE_KRB5 true) set(USE_KRB5 true)
include_directories(BEFORE ${LibKrb5_INCLUDE_DIR}) include_directories(BEFORE SYSTEM ${LibKrb5_INCLUDE_DIR})
list(APPEND OPTLIBS ${LibKrb5_LIBRARY}) list(APPEND OPTLIBS ${LibKrb5_LIBRARY})
endif ()
endif () endif ()
set(HAVE_PERFTOOLS false) set(HAVE_PERFTOOLS false)
@ -1081,7 +1121,7 @@ endif ()
# dependencies which tend to be in standard system locations and thus cause the # dependencies which tend to be in standard system locations and thus cause the
# system OpenSSL headers to still be picked up even if one specifies # system OpenSSL headers to still be picked up even if one specifies
# --with-openssl (which may be common). # --with-openssl (which may be common).
include_directories(BEFORE ${OPENSSL_INCLUDE_DIR}) include_directories(BEFORE SYSTEM ${OPENSSL_INCLUDE_DIR})
# Determine if libfts is external to libc, i.e. musl # Determine if libfts is external to libc, i.e. musl
find_package(FTS) find_package(FTS)
@ -1135,6 +1175,7 @@ include(FindKqueue)
include(FindPrometheusCpp) include(FindPrometheusCpp)
include_directories(BEFORE "auxil/out_ptr/include") include_directories(BEFORE "auxil/out_ptr/include")
include_directories(BEFORE "auxil/expected-lite/include")
if ((OPENSSL_VERSION VERSION_EQUAL "1.1.0") OR (OPENSSL_VERSION VERSION_GREATER "1.1.0")) if ((OPENSSL_VERSION VERSION_EQUAL "1.1.0") OR (OPENSSL_VERSION VERSION_GREATER "1.1.0"))
set(ZEEK_HAVE_OPENSSL_1_1 true CACHE INTERNAL "" FORCE) set(ZEEK_HAVE_OPENSSL_1_1 true CACHE INTERNAL "" FORCE)
@ -1146,18 +1187,6 @@ endif ()
# Tell the plugin code that we're building as part of the main tree. # Tell the plugin code that we're building as part of the main tree.
set(ZEEK_PLUGIN_INTERNAL_BUILD true CACHE INTERNAL "" FORCE) set(ZEEK_PLUGIN_INTERNAL_BUILD true CACHE INTERNAL "" FORCE)
set(ZEEK_HAVE_AF_PACKET no)
if (${CMAKE_SYSTEM_NAME} MATCHES Linux)
if (NOT DISABLE_AF_PACKET)
if (NOT AF_PACKET_PLUGIN_PATH)
set(AF_PACKET_PLUGIN_PATH ${CMAKE_SOURCE_DIR}/auxil/zeek-af_packet-plugin)
endif ()
list(APPEND ZEEK_INCLUDE_PLUGINS ${AF_PACKET_PLUGIN_PATH})
set(ZEEK_HAVE_AF_PACKET yes)
endif ()
endif ()
set(ZEEK_HAVE_JAVASCRIPT no) set(ZEEK_HAVE_JAVASCRIPT no)
if (NOT DISABLE_JAVASCRIPT) if (NOT DISABLE_JAVASCRIPT)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR}/auxil/zeekjs/cmake) set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR}/auxil/zeekjs/cmake)
@ -1177,6 +1206,7 @@ if (NOT DISABLE_JAVASCRIPT)
endif () endif ()
endif () endif ()
set(ZEEK_HAVE_AF_PACKET no CACHE INTERNAL "Zeek has AF_PACKET support")
set(ZEEK_HAVE_JAVASCRIPT ${ZEEK_HAVE_JAVASCRIPT} CACHE INTERNAL "Zeek has JavaScript support") set(ZEEK_HAVE_JAVASCRIPT ${ZEEK_HAVE_JAVASCRIPT} CACHE INTERNAL "Zeek has JavaScript support")
set(DEFAULT_ZEEKPATH_PATHS set(DEFAULT_ZEEKPATH_PATHS
@ -1195,11 +1225,7 @@ endif ()
include_directories(BEFORE ${CMAKE_CURRENT_BINARY_DIR}) include_directories(BEFORE ${CMAKE_CURRENT_BINARY_DIR})
execute_process(COMMAND "${CMAKE_COMMAND}" -E create_symlink "." "${CMAKE_CURRENT_BINARY_DIR}/zeek") execute_process(COMMAND "${CMAKE_COMMAND}" -E create_symlink "." "${CMAKE_CURRENT_BINARY_DIR}/zeek")
if (BinPAC_ROOT_DIR) set(ZEEK_CONFIG_BINPAC_ROOT_DIR ${BinPAC_ROOT_DIR})
set(ZEEK_CONFIG_BINPAC_ROOT_DIR ${BinPAC_ROOT_DIR})
else ()
set(ZEEK_CONFIG_BINPAC_ROOT_DIR ${ZEEK_ROOT_DIR})
endif ()
if (BROKER_ROOT_DIR) if (BROKER_ROOT_DIR)
set(ZEEK_CONFIG_BROKER_ROOT_DIR ${BROKER_ROOT_DIR}) set(ZEEK_CONFIG_BROKER_ROOT_DIR ${BROKER_ROOT_DIR})
@ -1417,11 +1443,6 @@ else ()
set(_install_btest_tools_msg "no pcaps") set(_install_btest_tools_msg "no pcaps")
endif () endif ()
set(_binpac_exe_path "included")
if (BINPAC_EXE_PATH)
set(_binpac_exe_path ${BINPAC_EXE_PATH})
endif ()
set(_gen_zam_exe_path "included") set(_gen_zam_exe_path "included")
if (GEN_ZAM_EXE_PATH) if (GEN_ZAM_EXE_PATH)
set(_gen_zam_exe_path ${GEN_ZAM_EXE_PATH}) set(_gen_zam_exe_path ${GEN_ZAM_EXE_PATH})
@ -1451,57 +1472,118 @@ if (ZEEK_LEGACY_ANALYZERS OR ZEEK_SKIPPED_ANALYZERS)
) )
endif () endif ()
message( set(_zeek_builtin_plugins "${ZEEK_BUILTIN_PLUGINS}")
"\n====================| Zeek Build Summary |====================" if (NOT ZEEK_BUILTIN_PLUGINS)
"\n" set(_zeek_builtin_plugins "none")
"\nBuild type: ${CMAKE_BUILD_TYPE}" endif ()
"\nBuild dir: ${PROJECT_BINARY_DIR}"
"\n" set(_zeek_fuzzing_engine "${ZEEK_FUZZING_ENGINE}")
"\nInstall prefix: ${CMAKE_INSTALL_PREFIX}" if (NOT ZEEK_FUZZING_ENGINE)
"\nConfig file dir: ${ZEEK_ETC_INSTALL_DIR}" if (ZEEK_ENABLE_FUZZERS)
"\nLog dir: ${ZEEK_LOG_DIR}" # The default fuzzer used by gcc and clang is libFuzzer. This is if you
"\nPlugin dir: ${ZEEK_PLUGIN_DIR}" # simply pass '-fsanitize=fuzzer' to the compiler.
"\nPython module dir: ${PY_MOD_INSTALL_DIR}" set(_zeek_fuzzing_engine "libFuzzer")
"\nScript dir: ${ZEEK_SCRIPT_INSTALL_PATH}" endif ()
"\nSpool dir: ${ZEEK_SPOOL_DIR}" endif ()
"\nState dir: ${ZEEK_STATE_DIR}"
"\nSpicy modules dir: ${ZEEK_SPICY_MODULE_PATH}" ## Utility method for outputting status information for features that just have a
"\n" ## string representation. This can also take an optional second argument that is a
"\nDebug mode: ${ENABLE_DEBUG}" ## value string to print.
"\nUnit tests: ${ENABLE_ZEEK_UNIT_TESTS}" function (output_summary_line what)
"\nBuiltin Plugins: ${ZEEK_BUILTIN_PLUGINS}" if ("${ARGV1}" MATCHES "^$")
"\n" message("${what}:")
"\nCC: ${CMAKE_C_COMPILER}" return()
"\nCFLAGS: ${CMAKE_C_FLAGS} ${CMAKE_C_FLAGS_${BuildType}}" endif ()
"\nCXX: ${CMAKE_CXX_COMPILER}"
"\nCXXFLAGS: ${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_${BuildType}}" set(_spaces " ")
"\nCPP: ${CMAKE_CXX_COMPILER}" string(LENGTH ${what} _what_length)
"\n" math(EXPR _num_spaces "25 - ${_what_length}")
"\nAF_PACKET: ${ZEEK_HAVE_AF_PACKET}" string(SUBSTRING ${_spaces} 0 ${_num_spaces} _spacing)
"\nAux. Tools: ${INSTALL_AUX_TOOLS}" message("${what}:${_spacing}${ARGV1}")
"\nBifCL: ${_bifcl_exe_path}" endfunction ()
"\nBinPAC: ${_binpac_exe_path}"
"\nBTest: ${INSTALL_BTEST}" ## Utility method for outputting status information for features that have an ON/OFF
"\nBTest tooling: ${_install_btest_tools_msg}" ## state.
"\nGen-ZAM: ${_gen_zam_exe_path}" function (output_summary_bool what state)
"\nJavaScript: ${ZEEK_HAVE_JAVASCRIPT}" if (${state})
"\nSpicy: ${_spicy}" output_summary_line("${what}" "ON")
"\nSpicy analyzers: ${USE_SPICY_ANALYZERS}" else ()
"\nzeek-client: ${INSTALL_ZEEK_CLIENT}" output_summary_line("${what}" "OFF")
"\nZeekControl: ${INSTALL_ZEEKCTL}" endif ()
"\nzkg: ${INSTALL_ZKG}" endfunction ()
"\n"
"\nlibmaxminddb: ${USE_GEOIP}" message("\n====================| Zeek Build Summary |====================\n")
"\nKerberos: ${USE_KRB5}"
"\ngperftools found: ${HAVE_PERFTOOLS}" output_summary_line("Build type" "${CMAKE_BUILD_TYPE}")
"\n - tcmalloc: ${USE_PERFTOOLS_TCMALLOC}" output_summary_line("Build dir" "${PROJECT_BINARY_DIR}")
"\n - debugging: ${USE_PERFTOOLS_DEBUG}" message("")
"\njemalloc: ${ENABLE_JEMALLOC}"
"\n" output_summary_line("Install prefix" "${CMAKE_INSTALL_PREFIX}")
"\nFuzz Targets: ${ZEEK_ENABLE_FUZZERS}" output_summary_line("Config file dir" "${ZEEK_ETC_INSTALL_DIR}")
"\nFuzz Engine: ${ZEEK_FUZZING_ENGINE}" output_summary_line("Log dir" "${ZEEK_LOG_DIR}")
"${_analyzer_warning}" output_summary_line("Plugin dir" "${ZEEK_PLUGIN_DIR}")
"\n" output_summary_line("Python module dir" "${PY_MOD_INSTALL_DIR}")
"\n================================================================\n") output_summary_line("Script dir" "${ZEEK_SCRIPT_INSTALL_PATH}")
output_summary_line("Spool dir" "${ZEEK_SPOOL_DIR}")
output_summary_line("State dir" "${ZEEK_STATE_DIR}")
output_summary_line("Spicy modules dir" "${ZEEK_SPICY_MODULE_PATH}")
message("")
output_summary_bool("Debug mode" ${ENABLE_DEBUG})
output_summary_bool("Unit tests" ${ENABLE_ZEEK_UNIT_TESTS})
message("")
output_summary_line("Builtin Plugins" "${_zeek_builtin_plugins}")
message("")
output_summary_line("CC" "${CMAKE_C_COMPILER}")
output_summary_line("CFLAGS" "${CMAKE_C_FLAGS} ${CMAKE_C_FLAGS_${BuildType}}")
output_summary_line("CXX" "${CMAKE_CXX_COMPILER}")
output_summary_line("CXXFLAGS" "${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_${BuildType}}")
output_summary_line("CPP" "${CMAKE_CXX_COMPILER}")
message("")
output_summary_bool("AF_PACKET" ${ZEEK_HAVE_AF_PACKET})
output_summary_bool("Aux. Tools" ${INSTALL_AUX_TOOLS})
output_summary_bool("BTest" ${INSTALL_BTEST})
output_summary_line("BTest tooling" ${_install_btest_tools_msg})
output_summary_bool("JavaScript" ${ZEEK_HAVE_JAVASCRIPT})
output_summary_line("Spicy" ${_spicy})
output_summary_bool("Spicy analyzers" ${USE_SPICY_ANALYZERS})
output_summary_bool("zeek-client" ${INSTALL_ZEEK_CLIENT})
output_summary_bool("ZeekControl" ${INSTALL_ZEEKCTL})
output_summary_bool("zkg" ${INSTALL_ZKG})
message("")
output_summary_bool("libmaxminddb" ${USE_GEOIP})
output_summary_bool("Kerberos" ${USE_KRB5})
output_summary_bool("gperftools" ${HAVE_PERFTOOLS})
output_summary_bool(" - tcmalloc" ${USE_PERFTOOLS_TCMALLOC})
output_summary_bool(" - debugging" ${USE_PERFTOOLS_DEBUG})
output_summary_bool("jemalloc" ${ENABLE_JEMALLOC})
message("")
output_summary_line("Cluster backends")
output_summary_bool(" - Broker" ON)
output_summary_bool(" - ZeroMQ" ${ENABLE_CLUSTER_BACKEND_ZEROMQ})
message("")
output_summary_line("Storage backends")
output_summary_bool(" - SQLite" ON)
output_summary_bool(" - Redis" ${ENABLE_STORAGE_BACKEND_REDIS})
message("")
output_summary_bool("Fuzz Targets" ${ZEEK_ENABLE_FUZZERS})
output_summary_line("Fuzz Engine" "${_zeek_fuzzing_engine}")
message("")
output_summary_line("External Tools/Linters")
output_summary_bool(" - Include What You Use" ${ENABLE_IWYU})
output_summary_bool(" - Clang-Tidy" ${ENABLE_CLANG_TIDY})
if (${_analyzer_warning})
message("${_analyzer_warning}\n")
endif ()
message("\n================================================================")
include(UserChangedWarning) include(UserChangedWarning)

1
CODE_OF_CONDUCT.md Normal file
View file

@ -0,0 +1 @@
Our code of conduct is published at https://zeek.org/community-code-of-conduct/

3
CONTRIBUTING.md Normal file
View file

@ -0,0 +1,3 @@
Our contribution guide is available at https://github.com/zeek/zeek/wiki/Contribution-Guide.
More information about contributing is also available at https://docs.zeek.org/en/master/devel/contributors.html.

View file

@ -1,4 +1,4 @@
Copyright (c) 1995-2023, The Regents of the University of California Copyright (c) 1995-now, The Regents of the University of California
through the Lawrence Berkeley National Laboratory and the through the Lawrence Berkeley National Laboratory and the
International Computer Science Institute. All rights reserved. International Computer Science Institute. All rights reserved.

View file

@ -533,32 +533,6 @@ POSSIBILITY OF SUCH DAMAGE.
============================================================================== ==============================================================================
%%% auxil/filesystem
==============================================================================
Copyright (c) 2018, Steffen Schümann <s.schuemann@pobox.com>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
==============================================================================
%%% auxil/highwayhash %%% auxil/highwayhash
============================================================================== ==============================================================================
@ -782,3 +756,433 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE. SOFTWARE.
==============================================================================
%%% auxil/c-ares
==============================================================================
MIT License
Copyright (c) 1998 Massachusetts Institute of Technology
Copyright (c) 2007 - 2023 Daniel Stenberg with many contributors, see AUTHORS
file.
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice (including the next
paragraph) shall be included in all copies or substantial portions of the
Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
==============================================================================
%%% auxil/expected-lite
==============================================================================
Boost Software License - Version 1.0 - August 17th, 2003
Permission is hereby granted, free of charge, to any person or organization
obtaining a copy of the software and accompanying documentation covered by
this license (the "Software") to use, reproduce, display, distribute,
execute, and transmit the Software, and to prepare derivative works of the
Software, and to permit third-parties to whom the Software is furnished to
do so, all subject to the following:
The copyright notices in the Software and this entire statement, including
the above license grant, this restriction and the following disclaimer,
must be included in all copies of the Software, in whole or in part, and
all derivative works of the Software, unless such copies or derivative
works are solely in the form of machine-executable object code generated by
a source language processor.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
==============================================================================
%%% auxil/out_ptr
==============================================================================
Copyright ⓒ 2018-2021 ThePhD.
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
==============================================================================
%%% auxil/prometheus-cpp
==============================================================================
MIT License
Copyright (c) 2016-2021 Jupp Mueller
Copyright (c) 2017-2022 Gregor Jasny
And many contributors, see
https://github.com/jupp0r/prometheus-cpp/graphs/contributors
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
==============================================================================
%%% auxil/rapidjson
==============================================================================
Tencent is pleased to support the open source community by making RapidJSON available.
Copyright (C) 2015 THL A29 Limited, a Tencent company, and Milo Yip. All rights reserved.
If you have downloaded a copy of the RapidJSON binary from Tencent, please note that the RapidJSON binary is licensed under the MIT License.
If you have downloaded a copy of the RapidJSON source code from Tencent, please note that RapidJSON source code is licensed under the MIT License, except for the third-party components listed below which are subject to different license terms. Your integration of RapidJSON into your own projects may require compliance with the MIT License, as well as the other licenses applicable to the third-party components included within RapidJSON. To avoid the problematic JSON license in your own projects, it's sufficient to exclude the bin/jsonchecker/ directory, as it's the only code under the JSON license.
A copy of the MIT License is included in this file.
Other dependencies and licenses:
Open Source Software Licensed Under the BSD License:
--------------------------------------------------------------------
The msinttypes r29
Copyright (c) 2006-2013 Alexander Chemeris
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
* Neither the name of copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Open Source Software Licensed Under the JSON License:
--------------------------------------------------------------------
json.org
Copyright (c) 2002 JSON.org
All Rights Reserved.
JSON_checker
Copyright (c) 2002 JSON.org
All Rights Reserved.
Terms of the JSON License:
---------------------------------------------------
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
The Software shall be used for Good, not Evil.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Terms of the MIT License:
--------------------------------------------------------------------
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
==============================================================================
%%% auxil/vcpkg
==============================================================================
MIT License
Copyright (c) Microsoft Corporation
Permission is hereby granted, free of charge, to any person obtaining a copy of this
software and associated documentation files (the "Software"), to deal in the Software
without restriction, including without limitation the rights to use, copy, modify,
merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice shall be included in all copies
or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
==============================================================================
%%% src/cluster/websocket/auxil/IXWebSocket
==============================================================================
Copyright (c) 2018 Machine Zone, Inc. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the
distribution.
3. Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
==============================================================================
%%% src/cluster/backend/zeromq/auxil/cppzmq
==============================================================================
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
IN THE SOFTWARE.

View file

@ -9,7 +9,7 @@ BUILD=build
REPO=$$(cd $(CURDIR) && basename $$(git config --get remote.origin.url | sed 's/^[^:]*://g')) REPO=$$(cd $(CURDIR) && basename $$(git config --get remote.origin.url | sed 's/^[^:]*://g'))
VERSION_FULL=$(REPO)-$$(cd $(CURDIR) && cat VERSION) VERSION_FULL=$(REPO)-$$(cd $(CURDIR) && cat VERSION)
GITDIR=$$(test -f .git && echo $$(cut -d" " -f2 .git) || echo .git) GITDIR=$$(test -f .git && echo $$(cut -d" " -f2 .git) || echo .git)
REALPATH=$$($$(realpath --relative-to=$(pwd) . >/dev/null 2>&1) && echo 'realpath' || echo 'grealpath') REALPATH=$$($$(realpath --relative-to=$(shell pwd) . >/dev/null 2>&1) && echo 'realpath' || echo 'grealpath')
all: configured all: configured
$(MAKE) -C $(BUILD) $@ $(MAKE) -C $(BUILD) $@

1060
NEWS

File diff suppressed because it is too large Load diff

2
README
View file

@ -3,7 +3,7 @@ The Zeek Network Security Monitor
================================= =================================
Zeek is a powerful framework for network traffic analysis and security Zeek is a powerful framework for network traffic analysis and security
monitoring. Follow us on Twitter at @zeekurity. monitoring.
Key Features Key Features
============ ============

View file

@ -15,14 +15,15 @@ traffic analysis and security monitoring.
[_Development_](#development) — [_Development_](#development) —
[_License_](#license) [_License_](#license)
Follow us on Twitter at [@zeekurity](https://twitter.com/zeekurity).
[![Coverage Status](https://coveralls.io/repos/github/zeek/zeek/badge.svg?branch=master)](https://coveralls.io/github/zeek/zeek?branch=master) [![Coverage Status](https://coveralls.io/repos/github/zeek/zeek/badge.svg?branch=master)](https://coveralls.io/github/zeek/zeek?branch=master)
[![Build Status](https://img.shields.io/cirrus/github/zeek/zeek)](https://cirrus-ci.com/github/zeek/zeek) [![Build Status](https://img.shields.io/cirrus/github/zeek/zeek)](https://cirrus-ci.com/github/zeek/zeek)
[![Slack](https://img.shields.io/badge/slack-@zeek-brightgreen.svg?logo=slack)](https://zeek.org/slack) [![Slack](https://img.shields.io/badge/slack-@zeek-brightgreen.svg?logo=slack)](https://zeek.org/slack)
[![Discourse](https://img.shields.io/discourse/status?server=https%3A%2F%2Fcommunity.zeek.org)](https://community.zeek.org) [![Discourse](https://img.shields.io/discourse/status?server=https%3A%2F%2Fcommunity.zeek.org)](https://community.zeek.org)
[![Mastodon](https://img.shields.io/badge/mastodon-@zeek@infosec.exchange-brightgreen.svg?logo=mastodon)](https://infosec.exchange/@zeek)
[![Bluesky](https://img.shields.io/badge/bluesky-@zeek-brightgreen.svg?logo=bluesky)](https://bsky.app/profile/zeek.org)
</h4> </h4>
@ -51,7 +52,7 @@ Getting Started
The best place to find information about getting started with Zeek is The best place to find information about getting started with Zeek is
our web site [www.zeek.org](https://www.zeek.org), specifically the our web site [www.zeek.org](https://www.zeek.org), specifically the
[documentation](https://www.zeek.org/documentation/index.html) section [documentation](https://docs.zeek.org/en/stable/index.html) section
there. On the web site you can also find downloads for stable there. On the web site you can also find downloads for stable
releases, tutorials on getting Zeek set up, and many other useful releases, tutorials on getting Zeek set up, and many other useful
resources. resources.
@ -104,9 +105,9 @@ you might find
[these](https://github.com/zeek/zeek/labels/good%20first%20issue) [these](https://github.com/zeek/zeek/labels/good%20first%20issue)
to be a good place to get started. More information on Zeek's to be a good place to get started. More information on Zeek's
development can be found development can be found
[here](https://www.zeek.org/development/index.html), and information [here](https://docs.zeek.org/en/current/devel/index.html), and information
about its community and mailing lists (which are fairly active) can be about its community and mailing lists (which are fairly active) can be
found [here](https://www.zeek.org/community/index.html). found [here](https://www.zeek.org/community/).
License License
------- -------

5
SECURITY.md Normal file
View file

@ -0,0 +1,5 @@
# Security Policy
Zeek's Security Policy is defined on our website at https://zeek.org/security-reporting/
Our Security Release Process is further clarified at https://github.com/zeek/zeek/wiki/Security-Release-Process

View file

@ -1 +1 @@
7.0.0-dev.467 8.1.0-dev.626

@ -1 +0,0 @@
Subproject commit 7c5ccc9aa91466004bc4a0dbbce11a239f3e742e

@ -1 +0,0 @@
Subproject commit a5c8f19fb49c60171622536fa6d369fa168f19e0

@ -1 +1 @@
Subproject commit fada26ae504981f7f5524bf2a5c82ae49acd556d Subproject commit 06d491943f4bee6c2d1e17a5c7c31836d725273d

@ -1 +1 @@
Subproject commit 989c7513c3b6056a429a5d48dacdc9a2c1b216a7 Subproject commit 8c0fbfd74325b6c9be022a98bcd414b6f103d09e

@ -1 +1 @@
Subproject commit 0ad09d251bf01cc2b7860950527e33e22cd64256 Subproject commit d3a507e920e7af18a5efb7f9f1d8044ed4750013

1
auxil/expected-lite Submodule

@ -0,0 +1 @@
Subproject commit f339d2f73730f8fee4412f5e4938717866ecef48

@ -1 +0,0 @@
Subproject commit 72a76d774e4c7c605141fd6d11c33cc211209ed9

@ -1 +0,0 @@
Subproject commit 610cf8527dad7033b971595a1d556c2c95294f2b

@ -1 +1 @@
Subproject commit 10d93cff9fd6c8d8c3e0bae58312aed470843ff8 Subproject commit ea30540c77679ced3ce7886199384e8743628921

@ -1 +1 @@
Subproject commit b38e9c8ebff08959a712a5663ba25e0624a3af00 Subproject commit 7e3670aa1f6ab7623a87ff1e770f7f6b5a1c59f1

@ -1 +1 @@
Subproject commit bdc15fab95b1ca2bd370fa25d91f7879b5da35fc Subproject commit ad301651ad0a7426757f8bc94cfc8e8cd98451a8

@ -1 +1 @@
Subproject commit 45ce017874aac9ffabac0ddc4d016f1747804234 Subproject commit 4505c4323283b56ea59935210e105da26ab7bb0b

@ -1 +1 @@
Subproject commit 2fec7205d1a9cb4829b86c943d599696d53de85c Subproject commit ad99e21f4706193670c42b36c9824dc997f4c475

@ -1 +1 @@
Subproject commit 6581b1855a5ea8cc102c66b4ac6a431fc67484a0 Subproject commit 7635e113080be6fc20cb308636c8c38565c95c8a

@ -1 +1 @@
Subproject commit 66b4b34d99ab272fcf21f2bd12b616e371c6bb31 Subproject commit ce613c41372b23b1f51333815feb3edd87ef8a8b

@ -1 +0,0 @@
Subproject commit a3fe59b3f1ded5c3461995134b66c6db182fa56f

@ -1 +1 @@
Subproject commit 8a66cd60fb29a1237b5070854cb194f43a3f7a30 Subproject commit 9a51ce1940a808aaad253077905c2b34f15f1e08

@ -1 +1 @@
Subproject commit 5bcc14085178ed4ddfa9ad972b441c36e8bc0787 Subproject commit 16849ca3ec2f8637e3f8ef8ee27e2c279724387f

@ -1 +1 @@
Subproject commit 39c0ee1e1742bb28dff57632ee4620f905b892e7 Subproject commit 485abcad45daeea6d09680e5fc7d29e97d2e3fbe

@ -1 +1 @@
Subproject commit 230f53c1596ee88289e96397f0810ca60ed897e3 Subproject commit e5985abfffc1ef5ead3a0bab196fa5d86bc5276f

View file

@ -2,7 +2,7 @@ FROM alpine:latest
# A version field to invalidate Cirrus's build cache when needed, as suggested in # A version field to invalidate Cirrus's build cache when needed, as suggested in
# https://github.com/cirruslabs/cirrus-ci-docs/issues/544#issuecomment-566066822 # https://github.com/cirruslabs/cirrus-ci-docs/issues/544#issuecomment-566066822
ENV DOCKERFILE_VERSION 20230823 ENV DOCKERFILE_VERSION=20250905
RUN apk add --no-cache \ RUN apk add --no-cache \
bash \ bash \
@ -10,8 +10,10 @@ RUN apk add --no-cache \
bsd-compat-headers \ bsd-compat-headers \
ccache \ ccache \
cmake \ cmake \
cppzmq \
curl \ curl \
diffutils \ diffutils \
dnsmasq \
flex-dev \ flex-dev \
musl-fts-dev \ musl-fts-dev \
g++ \ g++ \
@ -21,13 +23,13 @@ RUN apk add --no-cache \
linux-headers \ linux-headers \
make \ make \
openssh-client \ openssh-client \
openssl \
openssl-dev \ openssl-dev \
procps \ procps \
py3-pip \ py3-pip \
py3-websockets \
python3 \ python3 \
python3-dev \ python3-dev \
swig \ swig \
zlib-dev zlib-dev
RUN pip3 install --break-system-packages junit2html RUN pip3 install --break-system-packages websockets junit2html

View file

@ -0,0 +1,49 @@
FROM quay.io/centos/centos:stream10
# A version field to invalidate Cirrus's build cache when needed, as suggested in
# https://github.com/cirruslabs/cirrus-ci-docs/issues/544#issuecomment-566066822
ENV DOCKERFILE_VERSION=20250905
# dnf config-manager isn't available at first, and
# we need it to install the CRB repo below.
RUN dnf -y install 'dnf-command(config-manager)'
# What used to be powertools is now called "CRB".
# We need it for some of the packages installed below.
# https://docs.fedoraproject.org/en-US/epel/
RUN dnf config-manager --set-enabled crb
RUN dnf -y install \
https://dl.fedoraproject.org/pub/epel/epel-release-latest-10.noarch.rpm
# The --nobest flag is hopefully temporary. Without it we currently hit
# package versioning conflicts around OpenSSL.
RUN dnf -y --nobest install \
bison \
ccache \
cmake \
cppzmq-devel \
diffutils \
flex \
gcc \
gcc-c++ \
git \
jq \
libpcap-devel \
make \
openssl \
openssl-devel \
procps-ng \
python3 \
python3-devel \
python3-pip\
sqlite \
swig \
tar \
which \
zlib-devel \
&& dnf clean all && rm -rf /var/cache/dnf
# Set the crypto policy to allow SHA-1 certificates - which we have in our tests
RUN dnf -y --nobest install crypto-policies-scripts && update-crypto-policies --set LEGACY
RUN pip3 install websockets junit2html

View file

@ -2,7 +2,7 @@ FROM quay.io/centos/centos:stream9
# A version field to invalidate Cirrus's build cache when needed, as suggested in # A version field to invalidate Cirrus's build cache when needed, as suggested in
# https://github.com/cirruslabs/cirrus-ci-docs/issues/544#issuecomment-566066822 # https://github.com/cirruslabs/cirrus-ci-docs/issues/544#issuecomment-566066822
ENV DOCKERFILE_VERSION 20230801 ENV DOCKERFILE_VERSION=20250905
# dnf config-manager isn't available at first, and # dnf config-manager isn't available at first, and
# we need it to install the CRB repo below. # we need it to install the CRB repo below.
@ -22,6 +22,7 @@ RUN dnf -y --nobest install \
bison \ bison \
ccache \ ccache \
cmake \ cmake \
cppzmq-devel \
diffutils \ diffutils \
flex \ flex \
gcc \ gcc \
@ -33,9 +34,9 @@ RUN dnf -y --nobest install \
openssl \ openssl \
openssl-devel \ openssl-devel \
procps-ng \ procps-ng \
python3 \ python3.13 \
python3-devel \ python3.13-devel \
python3-pip\ python3.13-pip\
sqlite \ sqlite \
swig \ swig \
tar \ tar \
@ -46,4 +47,8 @@ RUN dnf -y --nobest install \
# Set the crypto policy to allow SHA-1 certificates - which we have in our tests # Set the crypto policy to allow SHA-1 certificates - which we have in our tests
RUN dnf -y --nobest install crypto-policies-scripts && update-crypto-policies --set LEGACY RUN dnf -y --nobest install crypto-policies-scripts && update-crypto-policies --set LEGACY
# Override the default python3.9 installation paths with 3.13
RUN alternatives --install /usr/bin/python3 python3 /usr/bin/python3.13 10
RUN alternatives --install /usr/bin/pip3 pip3 /usr/bin/pip3.13 10
RUN pip3 install websockets junit2html RUN pip3 install websockets junit2html

View file

@ -12,8 +12,8 @@ import argparse
import copy import copy
import json import json
import logging import logging
import pathlib
import os import os
import pathlib
import subprocess import subprocess
import sys import sys
@ -38,14 +38,22 @@ def git_available():
def git_is_repo(d: pathlib.Path): def git_is_repo(d: pathlib.Path):
try: try:
git("-C", str(d), "rev-parse", "--is-inside-work-tree", stderr=subprocess.DEVNULL) git(
"-C",
str(d),
"rev-parse",
"--is-inside-work-tree",
stderr=subprocess.DEVNULL,
)
return True return True
except subprocess.CalledProcessError: except subprocess.CalledProcessError:
return False return False
def git_is_dirty(d: pathlib.Path): def git_is_dirty(d: pathlib.Path):
return (len(git("-C", str(d), "status", "--untracked=no", "--short").splitlines()) > 0) return (
len(git("-C", str(d), "status", "--untracked=no", "--short").splitlines()) > 0
)
def git_generic_info(d: pathlib.Path): def git_generic_info(d: pathlib.Path):
@ -111,7 +119,9 @@ def collect_git_info(zeek_dir: pathlib.Path):
info["name"] = "zeek" info["name"] = "zeek"
info["version"] = (zeek_dir / "VERSION").read_text().strip() info["version"] = (zeek_dir / "VERSION").read_text().strip()
info["submodules"] = collect_submodule_info(zeek_dir) info["submodules"] = collect_submodule_info(zeek_dir)
info["branch"] = git("-C", str(zeek_dir), "rev-parse", "--abbrev-ref", "HEAD").strip() info["branch"] = git(
"-C", str(zeek_dir), "rev-parse", "--abbrev-ref", "HEAD"
).strip()
info["source"] = "git" info["source"] = "git"
return info return info
@ -156,14 +166,13 @@ def main():
for p in [p.strip() for p in v.split(";") if p.strip()]: for p in [p.strip() for p in v.split(";") if p.strip()]:
yield pathlib.Path(p) yield pathlib.Path(p)
parser.add_argument("included_plugin_dirs", parser.add_argument(
default="", "included_plugin_dirs", default="", nargs="?", type=included_plugin_dir_conv
nargs="?", )
type=included_plugin_dir_conv)
parser.add_argument("--dir", default=".") parser.add_argument("--dir", default=".")
parser.add_argument("--only-git", parser.add_argument(
action="store_true", "--only-git", action="store_true", help="Do not try repo-info.json fallback"
help="Do not try repo-info.json fallback") )
args = parser.parse_args() args = parser.parse_args()
logging.basicConfig(format="%(levelname)s: %(message)s") logging.basicConfig(format="%(levelname)s: %(message)s")
@ -210,7 +219,9 @@ def main():
zkg_provides_info = copy.deepcopy(included_plugins_info) zkg_provides_info = copy.deepcopy(included_plugins_info)
# Hardcode the former spicy-plugin so that zkg knows Spicy is available. # Hardcode the former spicy-plugin so that zkg knows Spicy is available.
zkg_provides_info.append({"name": "spicy-plugin", "version": info["version"].split("-")[0]}) zkg_provides_info.append(
{"name": "spicy-plugin", "version": info["version"].split("-")[0]}
)
info["zkg"] = {"provides": zkg_provides_info} info["zkg"] = {"provides": zkg_provides_info}
json_str = json.dumps(info, indent=2, sort_keys=True) json_str = json.dumps(info, indent=2, sort_keys=True)

View file

@ -0,0 +1,44 @@
#!/bin/bash
#
# This script produces output in the form of
#
# $ REMOTE=awelzel ./ci/container-images-addl-tags.sh v7.0.5
# ADDITIONAL_MANIFEST_TAGS= lts 7.0 latest
#
# This scripts expects visibility to all tags and release branches
# to work correctly. See the find-current-version.sh for details.
set -eu
dir="$(cd "$(dirname "$0")" && pwd)"
if [ $# -ne 1 ] || [ -z "${1}" ]; then
echo "Usage: $0 <tag>" >&2
exit 1
fi
TAG="${1}"
# Find current versions for lts and feature depending on branches and
# tags in the repo. sed for escaping the dot in the version for using
# it in the regex below to match against TAG.
lts_ver=$(${dir}/find-current-version.sh lts)
lts_pat="^v$(echo $lts_ver | sed 's,\.,\\.,g')\.[0-9]+\$"
feature_ver=$(${dir}/find-current-version.sh feature)
feature_pat="^v$(echo $feature_ver | sed 's,\.,\\.,g')\.[0-9]+\$"
# Construct additional tags for the image. At most this will
# be "lts x.0 feature" for an lts branch x.0 that is currently
# also the latest feature branch.
ADDL_MANIFEST_TAGS=
if echo "${TAG}" | grep -q -E "${lts_pat}"; then
ADDL_MANIFEST_TAGS="${ADDL_MANIFEST_TAGS} lts ${lts_ver}"
fi
if echo "${TAG}" | grep -q -E "${feature_pat}"; then
ADDL_MANIFEST_TAGS="${ADDL_MANIFEST_TAGS} latest"
if [ "${feature_ver}" != "${lts_ver}" ]; then
ADDL_MANIFEST_TAGS="${ADDL_MANIFEST_TAGS} ${feature_ver}"
fi
fi
echo "ADDITIONAL_MANIFEST_TAGS=${ADDL_MANIFEST_TAGS}"

View file

@ -4,29 +4,32 @@ ENV DEBIAN_FRONTEND="noninteractive" TZ="America/Los_Angeles"
# A version field to invalidate Cirrus's build cache when needed, as suggested in # A version field to invalidate Cirrus's build cache when needed, as suggested in
# https://github.com/cirruslabs/cirrus-ci-docs/issues/544#issuecomment-566066822 # https://github.com/cirruslabs/cirrus-ci-docs/issues/544#issuecomment-566066822
ENV DOCKERFILE_VERSION 20230801 ENV DOCKERFILE_VERSION=20250905
RUN apt-get update && apt-get -y install \ RUN apt-get update && apt-get -y install \
bison \ bison \
bsdmainutils \ bsdmainutils \
ccache \ ccache \
cmake \ cmake \
cppzmq-dev \
curl \ curl \
dnsmasq \
flex \ flex \
g++ \ g++ \
gcc \ gcc \
git \ git \
jq \ jq \
libkrb5-dev \ libkrb5-dev \
libnats-dev \
libnode-dev \ libnode-dev \
libpcap-dev \ libpcap-dev \
librdkafka-dev \
libssl-dev \ libssl-dev \
libuv1-dev \ libuv1-dev \
make \ make \
python3 \ python3 \
python3-dev \ python3-dev \
python3-pip\ python3-pip\
python3-websockets \
sqlite3 \ sqlite3 \
swig \ swig \
wget \ wget \
@ -37,4 +40,4 @@ RUN apt-get update && apt-get -y install \
# Debian bookworm really doesn't like using pip to install system wide stuff, but # Debian bookworm really doesn't like using pip to install system wide stuff, but
# doesn't seem there's a python3-junit2html package, so not sure what we'd break. # doesn't seem there's a python3-junit2html package, so not sure what we'd break.
RUN pip3 install --break-system-packages junit2html RUN pip3 install --break-system-packages websockets junit2html

View file

@ -1,31 +1,36 @@
FROM debian:11 FROM debian:13
ENV DEBIAN_FRONTEND="noninteractive" TZ="America/Los_Angeles" ENV DEBIAN_FRONTEND="noninteractive" TZ="America/Los_Angeles"
# A version field to invalidate Cirrus's build cache when needed, as suggested in # A version field to invalidate Cirrus's build cache when needed, as suggested in
# https://github.com/cirruslabs/cirrus-ci-docs/issues/544#issuecomment-566066822 # https://github.com/cirruslabs/cirrus-ci-docs/issues/544#issuecomment-566066822
ENV DOCKERFILE_VERSION 20230801 ENV DOCKERFILE_VERSION=20250905
RUN apt-get update && apt-get -y install \ RUN apt-get update && apt-get -y install \
bison \ bison \
bsdmainutils \ bsdmainutils \
ccache \ ccache \
cmake \ cmake \
cppzmq-dev \
curl \ curl \
dnsmasq \
flex \ flex \
g++ \ g++ \
gcc \ gcc \
git \ git \
jq \ jq \
libkrb5-dev \ libkrb5-dev \
libnats-dev \
libnode-dev \ libnode-dev \
libpcap-dev \ libpcap-dev \
librdkafka-dev \
libssl-dev \ libssl-dev \
libuv1-dev \ libuv1-dev \
make \ make \
python3 \ python3 \
python3-dev \ python3-dev \
python3-pip\ python3-pip\
python3-websockets \
sqlite3 \ sqlite3 \
swig \ swig \
wget \ wget \
@ -34,4 +39,6 @@ RUN apt-get update && apt-get -y install \
&& apt autoclean \ && apt autoclean \
&& rm -rf /var/lib/apt/lists/* && rm -rf /var/lib/apt/lists/*
RUN pip3 install websockets junit2html # Debian trixie really doesn't like using pip to install system wide stuff, but
# doesn't seem there's a python3-junit2html package, so not sure what we'd break.
RUN pip3 install --break-system-packages junit2html

View file

@ -1,13 +1,14 @@
FROM fedora:39 FROM fedora:41
# A version field to invalidate Cirrus's build cache when needed, as suggested in # A version field to invalidate Cirrus's build cache when needed, as suggested in
# https://github.com/cirruslabs/cirrus-ci-docs/issues/544#issuecomment-566066822 # https://github.com/cirruslabs/cirrus-ci-docs/issues/544#issuecomment-566066822
ENV DOCKERFILE_VERSION 20231208 ENV DOCKERFILE_VERSION=20250905
RUN dnf -y install \ RUN dnf -y install \
bison \ bison \
ccache \ ccache \
cmake \ cmake \
cppzmq-devel \
diffutils \ diffutils \
findutils \ findutils \
flex \ flex \
@ -28,6 +29,7 @@ RUN dnf -y install \
swig \ swig \
which \ which \
zlib-devel \ zlib-devel \
crypto-policies-scripts \
&& dnf clean all && rm -rf /var/cache/dnf && dnf clean all && rm -rf /var/cache/dnf
RUN pip3 install websockets junit2html RUN pip3 install websockets junit2html

View file

@ -1,15 +1,18 @@
FROM fedora:40 FROM fedora:42
# A version field to invalidate Cirrus's build cache when needed, as suggested in # A version field to invalidate Cirrus's build cache when needed, as suggested in
# https://github.com/cirruslabs/cirrus-ci-docs/issues/544#issuecomment-566066822 # https://github.com/cirruslabs/cirrus-ci-docs/issues/544#issuecomment-566066822
ENV DOCKERFILE_VERSION 20240617 ENV DOCKERFILE_VERSION=20250905
RUN dnf -y install \ RUN dnf -y install \
bison \ bison \
ccache \ ccache \
cmake \ cmake \
cppzmq-devel \
diffutils \ diffutils \
findutils \
flex \ flex \
gawk \
gcc \ gcc \
gcc-c++ \ gcc-c++ \
git \ git \
@ -20,12 +23,14 @@ RUN dnf -y install \
openssl \ openssl \
openssl-devel \ openssl-devel \
procps-ng \ procps-ng \
python3 \
python3-devel \ python3-devel \
python3-pip\ python3-pip\
sqlite \ sqlite \
swig \ swig \
which \ which \
zlib-devel \ zlib-devel \
crypto-policies-scripts \
&& dnf clean all && rm -rf /var/cache/dnf && dnf clean all && rm -rf /var/cache/dnf
RUN pip3 install websockets junit2html RUN pip3 install websockets junit2html

View file

@ -6,7 +6,7 @@ set -e
set -x set -x
env ASSUME_ALWAYS_YES=YES pkg bootstrap env ASSUME_ALWAYS_YES=YES pkg bootstrap
pkg install -y bash git cmake swig bison python3 base64 flex ccache jq pkg install -y bash cppzmq git cmake swig bison python3 base64 flex ccache jq dnsmasq krb5
pkg upgrade -y curl pkg upgrade -y curl
pyver=$(python3 -c 'import sys; print(f"py{sys.version_info[0]}{sys.version_info[1]}")') pyver=$(python3 -c 'import sys; print(f"py{sys.version_info[0]}{sys.version_info[1]}")')
pkg install -y $pyver-sqlite3 pkg install -y $pyver-sqlite3
@ -17,3 +17,6 @@ python -m pip install websockets junit2html
# Spicy detects whether it is run from build directory via `/proc`. # Spicy detects whether it is run from build directory via `/proc`.
echo "proc /proc procfs rw,noauto 0 0" >>/etc/fstab echo "proc /proc procfs rw,noauto 0 0" >>/etc/fstab
mount /proc mount /proc
# dnsmasq is in /usr/local/sbin and that's not in the PATH by default
ln -s /usr/local/sbin/dnsmasq /usr/local/bin/dnsmasq

View file

@ -51,9 +51,9 @@ if [[ -n "${CIRRUS_CI}" ]] && [[ "${CIRRUS_REPO_OWNER}" == "zeek" ]] && [[ ! -d
banner "Trying to clone zeek-testing-private git repo" banner "Trying to clone zeek-testing-private git repo"
echo "${ZEEK_TESTING_PRIVATE_SSH_KEY}" >cirrus_key.b64 echo "${ZEEK_TESTING_PRIVATE_SSH_KEY}" >cirrus_key.b64
if [ "${CIRRUS_TASK_NAME}" == "macos_ventura" -o "${CIRRUS_TASK_NAME}" == "macos_sonoma" ]; then if [[ "${CIRRUS_TASK_NAME}" =~ ^macos_ ]]; then
# The base64 command provided with macOS Ventura/Sonoma requires an argument # The base64 command provided with macOS requires an argument
# to pass the input filename # to pass the input filename, while -i elsewhere is "ignore garbage".
base64 -d -i cirrus_key.b64 >cirrus_key base64 -d -i cirrus_key.b64 >cirrus_key
else else
base64 -d cirrus_key.b64 >cirrus_key base64 -d cirrus_key.b64 >cirrus_key

33
ci/license-header.py Executable file
View file

@ -0,0 +1,33 @@
#!/usr/bin/env python3
import re
import sys
exit_code = 0
copyright_pat = re.compile(
r"See the file \"COPYING\" in the main distribution directory for copyright."
)
def match_line(line):
m = copyright_pat.search(line)
if m is not None:
return True
return False
for f in sys.argv[1:]:
has_license_header = False
with open(f) as fp:
for line in fp:
line = line.strip()
if has_license_header := match_line(line):
break
if not has_license_header:
print(f"{f}:does not seem to contain a license header", file=sys.stderr)
exit_code = 1
sys.exit(exit_code)

View file

@ -7,10 +7,9 @@ set -x
brew update brew update
brew upgrade cmake brew upgrade cmake
brew install openssl@3 swig bison flex ccache libmaxminddb brew install cppzmq openssl@3 python@3 swig bison flex ccache libmaxminddb dnsmasq krb5
if [ $(sw_vers -productVersion | cut -d '.' -f 1) -lt 14 ]; then which python3
python3 -m pip install --upgrade pip python3 --version
fi
python3 -m pip install --user --break-system-packages websockets python3 -m pip install --user --break-system-packages websockets

View file

@ -1,40 +0,0 @@
FROM opensuse/leap:15.5
# A version field to invalidate Cirrus's build cache when needed, as suggested in
# https://github.com/cirruslabs/cirrus-ci-docs/issues/544#issuecomment-566066822
ENV DOCKERFILE_VERSION 20230905
RUN zypper addrepo https://download.opensuse.org/repositories/openSUSE:Leap:15.5:Update/standard/openSUSE:Leap:15.5:Update.repo \
&& zypper refresh \
&& zypper in -y \
bison \
ccache \
cmake \
curl \
flex \
gcc12 \
gcc12-c++ \
git \
gzip \
jq \
libopenssl-devel \
libpcap-devel \
make \
openssh \
python311 \
python311-devel \
python311-pip \
swig \
tar \
which \
zlib-devel \
&& rm -rf /var/cache/zypp
RUN update-alternatives --install /usr/bin/pip3 pip3 /usr/bin/pip3.11 100
RUN update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.11 100
RUN update-alternatives --install /usr/bin/python3-config python3-config /usr/bin/python3.11-config 100
RUN pip3 install websockets junit2html
RUN update-alternatives --install /usr/bin/cc cc /usr/bin/gcc-12 100
RUN update-alternatives --install /usr/bin/c++ c++ /usr/bin/g++-12 100

View file

@ -2,7 +2,7 @@ FROM opensuse/leap:15.6
# A version field to invalidate Cirrus's build cache when needed, as suggested in # A version field to invalidate Cirrus's build cache when needed, as suggested in
# https://github.com/cirruslabs/cirrus-ci-docs/issues/544#issuecomment-566066822 # https://github.com/cirruslabs/cirrus-ci-docs/issues/544#issuecomment-566066822
ENV DOCKERFILE_VERSION 20230905 ENV DOCKERFILE_VERSION=20250905
RUN zypper addrepo https://download.opensuse.org/repositories/openSUSE:Leap:15.6:Update/standard/openSUSE:Leap:15.6:Update.repo \ RUN zypper addrepo https://download.opensuse.org/repositories/openSUSE:Leap:15.6:Update/standard/openSUSE:Leap:15.6:Update.repo \
&& zypper refresh \ && zypper refresh \
@ -10,7 +10,9 @@ RUN zypper addrepo https://download.opensuse.org/repositories/openSUSE:Leap:15.6
bison \ bison \
ccache \ ccache \
cmake \ cmake \
cppzmq-devel \
curl \ curl \
dnsmasq \
flex \ flex \
gcc12 \ gcc12 \
gcc12-c++ \ gcc12-c++ \
@ -21,6 +23,7 @@ RUN zypper addrepo https://download.opensuse.org/repositories/openSUSE:Leap:15.6
libpcap-devel \ libpcap-devel \
make \ make \
openssh \ openssh \
procps \
python312 \ python312 \
python312-devel \ python312-devel \
python312-pip \ python312-pip \

View file

@ -2,7 +2,7 @@ FROM opensuse/tumbleweed
# A version field to invalidate Cirrus's build cache when needed, as suggested in # A version field to invalidate Cirrus's build cache when needed, as suggested in
# https://github.com/cirruslabs/cirrus-ci-docs/issues/544#issuecomment-566066822 # https://github.com/cirruslabs/cirrus-ci-docs/issues/544#issuecomment-566066822
ENV DOCKERFILE_VERSION 20230801 ENV DOCKERFILE_VERSION=20250905
# Remove the repo-openh264 repository, it caused intermittent issues # Remove the repo-openh264 repository, it caused intermittent issues
# and we should not be needing any packages from it. # and we should not be needing any packages from it.
@ -14,8 +14,10 @@ RUN zypper refresh \
bison \ bison \
ccache \ ccache \
cmake \ cmake \
cppzmq-devel \
curl \ curl \
diffutils \ diffutils \
dnsmasq \
findutils \ findutils \
flex \ flex \
gcc \ gcc \
@ -30,7 +32,6 @@ RUN zypper refresh \
python3 \ python3 \
python3-devel \ python3-devel \
python3-pip \ python3-pip \
python3-websockets \
swig \ swig \
tar \ tar \
util-linux \ util-linux \
@ -38,4 +39,4 @@ RUN zypper refresh \
zlib-devel \ zlib-devel \
&& rm -rf /var/cache/zypp && rm -rf /var/cache/zypp
RUN pip3 install --break-system-packages junit2html RUN pip3 install --break-system-packages websockets junit2html

View file

@ -0,0 +1,27 @@
#!/bin/sh
zypper refresh
zypper patch -y --with-update --with-optional
LATEST_VERSION=$(zypper search -n ${ZEEK_CI_COMPILER} |
awk -F "|" "match(\$2, / ${ZEEK_CI_COMPILER}([0-9]{2})[^-]/, a) {print a[1]}" |
sort | tail -1)
echo "Installing ${ZEEK_CI_COMPILER} ${LATEST_VERSION}"
zypper install -y "${ZEEK_CI_COMPILER}${LATEST_VERSION}"
if [ "${ZEEK_CI_COMPILER}" == "gcc" ]; then
zypper install -y "${ZEEK_CI_COMPILER}${LATEST_VERSION}-c++"
fi
update-alternatives --install /usr/bin/cc cc "/usr/bin/${ZEEK_CI_COMPILER}-${LATEST_VERSION}" 100
update-alternatives --set cc "/usr/bin/${ZEEK_CI_COMPILER}-${LATEST_VERSION}"
if [ "${ZEEK_CI_COMPILER}" == "gcc" ]; then
update-alternatives --install /usr/bin/c++ c++ "/usr/bin/g++-${LATEST_VERSION}" 100
update-alternatives --set c++ "/usr/bin/g++-${LATEST_VERSION}"
else
update-alternatives --install /usr/bin/c++ c++ "/usr/bin/clang++-${LATEST_VERSION}" 100
update-alternatives --set c++ "/usr/bin/clang++-${LATEST_VERSION}"
fi

View file

@ -7,6 +7,13 @@
result=0 result=0
BTEST=$(pwd)/auxil/btest/btest BTEST=$(pwd)/auxil/btest/btest
# Due to issues with DNS lookups on macOS, one of the Cirrus support people recommended we
# run our tests as root. See https://github.com/cirruslabs/cirrus-ci-docs/issues/1302 for
# more details.
if [[ "${CIRRUS_OS}" == "darwin" ]]; then
BTEST="sudo ${BTEST}"
fi
if [[ -z "${CIRRUS_CI}" ]]; then if [[ -z "${CIRRUS_CI}" ]]; then
# Set default values to use in place of env. variables set by Cirrus CI. # Set default values to use in place of env. variables set by Cirrus CI.
ZEEK_CI_CPUS=1 ZEEK_CI_CPUS=1
@ -40,10 +47,15 @@ function banner {
} }
function run_unit_tests { function run_unit_tests {
if [[ ${ZEEK_CI_SKIP_UNIT_TESTS} -eq 1 ]]; then
printf "Skipping unit tests as requested by task configuration\n\n"
return 0
fi
banner "Running unit tests" banner "Running unit tests"
pushd build pushd build
(. ./zeek-path-dev.sh && zeek --test --no-skip) || result=1 (. ./zeek-path-dev.sh && TZ=UTC zeek --test --no-skip) || result=1
popd popd
return 0 return 0
} }
@ -60,7 +72,7 @@ function run_btests {
pushd testing/btest pushd testing/btest
ZEEK_PROFILER_FILE=$(pwd)/.tmp/script-coverage/XXXXXX \ ZEEK_PROFILER_FILE=$(pwd)/.tmp/script-coverage/XXXXXX \
${BTEST} -z ${ZEEK_CI_BTEST_RETRIES} -d -A -x btest-results.xml -j ${ZEEK_CI_BTEST_JOBS} || result=1 ${BTEST} -z ${ZEEK_CI_BTEST_RETRIES} -d -A -x btest-results.xml -j ${ZEEK_CI_BTEST_JOBS} ${ZEEK_CI_BTEST_EXTRA_ARGS} || result=1
make coverage make coverage
prep_artifacts prep_artifacts
popd popd
@ -68,11 +80,16 @@ function run_btests {
} }
function run_external_btests { function run_external_btests {
if [[ ${ZEEK_CI_SKIP_EXTERNAL_BTESTS} -eq 1 ]]; then
printf "Skipping external tests as requested by task configuration\n\n"
return 0
fi
local zeek_testing_pid="" local zeek_testing_pid=""
local zeek_testing_pid_private="" local zeek_testing_pid_private=""
pushd testing/external/zeek-testing pushd testing/external/zeek-testing
ZEEK_PROFILER_FILE=$(pwd)/.tmp/script-coverage/XXXXXX \ ZEEK_PROFILER_FILE=$(pwd)/.tmp/script-coverage/XXXXXX \
${BTEST} -d -A -x btest-results.xml -j ${ZEEK_CI_BTEST_JOBS} >btest.out 2>&1 & ${BTEST} -d -A -x btest-results.xml -j ${ZEEK_CI_BTEST_JOBS} ${ZEEK_CI_BTEST_EXTRA_ARGS} >btest.out 2>&1 &
zeek_testing_pid=$! zeek_testing_pid=$!
popd popd

View file

@ -46,3 +46,16 @@ deadlock:zeek::threading::Queue<zeek::threading::BasicInputMessage*>::LocksForAl
# This only happens at shutdown. It was supposedly fixed in civetweb, but has cropped # This only happens at shutdown. It was supposedly fixed in civetweb, but has cropped
# up again. See https://github.com/civetweb/civetweb/issues/861 for details. # up again. See https://github.com/civetweb/civetweb/issues/861 for details.
race:mg_stop race:mg_stop
# Uninstrumented library.
#
# We'd need to build zmq with TSAN enabled, without it reports data races
# as it doesn't see the synchronization done [1], but also there's reports
# that ZeroMQ uses non-standard synchronization that may be difficult for
# TSAN to see.
#
# [1] https://groups.google.com/g/thread-sanitizer/c/7UZqM02yMYg/m/KlHOv2ckr9sJ
# [2] https://github.com/zeromq/libzmq/issues/3919
#
called_from_lib:libzmq.so.5
called_from_lib:libzmq.so

View file

@ -4,7 +4,7 @@ ENV DEBIAN_FRONTEND="noninteractive" TZ="America/Los_Angeles"
# A version field to invalidate Cirrus's build cache when needed, as suggested in # A version field to invalidate Cirrus's build cache when needed, as suggested in
# https://github.com/cirruslabs/cirrus-ci-docs/issues/544#issuecomment-566066822 # https://github.com/cirruslabs/cirrus-ci-docs/issues/544#issuecomment-566066822
ENV DOCKERFILE_VERSION 20230801 ENV DOCKERFILE_VERSION=20250905
RUN apt-get update && apt-get -y install \ RUN apt-get update && apt-get -y install \
bc \ bc \
@ -23,6 +23,7 @@ RUN apt-get update && apt-get -y install \
libmaxminddb-dev \ libmaxminddb-dev \
libpcap-dev \ libpcap-dev \
libssl-dev \ libssl-dev \
libzmq3-dev \
make \ make \
python3 \ python3 \
python3-dev \ python3-dev \

View file

@ -4,17 +4,20 @@ ENV DEBIAN_FRONTEND="noninteractive" TZ="America/Los_Angeles"
# A version field to invalidate Cirrus's build cache when needed, as suggested in # A version field to invalidate Cirrus's build cache when needed, as suggested in
# https://github.com/cirruslabs/cirrus-ci-docs/issues/544#issuecomment-566066822 # https://github.com/cirruslabs/cirrus-ci-docs/issues/544#issuecomment-566066822
ENV DOCKERFILE_VERSION 20240528 ENV DOCKERFILE_VERSION=20250905
RUN apt-get update && apt-get -y install \ RUN apt-get update && apt-get -y install \
bc \ bc \
bison \ bison \
bsdmainutils \ bsdmainutils \
ccache \ ccache \
clang-18 \ clang-19 \
clang++-18 \ clang++-19 \
clang-tidy-19 \
cmake \ cmake \
cppzmq-dev \
curl \ curl \
dnsmasq \
flex \ flex \
g++ \ g++ \
gcc \ gcc \
@ -22,22 +25,53 @@ RUN apt-get update && apt-get -y install \
jq \ jq \
lcov \ lcov \
libkrb5-dev \ libkrb5-dev \
libhiredis-dev \
libmaxminddb-dev \ libmaxminddb-dev \
libpcap-dev \ libpcap-dev \
libssl-dev \ libssl-dev \
make \ make \
python3 \ python3 \
python3-dev \ python3-dev \
python3-git \
python3-pip \ python3-pip \
python3-websockets \ python3-semantic-version \
redis-server \
ruby \ ruby \
sqlite3 \ sqlite3 \
swig \ swig \
unzip \ unzip \
wget \ wget \
zlib1g-dev \ zlib1g-dev \
libc++-dev \
libc++abi-dev \
&& apt autoclean \ && apt autoclean \
&& rm -rf /var/lib/apt/lists/* && rm -rf /var/lib/apt/lists/*
RUN pip3 install --break-system-packages junit2html RUN pip3 install --break-system-packages websockets junit2html
RUN gem install coveralls-lcov RUN gem install coveralls-lcov
# Ubuntu installs clang versions with the binaries having the version number
# appended. Create a symlink for clang-tidy so cmake finds it correctly.
RUN update-alternatives --install /usr/bin/clang-tidy clang-tidy /usr/bin/clang-tidy-19 1000
# Download a newer pre-built ccache version that recognizes -fprofile-update=atomic
# which is used when building with --coverage.
#
# This extracts the tarball into /opt/ccache-<version>-<platform> and
# symlinks the executable to /usr/local/bin/ccache.
#
# See: https://ccache.dev/download.html
ENV CCACHE_VERSION=4.10.2
ENV CCACHE_PLATFORM=linux-x86_64
ENV CCACHE_URL=https://github.com/ccache/ccache/releases/download/v${CCACHE_VERSION}/ccache-${CCACHE_VERSION}-${CCACHE_PLATFORM}.tar.xz
ENV CCACHE_SHA256=80cab87bd510eca796467aee8e663c398239e0df1c4800a0b5dff11dca0b4f18
RUN cd /opt \
&& if [ "$(uname -p)" != "x86_64" ]; then echo "cannot use ccache pre-built for x86_64!" >&2; exit 1 ; fi \
&& curl -L --fail --max-time 30 $CCACHE_URL -o ccache.tar.xz \
&& sha256sum ./ccache.tar.xz >&2 \
&& echo "${CCACHE_SHA256} ccache.tar.xz" | sha256sum -c - \
&& tar xvf ./ccache.tar.xz \
&& ln -s $(pwd)/ccache-${CCACHE_VERSION}-${CCACHE_PLATFORM}/ccache /usr/local/bin/ccache \
&& test "$(command -v ccache)" = "/usr/local/bin/ccache" \
&& test "$(ccache --print-version)" = "${CCACHE_VERSION}" \
&& rm ./ccache.tar.xz

View file

@ -1,18 +1,22 @@
FROM ubuntu:20.04 FROM ubuntu:25.04
ENV DEBIAN_FRONTEND="noninteractive" TZ="America/Los_Angeles" ENV DEBIAN_FRONTEND="noninteractive" TZ="America/Los_Angeles"
# A version field to invalidate Cirrus's build cache when needed, as suggested in # A version field to invalidate Cirrus's build cache when needed, as suggested in
# https://github.com/cirruslabs/cirrus-ci-docs/issues/544#issuecomment-566066822 # https://github.com/cirruslabs/cirrus-ci-docs/issues/544#issuecomment-566066822
ENV DOCKERFILE_VERSION 20240528 ENV DOCKERFILE_VERSION=20250905
RUN apt-get update && apt-get -y install \ RUN apt-get update && apt-get -y install \
bc \ bc \
bison \ bison \
bsdmainutils \ bsdmainutils \
ccache \ ccache \
clang-18 \
clang++-18 \
cmake \ cmake \
cppzmq-dev \
curl \ curl \
dnsmasq \
flex \ flex \
g++ \ g++ \
gcc \ gcc \
@ -26,14 +30,17 @@ RUN apt-get update && apt-get -y install \
make \ make \
python3 \ python3 \
python3-dev \ python3-dev \
python3-pip\ python3-pip \
ruby \ ruby \
sqlite3 \ sqlite3 \
swig \ swig \
unzip \ unzip \
wget \ wget \
zlib1g-dev \ zlib1g-dev \
libc++-dev \
libc++abi-dev \
&& apt autoclean \ && apt autoclean \
&& rm -rf /var/lib/apt/lists/* && rm -rf /var/lib/apt/lists/*
RUN pip3 install websockets junit2html RUN pip3 install --break-system-packages websockets junit2html
RUN gem install coveralls-lcov

View file

@ -28,7 +28,7 @@ cd $build_dir
export ZEEK_SEED_FILE=$source_dir/testing/btest/random.seed export ZEEK_SEED_FILE=$source_dir/testing/btest/random.seed
function run_zeek { function run_zeek {
ZEEK_ALLOW_INIT_ERRORS=1 zeek -X $conf_file zeekygen >/dev/null ZEEK_ALLOW_INIT_ERRORS=1 zeek -X $conf_file zeekygen
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
echo "Failed running zeek with zeekygen config file $conf_file" >&2 echo "Failed running zeek with zeekygen config file $conf_file" >&2

View file

@ -5,7 +5,7 @@ SHELL [ "powershell" ]
# A version field to invalidatea Cirrus's build cache when needed, as suggested in # A version field to invalidatea Cirrus's build cache when needed, as suggested in
# https://github.com/cirruslabs/cirrus-ci-docs/issues/544#issuecomment-566066822 # https://github.com/cirruslabs/cirrus-ci-docs/issues/544#issuecomment-566066822
ENV DOCKERFILE_VERSION 20230801 ENV DOCKERFILE_VERSION=20250905
RUN Set-ExecutionPolicy Unrestricted -Force RUN Set-ExecutionPolicy Unrestricted -Force
@ -14,8 +14,8 @@ RUN [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePoin
iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1')) iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
# Install prerequisites # Install prerequisites
RUN choco install -y --no-progress visualstudio2019buildtools --version=16.11.11.0 RUN choco install -y --no-progress visualstudio2022buildtools --version=117.14.1
RUN choco install -y --no-progress visualstudio2019-workload-vctools --version=1.0.0 --package-parameters '--add Microsoft.VisualStudio.Component.VC.ATLMFC' RUN choco install -y --no-progress visualstudio2022-workload-vctools --version=1.0.0 --package-parameters '--add Microsoft.VisualStudio.Component.VC.ATLMFC'
RUN choco install -y --no-progress sed RUN choco install -y --no-progress sed
RUN choco install -y --no-progress winflexbison3 RUN choco install -y --no-progress winflexbison3
RUN choco install -y --no-progress msysgit RUN choco install -y --no-progress msysgit
@ -30,4 +30,4 @@ RUN mkdir C:\build
WORKDIR C:\build WORKDIR C:\build
# This entry point starts the developer command prompt and launches the PowerShell shell. # This entry point starts the developer command prompt and launches the PowerShell shell.
ENTRYPOINT ["C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\BuildTools\\Common7\\Tools\\VsDevCmd.bat", "-arch=x64", "&&", "powershell.exe", "-NoLogo", "-ExecutionPolicy", "Unrestricted"] ENTRYPOINT ["C:\\Program Files (x86)\\Microsoft Visual Studio\\2022\\BuildTools\\Common7\\Tools\\VsDevCmd.bat", "-arch=x64", "&&", "powershell.exe", "-NoLogo", "-ExecutionPolicy", "Unrestricted"]

View file

@ -2,7 +2,7 @@
:: cmd current shell. This path is hard coded to the one on the CI image, but :: cmd current shell. This path is hard coded to the one on the CI image, but
:: can be adjusted if running builds locally. Unfortunately, the initial path :: can be adjusted if running builds locally. Unfortunately, the initial path
:: isn't in the environment so we have to hardcode the whole path. :: isn't in the environment so we have to hardcode the whole path.
call "c:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Auxiliary\Build\vcvarsall.bat" x86_amd64 call "c:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Auxiliary\Build\vcvarsall.bat" x86_amd64
mkdir build mkdir build
cd build cd build

View file

@ -1,5 +1,5 @@
:: See build.cmd for documentation on this call. :: See build.cmd for documentation on this call.
call "c:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Auxiliary\Build\vcvarsall.bat" x86_amd64 call "c:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Auxiliary\Build\vcvarsall.bat" x86_amd64
cd build cd build

2
cmake

@ -1 +1 @@
Subproject commit 690483f76c149ffa8e035b612b406b0964f9886f Subproject commit d51c6990446cf70cb9c01bca17dad171a1db05d3

View file

@ -2,10 +2,9 @@
#pragma once #pragma once
#define ZEEK_SCRIPT_INSTALL_PATH "@ZEEK_SCRIPT_INSTALL_PATH@" constexpr char ZEEK_SCRIPT_INSTALL_PATH[] = "@ZEEK_SCRIPT_INSTALL_PATH@";
#define BRO_PLUGIN_INSTALL_PATH "@ZEEK_PLUGIN_DIR@" constexpr char ZEEK_PLUGIN_INSTALL_PATH[] = "@ZEEK_PLUGIN_DIR@";
#define ZEEK_PLUGIN_INSTALL_PATH "@ZEEK_PLUGIN_DIR@" constexpr char DEFAULT_ZEEKPATH[] = "@DEFAULT_ZEEKPATH@";
#define DEFAULT_ZEEKPATH "@DEFAULT_ZEEKPATH@" constexpr char ZEEK_SPICY_MODULE_PATH[] = "@ZEEK_SPICY_MODULE_PATH@";
#define ZEEK_SPICY_MODULE_PATH "@ZEEK_SPICY_MODULE_PATH@" constexpr char ZEEK_SPICY_LIBRARY_PATH[] = "@ZEEK_SPICY_LIBRARY_PATH@";
#define ZEEK_SPICY_LIBRARY_PATH "@ZEEK_SPICY_LIBRARY_PATH@" constexpr char ZEEK_SPICY_DATA_PATH[] = "@ZEEK_SPICY_DATA_PATH@";
#define ZEEK_SPICY_DATA_PATH "@ZEEK_SPICY_DATA_PATH@"

View file

@ -1,4 +1,6 @@
// See the file "COPYING" in the main distribution directory for copyright. // See the file "COPYING" in the main distribution directory for copyright.
// NOLINTBEGIN(modernize-macro-to-enum)
// NOLINTBEGIN(cppcoreguidelines-macro-usage)
#pragma once #pragma once
@ -244,6 +246,9 @@
/* Enable/disable ZAM profiling capability */ /* Enable/disable ZAM profiling capability */
#cmakedefine ENABLE_ZAM_PROFILE #cmakedefine ENABLE_ZAM_PROFILE
/* Enable/disable the Spicy SSL analyzer */
#cmakedefine ENABLE_SPICY_SSL
/* String with host architecture (e.g., "linux-x86_64") */ /* String with host architecture (e.g., "linux-x86_64") */
#define HOST_ARCHITECTURE "@HOST_ARCHITECTURE@" #define HOST_ARCHITECTURE "@HOST_ARCHITECTURE@"
@ -303,3 +308,6 @@
/* compiled with Spicy support */ /* compiled with Spicy support */
#cmakedefine HAVE_SPICY #cmakedefine HAVE_SPICY
// NOLINTEND(cppcoreguidelines-macro-usage)
// NOLINTEND(modernize-macro-to-enum)

42
configure vendored
View file

@ -69,11 +69,17 @@ Usage: $0 [OPTION]... [VAR=VALUE]...
--enable-static-broker build Broker statically (ignored if --with-broker is specified) --enable-static-broker build Broker statically (ignored if --with-broker is specified)
--enable-werror build with -Werror --enable-werror build with -Werror
--enable-ZAM-profiling build with ZAM profiling enabled (--enable-debug implies this) --enable-ZAM-profiling build with ZAM profiling enabled (--enable-debug implies this)
--enable-spicy-ssl build with spicy SSL/TLS analyzer (conflicts with --disable-spicy)
--enable-iwyu build with include-what-you-use enabled for the main Zeek target.
Requires include-what-you-use binary to be in the PATH.
--enable-clang-tidy build with clang-tidy enabled for the main Zeek target.
Requires clang-tidy binary to be in the PATH.
--disable-af-packet don't include native AF_PACKET support (Linux only) --disable-af-packet don't include native AF_PACKET support (Linux only)
--disable-auxtools don't build or install auxiliary tools --disable-auxtools don't build or install auxiliary tools
--disable-broker-tests don't try to build Broker unit tests --disable-broker-tests don't try to build Broker unit tests
--disable-btest don't install BTest --disable-btest don't install BTest
--disable-btest-pcaps don't install Zeek's BTest input pcaps --disable-btest-pcaps don't install Zeek's BTest input pcaps
--disable-cluster-backend-zeromq don't build Zeek's ZeroMQ cluster backend
--disable-cpp-tests don't build Zeek's C++ unit tests --disable-cpp-tests don't build Zeek's C++ unit tests
--disable-javascript don't build Zeek's JavaScript support --disable-javascript don't build Zeek's JavaScript support
--disable-port-prealloc disable pre-allocating the PortVal array in ValManager --disable-port-prealloc disable pre-allocating the PortVal array in ValManager
@ -84,16 +90,9 @@ Usage: $0 [OPTION]... [VAR=VALUE]...
--disable-zkg don't install zkg --disable-zkg don't install zkg
Required Packages in Non-Standard Locations: Required Packages in Non-Standard Locations:
--with-bifcl=PATH path to Zeek BIF compiler executable
(useful for cross-compiling)
--with-bind=PATH path to BIND install root
--with-binpac=PATH path to BinPAC executable
(useful for cross-compiling)
--with-bison=PATH path to bison executable --with-bison=PATH path to bison executable
--with-broker=PATH path to Broker install root --with-broker=PATH path to Broker install root
(Zeek uses an embedded version by default) (Zeek uses an embedded version by default)
--with-gen-zam=PATH path to Gen-ZAM code generator
(Zeek uses an embedded version by default)
--with-flex=PATH path to flex executable --with-flex=PATH path to flex executable
--with-libkqueue=PATH path to libkqueue install root --with-libkqueue=PATH path to libkqueue install root
(Zeek uses an embedded version by default) (Zeek uses an embedded version by default)
@ -310,12 +309,18 @@ while [ $# -ne 0 ]; do
--enable-ZAM-profiling) --enable-ZAM-profiling)
append_cache_entry ENABLE_ZAM_PROFILE BOOL true append_cache_entry ENABLE_ZAM_PROFILE BOOL true
;; ;;
--enable-spicy-ssl)
append_cache_entry ENABLE_SPICY_SSL BOOL true
;;
--enable-iwyu)
append_cache_entry ENABLE_IWYU BOOL true
;;
--enable-clang-tidy)
append_cache_entry ENABLE_CLANG_TIDY BOOL true
;;
--disable-af-packet) --disable-af-packet)
append_cache_entry DISABLE_AF_PACKET BOOL true append_cache_entry DISABLE_AF_PACKET BOOL true
;; ;;
--disable-archiver)
has_disable_archiver=1
;;
--disable-auxtools) --disable-auxtools)
append_cache_entry INSTALL_AUX_TOOLS BOOL false append_cache_entry INSTALL_AUX_TOOLS BOOL false
;; ;;
@ -329,6 +334,9 @@ while [ $# -ne 0 ]; do
--disable-btest-pcaps) --disable-btest-pcaps)
append_cache_entry INSTALL_BTEST_PCAPS BOOL false append_cache_entry INSTALL_BTEST_PCAPS BOOL false
;; ;;
--disable-cluster-backend-zeromq)
append_cache_entry ENABLE_CLUSTER_BACKEND_ZEROMQ BOOL false
;;
--disable-cpp-tests) --disable-cpp-tests)
append_cache_entry ENABLE_ZEEK_UNIT_TESTS BOOL false append_cache_entry ENABLE_ZEEK_UNIT_TESTS BOOL false
;; ;;
@ -353,15 +361,9 @@ while [ $# -ne 0 ]; do
--disable-zkg) --disable-zkg)
append_cache_entry INSTALL_ZKG BOOL false append_cache_entry INSTALL_ZKG BOOL false
;; ;;
--with-bifcl=*)
append_cache_entry BIFCL_EXE_PATH PATH $optarg
;;
--with-bind=*) --with-bind=*)
append_cache_entry BIND_ROOT_DIR PATH $optarg append_cache_entry BIND_ROOT_DIR PATH $optarg
;; ;;
--with-binpac=*)
append_cache_entry BINPAC_EXE_PATH PATH $optarg
;;
--with-bison=*) --with-bison=*)
append_cache_entry BISON_EXECUTABLE PATH $optarg append_cache_entry BISON_EXECUTABLE PATH $optarg
;; ;;
@ -374,9 +376,6 @@ while [ $# -ne 0 ]; do
--with-flex=*) --with-flex=*)
append_cache_entry FLEX_EXECUTABLE PATH $optarg append_cache_entry FLEX_EXECUTABLE PATH $optarg
;; ;;
--with-gen-zam=*)
append_cache_entry GEN_ZAM_EXE_PATH PATH $optarg
;;
--with-geoip=*) --with-geoip=*)
append_cache_entry LibMMDB_ROOT_DIR PATH $optarg append_cache_entry LibMMDB_ROOT_DIR PATH $optarg
;; ;;
@ -492,8 +491,3 @@ eval ${cmake} 2>&1
echo "# This is the command used to configure this build" >config.status echo "# This is the command used to configure this build" >config.status
echo $command >>config.status echo $command >>config.status
chmod u+x config.status chmod u+x config.status
if [ $has_disable_archiver -eq 1 ]; then
echo
echo "NOTE: The --disable-archiver argument no longer has any effect and will be removed in v7.1. zeek-archiver is now part of zeek-aux, so consider --disable-auxtools instead."
fi

2
doc

@ -1 +1 @@
Subproject commit f65820ff0faf2887799fe691a443b5db39eeed54 Subproject commit 8f38ae2fd563314393eb1ca58c827d26e9966520

View file

@ -1,7 +1,7 @@
# See the file "COPYING" in the main distribution directory for copyright. # See the file "COPYING" in the main distribution directory for copyright.
# Layer to build Zeek. # Layer to build Zeek.
FROM debian:bookworm-slim FROM debian:13-slim
# Make the shell split commands in the log so we can determine reasons for # Make the shell split commands in the log so we can determine reasons for
# failures more easily. # failures more easily.
@ -16,11 +16,13 @@ RUN echo 'Acquire::https::timeout "180";' >> /etc/apt/apt.conf.d/99-timeouts
# Configure system for build. # Configure system for build.
RUN apt-get -q update \ RUN apt-get -q update \
&& apt-get upgrade -q -y \
&& apt-get install -q -y --no-install-recommends \ && apt-get install -q -y --no-install-recommends \
bind9 \ bind9 \
bison \ bison \
ccache \ ccache \
cmake \ cmake \
cppzmq-dev \
flex \ flex \
g++ \ g++ \
gcc \ gcc \
@ -35,7 +37,7 @@ RUN apt-get -q update \
libz-dev \ libz-dev \
make \ make \
python3-minimal \ python3-minimal \
python3.11-dev \ python3-dev \
swig \ swig \
ninja-build \ ninja-build \
python3-pip \ python3-pip \

View file

@ -1,7 +1,7 @@
# See the file "COPYING" in the main distribution directory for copyright. # See the file "COPYING" in the main distribution directory for copyright.
# Final layer containing all artifacts. # Final layer containing all artifacts.
FROM debian:bookworm-slim FROM debian:13-slim
# Make the shell split commands in the log so we can determine reasons for # Make the shell split commands in the log so we can determine reasons for
# failures more easily. # failures more easily.
@ -15,19 +15,23 @@ RUN echo 'Acquire::http::timeout "180";' > /etc/apt/apt.conf.d/99-timeouts
RUN echo 'Acquire::https::timeout "180";' >> /etc/apt/apt.conf.d/99-timeouts RUN echo 'Acquire::https::timeout "180";' >> /etc/apt/apt.conf.d/99-timeouts
RUN apt-get -q update \ RUN apt-get -q update \
&& apt-get upgrade -q -y \
&& apt-get install -q -y --no-install-recommends \ && apt-get install -q -y --no-install-recommends \
ca-certificates \ ca-certificates \
git \ git \
jq \ jq \
libmaxminddb0 \ libmaxminddb0 \
libnode108 \ libnode115 \
libpython3.11 \
libpcap0.8 \ libpcap0.8 \
libpython3.13 \
libssl3 \ libssl3 \
libuv1 \ libuv1 \
libz1 \ libz1 \
python3-minimal \ libzmq5 \
net-tools \
procps \
python3-git \ python3-git \
python3-minimal \
python3-semantic-version \ python3-semantic-version \
python3-websocket \ python3-websocket \
&& apt-get clean \ && apt-get clean \
@ -35,5 +39,5 @@ RUN apt-get -q update \
# Copy over Zeek installation from build # Copy over Zeek installation from build
COPY --from=zeek-build /usr/local/zeek /usr/local/zeek COPY --from=zeek-build /usr/local/zeek /usr/local/zeek
ENV PATH "/usr/local/zeek/bin:${PATH}" ENV PATH="/usr/local/zeek/bin:${PATH}"
ENV PYTHONPATH "/usr/local/zeek/lib/zeek/python:${PYTHONPATH}" ENV PYTHONPATH="/usr/local/zeek/lib/zeek/python:${PYTHONPATH}"

8
ruff.toml Normal file
View file

@ -0,0 +1,8 @@
target-version = "py39"
# Skip anything in the auxil directory. This includes pysubnetree which
# should be handled separately.
exclude = ["auxil"]
[lint]
select = ["C4", "F", "I", "ISC", "UP"]

View file

@ -60,13 +60,13 @@ const pe_mime_types = { "application/x-dosexec" };
event zeek_init() &priority=5 event zeek_init() &priority=5
{ {
Files::register_for_mime_types(Files::ANALYZER_PE, pe_mime_types); Files::register_for_mime_types(Files::ANALYZER_PE, pe_mime_types);
Log::create_stream(LOG, [$columns=Info, $ev=log_pe, $path="pe", $policy=log_policy]); Log::create_stream(LOG, Log::Stream($columns=Info, $ev=log_pe, $path="pe", $policy=log_policy));
} }
hook set_file(f: fa_file) &priority=5 hook set_file(f: fa_file) &priority=5
{ {
if ( ! f?$pe ) if ( ! f?$pe )
f$pe = [$ts=f$info$ts, $id=f$id]; f$pe = PE::Info($ts=f$info$ts, $id=f$id);
} }
event pe_dos_header(f: fa_file, h: PE::DOSHeader) &priority=5 event pe_dos_header(f: fa_file, h: PE::DOSHeader) &priority=5

View file

@ -40,7 +40,7 @@ export {
event zeek_init() &priority=5 event zeek_init() &priority=5
{ {
Log::create_stream(LOG, [$columns=Info, $ev=log_ocsp, $path="ocsp", $policy=log_policy]); Log::create_stream(LOG, Log::Stream($columns=Info, $ev=log_ocsp, $path="ocsp", $policy=log_policy));
Files::register_for_mime_type(Files::ANALYZER_OCSP_REPLY, "application/ocsp-response"); Files::register_for_mime_type(Files::ANALYZER_OCSP_REPLY, "application/ocsp-response");
} }

View file

@ -105,6 +105,29 @@ export {
## Event for accessing logged records. ## Event for accessing logged records.
global log_x509: event(rec: Info); global log_x509: event(rec: Info);
## The maximum number of bytes that a single string field can contain when
## logging. If a string reaches this limit, the log output for the field will be
## truncated. Setting this to zero disables the limiting.
##
## .. zeek:see:: Log::default_max_field_string_bytes
const default_max_field_string_bytes = Log::default_max_field_string_bytes &redef;
## The maximum number of elements a single container field can contain when
## logging. If a container reaches this limit, the log output for the field will
## be truncated. Setting this to zero disables the limiting.
##
## .. zeek:see:: Log::default_max_field_container_elements
const default_max_field_container_elements = 500 &redef;
## The maximum total number of container elements a record may log. This is the
## sum of all container elements logged for the record. If this limit is reached,
## all further containers will be logged as empty containers. If the limit is
## reached while processing a container, the container will be truncated in the
## output. Setting this to zero disables the limiting.
##
## .. zeek:see:: Log::default_max_total_container_elements
const default_max_total_container_elements = 1500 &redef;
} }
global known_log_certs_with_broker: set[LogCertHash] &create_expire=relog_known_certificates_after &backend=Broker::MEMORY; global known_log_certs_with_broker: set[LogCertHash] &create_expire=relog_known_certificates_after &backend=Broker::MEMORY;
@ -117,7 +140,12 @@ redef record Files::Info += {
event zeek_init() &priority=5 event zeek_init() &priority=5
{ {
Log::create_stream(X509::LOG, [$columns=Info, $ev=log_x509, $path="x509", $policy=log_policy]); # x509 can have some very large certificates and very large sets of URIs. Expand the log size filters
# so that we're not truncating those.
Log::create_stream(X509::LOG, Log::Stream($columns=Info, $ev=log_x509, $path="x509", $policy=log_policy,
$max_field_string_bytes=X509::default_max_field_string_bytes,
$max_field_container_elements=X509::default_max_field_container_elements,
$max_total_container_elements=X509::default_max_total_container_elements));
# We use MIME types internally to distinguish between user and CA certificates. # We use MIME types internally to distinguish between user and CA certificates.
# The first certificate in a connection always gets tagged as user-cert, all # The first certificate in a connection always gets tagged as user-cert, all
@ -167,7 +195,7 @@ event x509_certificate(f: fa_file, cert_ref: opaque of x509, cert: X509::Certifi
{ {
local der_cert = x509_get_certificate_string(cert_ref); local der_cert = x509_get_certificate_string(cert_ref);
local fp = hash_function(der_cert); local fp = hash_function(der_cert);
f$info$x509 = [$ts=f$info$ts, $fingerprint=fp, $certificate=cert, $handle=cert_ref]; f$info$x509 = X509::Info($ts=f$info$ts, $fingerprint=fp, $certificate=cert, $handle=cert_ref);
if ( f$info$mime_type == "application/x-x509-user-cert" ) if ( f$info$mime_type == "application/x-x509-user-cert" )
f$info$x509$host_cert = T; f$info$x509$host_cert = T;
if ( f$is_orig ) if ( f$is_orig )
@ -225,4 +253,3 @@ event file_state_remove(f: fa_file) &priority=5
Log::write(LOG, f$info$x509); Log::write(LOG, f$info$x509);
} }

View file

@ -1,61 +1,33 @@
##! Activates port-independent protocol detection and selectively disables ##! Disables analyzers if protocol violations occur, and adds service information
##! analyzers if protocol violations occur. ##! to connection log.
@load ./main
module DPD; module DPD;
export { export {
## Add the DPD logging stream identifier. ## Analyzers which you don't want to remove on violations.
redef enum Log::ID += { LOG };
## A default logging policy hook for the stream.
global log_policy: Log::PolicyHook;
## The record type defining the columns to log in the DPD logging stream.
type Info: record {
## Timestamp for when protocol analysis failed.
ts: time &log;
## Connection unique ID.
uid: string &log;
## Connection ID containing the 4-tuple which identifies endpoints.
id: conn_id &log;
## Transport protocol for the violation.
proto: transport_proto &log;
## The analyzer that generated the violation.
analyzer: string &log;
## The textual reason for the analysis failure.
failure_reason: string &log;
};
## Ongoing DPD state tracking information.
type State: record {
## Current number of protocol violations seen per analyzer instance.
violations: table[count] of count;
};
## Number of protocol violations to tolerate before disabling an analyzer.
option max_violations: table[Analyzer::Tag] of count = table() &default = 5;
## Analyzers which you don't want to throw
option ignore_violations: set[Analyzer::Tag] = set(); option ignore_violations: set[Analyzer::Tag] = set();
## Ignore violations which go this many bytes into the connection. ## Ignore violations which go this many bytes into the connection.
## Set to 0 to never ignore protocol violations. ## Set to 0 to never ignore protocol violations.
option ignore_violations_after = 10 * 1024; option ignore_violations_after = 10 * 1024;
## Change behavior of service field in conn.log:
## Failed services are no longer removed. Instead, for a failed
## service, a second entry with a "-" in front of it is added.
## E.g. a http connection with a violation would be logged as
## "http,-http".
option track_removed_services_in_connection = F;
} }
redef record connection += { redef record connection += {
dpd: Info &optional; ## The set of prototol analyzers that were removed due to a protocol
dpd_state: State &optional; ## violation after the same analyzer had previously been confirmed.
## The set of services (analyzers) for which Zeek has observed a failed_analyzers: set[string] &default=set() &ordered;
## violation after the same service had previously been confirmed.
service_violation: set[string] &default=set();
}; };
event zeek_init() &priority=5 # Add confirmed protocol analyzers to conn.log service field
{
Log::create_stream(DPD::LOG, [$columns=Info, $path="dpd", $policy=log_policy]);
}
event analyzer_confirmation_info(atype: AllAnalyzers::Tag, info: AnalyzerConfirmationInfo) &priority=10 event analyzer_confirmation_info(atype: AllAnalyzers::Tag, info: AnalyzerConfirmationInfo) &priority=10
{ {
if ( ! is_protocol_analyzer(atype) && ! is_packet_analyzer(atype) ) if ( ! is_protocol_analyzer(atype) && ! is_packet_analyzer(atype) )
@ -69,9 +41,11 @@ event analyzer_confirmation_info(atype: AllAnalyzers::Tag, info: AnalyzerConfirm
add c$service[analyzer]; add c$service[analyzer];
} }
event analyzer_violation_info(atype: AllAnalyzers::Tag, info: AnalyzerViolationInfo) &priority=10 # Remove failed analyzers from service field and add them to c$failed_analyzers
# Low priority to allow other handlers to check if the analyzer was confirmed
event analyzer_failed(ts: time, atype: AllAnalyzers::Tag, info: AnalyzerViolationInfo) &priority=-5
{ {
if ( ! is_protocol_analyzer(atype) && ! is_packet_analyzer(atype) ) if ( ! is_protocol_analyzer(atype) )
return; return;
if ( ! info?$c ) if ( ! info?$c )
@ -79,38 +53,32 @@ event analyzer_violation_info(atype: AllAnalyzers::Tag, info: AnalyzerViolationI
local c = info$c; local c = info$c;
local analyzer = Analyzer::name(atype); local analyzer = Analyzer::name(atype);
# If the service hasn't been confirmed yet, don't generate a log message # If the service hasn't been confirmed yet, or already failed,
# for the protocol violation. # don't generate a log message for the protocol violation.
if ( analyzer !in c$service ) if ( analyzer !in c$service )
return; return;
# If removed service tracking is active, don't delete the service here.
if ( ! track_removed_services_in_connection )
delete c$service[analyzer]; delete c$service[analyzer];
add c$service_violation[analyzer];
local dpd: Info; # if statement is separate, to allow repeated removal of service, in case there are several
dpd$ts = network_time(); # confirmation and violation events
dpd$uid = c$uid; if ( analyzer !in c$failed_analyzers )
dpd$id = c$id; add c$failed_analyzers[analyzer];
dpd$proto = get_port_transport_proto(c$id$orig_p);
dpd$analyzer = analyzer;
# Encode data into the reason if there's any as done for the old # add "-service" to the list of services on removal due to violation, if analyzer was confirmed before
# analyzer_violation event, previously. if ( track_removed_services_in_connection && Analyzer::name(atype) in c$service )
local reason = info$reason;
if ( info?$data )
{ {
local ellipsis = |info$data| > 40 ? "..." : ""; local rname = cat("-", Analyzer::name(atype));
local data = info$data[0:40]; if ( rname !in c$service )
reason = fmt("%s [%s%s]", reason, data, ellipsis); add c$service[rname];
} }
dpd$failure_reason = reason;
c$dpd = dpd;
} }
event analyzer_violation_info(atype: AllAnalyzers::Tag, info: AnalyzerViolationInfo ) &priority=5 event analyzer_violation_info(atype: AllAnalyzers::Tag, info: AnalyzerViolationInfo ) &priority=5
{ {
if ( ! is_protocol_analyzer(atype) && ! is_packet_analyzer(atype) ) if ( ! is_protocol_analyzer(atype) )
return; return;
if ( ! info?$c || ! info?$aid ) if ( ! info?$c || ! info?$aid )
@ -125,37 +93,17 @@ event analyzer_violation_info(atype: AllAnalyzers::Tag, info: AnalyzerViolationI
if ( ignore_violations_after > 0 && size > ignore_violations_after ) if ( ignore_violations_after > 0 && size > ignore_violations_after )
return; return;
if ( ! c?$dpd_state ) # analyzer already was removed or connection finished
# let's still log this.
if ( lookup_connection_analyzer_id(c$id, atype) == 0 )
{ {
local s: State; event analyzer_failed(network_time(), atype, info);
c$dpd_state = s;
}
if ( aid in c$dpd_state$violations )
++c$dpd_state$violations[aid];
else
c$dpd_state$violations[aid] = 1;
if ( c?$dpd || c$dpd_state$violations[aid] > max_violations[atype] )
{
# Disable an analyzer we've previously confirmed, but is now in
# violation, or else any analyzer in excess of the max allowed
# violations, regardless of whether it was previously confirmed.
disable_analyzer(c$id, aid, F);
}
}
event analyzer_violation_info(atype: AllAnalyzers::Tag, info: AnalyzerViolationInfo ) &priority=-5
{
if ( ! is_protocol_analyzer(atype) && ! is_packet_analyzer(atype) )
return; return;
if ( ! info?$c )
return;
if ( info$c?$dpd )
{
Log::write(DPD::LOG, info$c$dpd);
delete info$c$dpd;
} }
local disabled = disable_analyzer(c$id, aid, F);
# If analyzer was disabled, send failed event
if ( disabled )
event analyzer_failed(network_time(), atype, info);
} }

View file

@ -1,8 +1,6 @@
##! Logging analyzer confirmations and violations into analyzer.log ##! Logging analyzer violations into analyzer.log
@load base/frameworks/config
@load base/frameworks/logging @load base/frameworks/logging
@load ./main @load ./main
module Analyzer::Logging; module Analyzer::Logging;
@ -11,16 +9,10 @@ export {
## Add the analyzer logging stream identifier. ## Add the analyzer logging stream identifier.
redef enum Log::ID += { LOG }; redef enum Log::ID += { LOG };
## A default logging policy hook for the stream.
global log_policy: Log::PolicyHook;
## The record type defining the columns to log in the analyzer logging stream. ## The record type defining the columns to log in the analyzer logging stream.
type Info: record { type Info: record {
## Timestamp of confirmation or violation. ## Timestamp of the violation.
ts: time &log; ts: time &log;
## What caused this log entry to be produced. This can
## currently be "violation" or "confirmation".
cause: string &log;
## The kind of analyzer involved. Currently "packet", "file" ## The kind of analyzer involved. Currently "packet", "file"
## or "protocol". ## or "protocol".
analyzer_kind: string &log; analyzer_kind: string &log;
@ -31,117 +23,58 @@ export {
uid: string &log &optional; uid: string &log &optional;
## File UID if available. ## File UID if available.
fuid: string &log &optional; fuid: string &log &optional;
## Connection identifier if available ## Connection identifier if available.
id: conn_id &log &optional; id: conn_id &log &optional;
## Transport protocol for the violation, if available.
proto: transport_proto &log &optional;
## Failure or violation reason, if available. ## Failure or violation reason, if available.
failure_reason: string &log &optional; failure_reason: string &log;
## Data causing failure or violation if available. Truncated ## Data causing failure or violation if available. Truncated
## to :zeek:see:`Analyzer::Logging::failure_data_max_size`. ## to :zeek:see:`Analyzer::Logging::failure_data_max_size`.
failure_data: string &log &optional; failure_data: string &log &optional;
}; };
## Enable logging of analyzer violations and optionally confirmations
## when :zeek:see:`Analyzer::Logging::include_confirmations` is set.
option enable = T;
## Enable analyzer_confirmation. They are usually less interesting
## outside of development of analyzers or troubleshooting scenarios.
## Setting this option may also generated multiple log entries per
## connection, minimally one for each conn.log entry with a populated
## service field.
option include_confirmations = F;
## Enable tracking of analyzers getting disabled. This is mostly
## interesting for troubleshooting of analyzers in DPD scenarios.
## Setting this option may also generated multiple log entries per
## connection.
option include_disabling = F;
## If a violation contains information about the data causing it, ## If a violation contains information about the data causing it,
## include at most this many bytes of it in the log. ## include at most this many bytes of it in the log.
option failure_data_max_size = 40; option failure_data_max_size = 40;
## Set of analyzers for which to not log confirmations or violations. ## An event that can be handled to access the :zeek:type:`Analyzer::Logging::Info`
option ignore_analyzers: set[AllAnalyzers::Tag] = set(); ## record as it is sent on to the logging framework.
} global log_analyzer: event(rec: Info);
## A default logging policy hook for the stream.
global log_policy: Log::PolicyHook;
}
event zeek_init() &priority=5 event zeek_init() &priority=5
{ {
Log::create_stream(LOG, [$columns=Info, $path="analyzer", $policy=log_policy, Log::create_stream(LOG, Log::Stream($columns=Info, $path="analyzer", $ev=log_analyzer, $policy=log_policy));
$event_groups=set("Analyzer::Logging")]);
local enable_handler = function(id: string, new_value: bool): bool {
if ( new_value )
Log::enable_stream(LOG);
else
Log::disable_stream(LOG);
return new_value;
};
Option::set_change_handler("Analyzer::Logging::enable", enable_handler);
local include_confirmations_handler = function(id: string, new_value: bool): bool {
if ( new_value )
enable_event_group("Analyzer::Logging::include_confirmations");
else
disable_event_group("Analyzer::Logging::include_confirmations");
return new_value;
};
Option::set_change_handler("Analyzer::Logging::include_confirmations",
include_confirmations_handler);
local include_disabling_handler = function(id: string, new_value: bool): bool {
if ( new_value )
enable_event_group("Analyzer::Logging::include_disabling");
else
disable_event_group("Analyzer::Logging::include_disabling");
return new_value;
};
Option::set_change_handler("Analyzer::Logging::include_disabling",
include_disabling_handler);
# Call the handlers directly with the current values to avoid config
# framework interactions like creating entries in config.log.
enable_handler("Analyzer::Logging::enable", Analyzer::Logging::enable);
include_confirmations_handler("Analyzer::Logging::include_confirmations",
Analyzer::Logging::include_confirmations);
include_disabling_handler("Analyzer::Logging::include_disabling",
Analyzer::Logging::include_disabling);
} }
function analyzer_kind(atype: AllAnalyzers::Tag): string function log_analyzer_failure(ts: time, atype: AllAnalyzers::Tag, info: AnalyzerViolationInfo)
{ {
if ( is_protocol_analyzer(atype) ) local rec = Info(
return "protocol"; $ts=ts,
else if ( is_packet_analyzer(atype) ) $analyzer_kind=Analyzer::kind(atype),
return "packet"; $analyzer_name=Analyzer::name(atype),
else if ( is_file_analyzer(atype) ) $failure_reason=info$reason
return "file"; );
Reporter::warning(fmt("Unknown kind of analyzer %s", atype)); if ( info?$c )
return "unknown"; {
rec$id = info$c$id;
rec$uid = info$c$uid;
rec$proto = get_port_transport_proto(info$c$id$orig_p);
} }
function populate_from_conn(rec: Info, c: connection) if ( info?$f )
{ {
rec$id = c$id; rec$fuid = info$f$id;
rec$uid = c$uid;
}
function populate_from_file(rec: Info, f: fa_file)
{
rec$fuid = f$id;
# If the confirmation didn't have a connection, but the # If the confirmation didn't have a connection, but the
# fa_file object has exactly one, use it. # fa_file object has exactly one, use it.
if ( ! rec?$uid && f?$conns && |f$conns| == 1 ) if ( ! rec?$uid && info$f?$conns && |info$f$conns| == 1 )
{ {
for ( _, c in f$conns ) for ( _, c in info$f$conns )
{ {
rec$id = c$id; rec$id = c$id;
rec$uid = c$uid; rec$uid = c$uid;
@ -149,46 +82,6 @@ function populate_from_file(rec: Info, f: fa_file)
} }
} }
event analyzer_confirmation_info(atype: AllAnalyzers::Tag, info: AnalyzerConfirmationInfo) &group="Analyzer::Logging::include_confirmations"
{
if ( atype in ignore_analyzers )
return;
local rec = Info(
$ts=network_time(),
$cause="confirmation",
$analyzer_kind=analyzer_kind(atype),
$analyzer_name=Analyzer::name(atype),
);
if ( info?$c )
populate_from_conn(rec, info$c);
if ( info?$f )
populate_from_file(rec, info$f);
Log::write(LOG, rec);
}
event analyzer_violation_info(atype: AllAnalyzers::Tag, info: AnalyzerViolationInfo) &priority=6
{
if ( atype in ignore_analyzers )
return;
local rec = Info(
$ts=network_time(),
$cause="violation",
$analyzer_kind=analyzer_kind(atype),
$analyzer_name=Analyzer::name(atype),
$failure_reason=info$reason,
);
if ( info?$c )
populate_from_conn(rec, info$c);
if ( info?$f )
populate_from_file(rec, info$f);
if ( info?$data ) if ( info?$data )
{ {
if ( failure_data_max_size > 0 ) if ( failure_data_max_size > 0 )
@ -200,24 +93,31 @@ event analyzer_violation_info(atype: AllAnalyzers::Tag, info: AnalyzerViolationI
Log::write(LOG, rec); Log::write(LOG, rec);
} }
hook Analyzer::disabling_analyzer(c: connection, atype: AllAnalyzers::Tag, aid: count) &priority=-1000 &group="Analyzer::Logging::include_disabling" # event currently is only raised for protocol analyzers; we do not fail packet and file analyzers
event analyzer_failed(ts: time, atype: AllAnalyzers::Tag, info: AnalyzerViolationInfo)
{ {
if ( atype in ignore_analyzers ) if ( ! is_protocol_analyzer(atype) )
return; return;
local rec = Info( if ( ! info?$c )
$ts=network_time(), return;
$cause="disabled",
$analyzer_kind=analyzer_kind(atype),
$analyzer_name=Analyzer::name(atype),
);
populate_from_conn(rec, c); # log only for previously confirmed service that did not already log violation
# note that analyzers can fail repeatedly in some circumstances - e.g. when they
# are re-attached by the dynamic protocol detection due to later data.
local analyzer_name = Analyzer::name(atype);
if ( analyzer_name !in info$c$service || analyzer_name in info$c$failed_analyzers )
return;
if ( c?$dpd_state && aid in c$dpd_state$violations ) log_analyzer_failure(ts, atype, info);
}
# log packet and file analyzers here separately
event analyzer_violation_info(atype: AllAnalyzers::Tag, info: AnalyzerViolationInfo )
{ {
rec$failure_data = fmt("Disabled after %d violations", c$dpd_state$violations[aid]); if ( is_protocol_analyzer(atype) )
return;
log_analyzer_failure(network_time(), atype, info);
} }
Log::write(LOG, rec);
}

View file

@ -88,6 +88,15 @@ export {
## Returns: The analyzer name corresponding to the tag. ## Returns: The analyzer name corresponding to the tag.
global name: function(tag: Analyzer::Tag) : string; global name: function(tag: Analyzer::Tag) : string;
## Translates an analyzer type to a string with the analyzer's type.
##
## Possible values are "protocol", "packet", "file", or "unknown".
##
## tag: The analyzer tag.
##
## Returns: The analyzer kind corresponding to the tag.
global kind: function(tag: Analyzer::Tag) : string;
## Check whether the given analyzer name exists. ## Check whether the given analyzer name exists.
## ##
## This can be used before calling :zeek:see:`Analyzer::get_tag` to ## This can be used before calling :zeek:see:`Analyzer::get_tag` to
@ -100,6 +109,10 @@ export {
## Translates an analyzer's name to a tag enum value. ## Translates an analyzer's name to a tag enum value.
## ##
## The analyzer is assumed to exist; call
## :zeek:see:`Analyzer::has_tag` first to verify that name is a
## valid analyzer name.
##
## name: The analyzer name. ## name: The analyzer name.
## ##
## Returns: The analyzer tag corresponding to the name. ## Returns: The analyzer tag corresponding to the name.
@ -159,6 +172,23 @@ export {
## ##
## This set can be added to via :zeek:see:`redef`. ## This set can be added to via :zeek:see:`redef`.
global requested_analyzers: set[AllAnalyzers::Tag] = {} &redef; global requested_analyzers: set[AllAnalyzers::Tag] = {} &redef;
## Event that is raised when an analyzer raised a service violation and was
## removed.
##
## The event is also raised if the analyzer already was no longer active by
## the time that the violation was handled - so if it happens at the very
## end of a connection.
##
## Currently this event is only raised for protocol analyzers, as packet
## and file analyzers are never actively removed/disabled.
##
## ts: time at which the violation occurred
##
## atype: atype: The analyzer tag, such as ``Analyzer::ANALYZER_HTTP``.
##
##info: Details about the violation. This record should include a :zeek:type:`connection`
global analyzer_failed: event(ts: time, atype: AllAnalyzers::Tag, info: AnalyzerViolationInfo);
} }
@load base/bif/analyzer.bif @load base/bif/analyzer.bif
@ -242,6 +272,19 @@ function name(atype: AllAnalyzers::Tag) : string
return __name(atype); return __name(atype);
} }
function kind(atype: AllAnalyzers::Tag): string
{
if ( is_protocol_analyzer(atype) )
return "protocol";
else if ( is_packet_analyzer(atype) )
return "packet";
else if ( is_file_analyzer(atype) )
return "file";
Reporter::warning(fmt("Unknown kind of analyzer %s", atype));
return "unknown";
}
function has_tag(name: string): bool function has_tag(name: string): bool
{ {
return __has_tag(name); return __has_tag(name);

View file

@ -1,3 +1,4 @@
@load ./main @load ./main
@load ./store @load ./store
@load ./log @load ./log
@load ./backpressure

View file

@ -0,0 +1,31 @@
##! This handles Broker peers that fall so far behind in handling messages that
##! this node sends it that the local Broker endpoint decides to unpeer them.
##! Zeek captures this as follows:
##!
##! - In broker.log, with a regular "peer-removed" entry indicating CAF's reason.
##! - Via eventing through :zeek:see:`Broker::peer_removed` as done in this script.
##!
##! The cluster framework additionally captures the unpeering as follows:
##!
##! - In cluster.log, with a higher-level message indicating the node names involved.
##! - Via telemetry, using a labeled counter.
event Broker::peer_removed(ep: Broker::EndpointInfo, msg: string)
{
if ( "caf::sec::backpressure_overflow" !in msg ) {
return;
}
if ( ! ep?$network ) {
Reporter::error(fmt("Missing network info to re-peer with %s", ep$id));
return;
}
# Re-establish the peering. Broker will periodically re-try connecting
# as necessary. Do this only if the local node originally established
# the peering, otherwise we would connect to an ephemeral client-side
# TCP port that doesn't listen. If we didn't originally establish the
# peering, the other side will retry anyway.
if ( Broker::is_outbound_peering(ep$network$address, ep$network$bound_port) )
Broker::peer(ep$network$address, ep$network$bound_port);
}

View file

@ -14,7 +14,19 @@ export {
## An informational status update. ## An informational status update.
STATUS, STATUS,
## An error situation. ## An error situation.
ERROR ERROR,
## Fatal event, normal operation has most likely broken down.
CRITICAL_EVENT,
## Unrecoverable event that imparts at least part of the system.
ERROR_EVENT,
## Unexpected or conspicuous event that may still be recoverable.
WARNING_EVENT,
## Noteworthy event during normal operation.
INFO_EVENT,
## Information that might be relevant for a user to understand system behavior.
VERBOSE_EVENT,
## An event that is relevant only for troubleshooting and debugging.
DEBUG_EVENT,
}; };
## A record type containing the column fields of the Broker log. ## A record type containing the column fields of the Broker log.
@ -35,17 +47,17 @@ export {
event zeek_init() &priority=5 event zeek_init() &priority=5
{ {
Log::create_stream(Broker::LOG, [$columns=Info, $path="broker", $policy=log_policy]); Log::create_stream(Broker::LOG, Log::Stream($columns=Info, $path="broker", $policy=log_policy));
} }
function log_status(ev: string, endpoint: EndpointInfo, msg: string) function log_status(ev: string, endpoint: EndpointInfo, msg: string)
{ {
local r: Info; local r: Info;
r = [$ts = network_time(), r = Broker::Info($ts = network_time(),
$ev = ev, $ev = ev,
$ty = STATUS, $ty = STATUS,
$message = msg]; $message = msg);
if ( endpoint?$network ) if ( endpoint?$network )
r$peer = endpoint$network; r$peer = endpoint$network;
@ -75,11 +87,36 @@ event Broker::error(code: ErrorCode, msg: string)
ev = subst_string(ev, "_", "-"); ev = subst_string(ev, "_", "-");
ev = to_lower(ev); ev = to_lower(ev);
Log::write(Broker::LOG, [$ts = network_time(), Log::write(Broker::LOG, Info($ts = network_time(),
$ev = ev, $ev = ev,
$ty = ERROR, $ty = ERROR,
$message = msg]); $message = msg));
Reporter::error(fmt("Broker error (%s): %s", code, msg)); Reporter::error(fmt("Broker error (%s): %s", code, msg));
} }
event Broker::internal_log_event(lvl: LogSeverityLevel, id: string, description: string)
{
local severity = Broker::CRITICAL_EVENT;
switch lvl {
case Broker::LOG_ERROR:
severity = Broker::ERROR_EVENT;
break;
case Broker::LOG_WARNING:
severity = Broker::WARNING_EVENT;
break;
case Broker::LOG_INFO:
severity = Broker::INFO_EVENT;
break;
case Broker::LOG_VERBOSE:
severity = Broker::VERBOSE_EVENT;
break;
case Broker::LOG_DEBUG:
severity = Broker::DEBUG_EVENT;
break;
}
Log::write(Broker::LOG, Info($ts = network_time(),
$ty = severity,
$ev = id,
$message = description));
}

View file

@ -19,7 +19,7 @@ export {
## use already. Use of the ZEEK_DEFAULT_LISTEN_RETRY environment variable ## use already. Use of the ZEEK_DEFAULT_LISTEN_RETRY environment variable
## (set as a number of seconds) will override this option and also ## (set as a number of seconds) will override this option and also
## any values given to :zeek:see:`Broker::listen`. ## any values given to :zeek:see:`Broker::listen`.
const default_listen_retry = 30sec &redef; const default_listen_retry = 1sec &redef;
## Default address on which to listen. ## Default address on which to listen.
## ##
@ -28,7 +28,7 @@ export {
## Default address on which to listen for WebSocket connections. ## Default address on which to listen for WebSocket connections.
## ##
## .. zeek:see:: Broker::listen_websocket ## .. zeek:see:: Cluster::listen_websocket
const default_listen_address_websocket = getenv("ZEEK_DEFAULT_LISTEN_ADDRESS") &redef; const default_listen_address_websocket = getenv("ZEEK_DEFAULT_LISTEN_ADDRESS") &redef;
## Default interval to retry connecting to a peer if it cannot be made to ## Default interval to retry connecting to a peer if it cannot be made to
@ -36,7 +36,7 @@ export {
## ZEEK_DEFAULT_CONNECT_RETRY environment variable (set as number of ## ZEEK_DEFAULT_CONNECT_RETRY environment variable (set as number of
## seconds) will override this option and also any values given to ## seconds) will override this option and also any values given to
## :zeek:see:`Broker::peer`. ## :zeek:see:`Broker::peer`.
const default_connect_retry = 30sec &redef; const default_connect_retry = 1sec &redef;
## If true, do not use SSL for network connections. By default, SSL will ## If true, do not use SSL for network connections. By default, SSL will
## even be used if no certificates / CAs have been configured. In that case ## even be used if no certificates / CAs have been configured. In that case
@ -69,11 +69,6 @@ export {
## all peers. ## all peers.
const ssl_keyfile = "" &redef; const ssl_keyfile = "" &redef;
## The number of buffered messages at the Broker/CAF layer after which
## a subscriber considers themselves congested (i.e. tune the congestion
## control mechanisms).
const congestion_queue_size = 200 &redef;
## The max number of log entries per log stream to batch together when ## The max number of log entries per log stream to batch together when
## sending log messages to a remote logger. ## sending log messages to a remote logger.
const log_batch_size = 400 &redef; const log_batch_size = 400 &redef;
@ -83,9 +78,31 @@ export {
const log_batch_interval = 1sec &redef; const log_batch_interval = 1sec &redef;
## Max number of threads to use for Broker/CAF functionality. The ## Max number of threads to use for Broker/CAF functionality. The
## ZEEK_BROKER_MAX_THREADS environment variable overrides this setting. ## ``ZEEK_BROKER_MAX_THREADS`` environment variable overrides this setting.
const max_threads = 1 &redef; const max_threads = 1 &redef;
## Max number of items we buffer at most per peer. What action to take when
## the buffer reaches its maximum size is determined by
## :zeek:see:`Broker::peer_overflow_policy`.
const peer_buffer_size = 8192 &redef;
## Configures how Broker responds to peers that cannot keep up with the
## incoming message rate. Available strategies:
## - disconnect: drop the connection to the unresponsive peer
## - drop_newest: replace the newest message in the buffer
## - drop_oldest: removed the olsted message from the buffer, then append
const peer_overflow_policy = "drop_oldest" &redef;
## Same as :zeek:see:`Broker::peer_buffer_size` but for WebSocket clients.
const web_socket_buffer_size = 8192 &redef;
## Same as :zeek:see:`Broker::peer_overflow_policy` but for WebSocket clients.
const web_socket_overflow_policy = "drop_oldest" &redef;
## How frequently Zeek resets some peering/client buffer statistics,
## such as ``max_queued_recently`` in :zeek:see:`BrokerPeeringStats`.
const buffer_stats_reset_interval = 1min &redef;
## The CAF scheduling policy to use. Available options are "sharing" and ## The CAF scheduling policy to use. Available options are "sharing" and
## "stealing". The "sharing" policy uses a single, global work queue along ## "stealing". The "sharing" policy uses a single, global work queue along
## with mutex and condition variable used for accessing it, which may be ## with mutex and condition variable used for accessing it, which may be
@ -158,6 +175,28 @@ export {
## will be sent. ## will be sent.
const log_topic: function(id: Log::ID, path: string): string = default_log_topic &redef; const log_topic: function(id: Log::ID, path: string): string = default_log_topic &redef;
## The possible log event severity levels for Broker.
type LogSeverityLevel: enum {
## Fatal event, normal operation has most likely broken down.
LOG_CRITICAL,
## Unrecoverable event that imparts at least part of the system.
LOG_ERROR,
## Unexpected or conspicuous event that may still be recoverable.
LOG_WARNING,
## Noteworthy event during normal operation.
LOG_INFO,
## Information that might be relevant for a user to understand system behavior.
LOG_VERBOSE,
## An event that is relevant only for troubleshooting and debugging.
LOG_DEBUG,
};
## The log event severity level for the Broker log output.
const log_severity_level = LOG_WARNING &redef;
## Event severity level for also printing the Broker log output to stderr.
const log_stderr_severity_level = LOG_CRITICAL &redef;
type ErrorCode: enum { type ErrorCode: enum {
## The unspecified default error code. ## The unspecified default error code.
UNSPECIFIED = 1, UNSPECIFIED = 1,
@ -167,24 +206,26 @@ export {
PEER_INVALID = 3, PEER_INVALID = 3,
## Remote peer not listening. ## Remote peer not listening.
PEER_UNAVAILABLE = 4, PEER_UNAVAILABLE = 4,
## Remote peer disconnected during the handshake.
PEER_DISCONNECT_DURING_HANDSHAKE = 5,
## A peering request timed out. ## A peering request timed out.
PEER_TIMEOUT = 5, PEER_TIMEOUT = 6,
## Master with given name already exists. ## Master with given name already exists.
MASTER_EXISTS = 6, MASTER_EXISTS = 7,
## Master with given name does not exist. ## Master with given name does not exist.
NO_SUCH_MASTER = 7, NO_SUCH_MASTER = 8,
## The given data store key does not exist. ## The given data store key does not exist.
NO_SUCH_KEY = 8, NO_SUCH_KEY = 9,
## The store operation timed out. ## The store operation timed out.
REQUEST_TIMEOUT = 9, REQUEST_TIMEOUT = 10,
## The operation expected a different type than provided. ## The operation expected a different type than provided.
TYPE_CLASH = 10, TYPE_CLASH = 11,
## The data value cannot be used to carry out the desired operation. ## The data value cannot be used to carry out the desired operation.
INVALID_DATA = 11, INVALID_DATA = 12,
## The storage backend failed to execute the operation. ## The storage backend failed to execute the operation.
BACKEND_FAILURE = 12, BACKEND_FAILURE = 13,
## The storage backend failed to execute the operation. ## The storage backend failed to execute the operation.
STALE_DATA = 13, STALE_DATA = 14,
## Catch-all for a CAF-level problem. ## Catch-all for a CAF-level problem.
CAF_ERROR = 100 CAF_ERROR = 100
}; };
@ -222,6 +263,10 @@ export {
type PeerInfo: record { type PeerInfo: record {
peer: EndpointInfo; peer: EndpointInfo;
status: PeerStatus; status: PeerStatus;
## Whether the local node created the peering, as opposed to a
## remote establishing it by connecting to us.
is_outbound: bool;
}; };
type PeerInfos: vector of PeerInfo; type PeerInfos: vector of PeerInfo;
@ -269,26 +314,6 @@ export {
p: port &default = default_port, p: port &default = default_port,
retry: interval &default = default_listen_retry): port; retry: interval &default = default_listen_retry): port;
## Listen for remote connections using WebSocket.
##
## a: an address string on which to accept connections, e.g.
## "127.0.0.1". An empty string refers to INADDR_ANY.
##
## p: the TCP port to listen on. The value 0 means that the OS should choose
## the next available free port.
##
## retry: If non-zero, retries listening in regular intervals if the port cannot be
## acquired immediately. 0 disables retries. If the
## ZEEK_DEFAULT_LISTEN_RETRY environment variable is set (as number
## of seconds), it overrides any value given here.
##
## Returns: the bound port or 0/? on failure.
##
## .. zeek:see:: Broker::status
global listen_websocket: function(a: string &default = default_listen_address_websocket,
p: port &default = default_port_websocket,
retry: interval &default = default_listen_retry): port;
## Initiate a remote connection. ## Initiate a remote connection.
## ##
## a: an address to connect to, e.g. "localhost" or "127.0.0.1". ## a: an address to connect to, e.g. "localhost" or "127.0.0.1".
@ -325,6 +350,16 @@ export {
## TODO: We do not have a function yet to terminate a connection. ## TODO: We do not have a function yet to terminate a connection.
global unpeer: function(a: string, p: port): bool; global unpeer: function(a: string, p: port): bool;
## Whether the local node originally initiated the peering with the
## given endpoint.
##
## a: the address used in previous successful call to :zeek:see:`Broker::peer`.
##
## p: the port used in previous successful call to :zeek:see:`Broker::peer`.
##
## Returns:: True if this node initiated the peering.
global is_outbound_peering: function(a: string, p: port): bool;
## Get a list of all peer connections. ## Get a list of all peer connections.
## ##
## Returns: a list of all peer connections. ## Returns: a list of all peer connections.
@ -335,6 +370,12 @@ export {
## Returns: a unique identifier for the local broker endpoint. ## Returns: a unique identifier for the local broker endpoint.
global node_id: function(): string; global node_id: function(): string;
## Obtain each peering's send-buffer statistics. The keys are Broker
## endpoint IDs.
##
## Returns: per-peering statistics.
global peering_stats: function(): table[string] of BrokerPeeringStats;
## Sends all pending log messages to remote peers. This normally ## Sends all pending log messages to remote peers. This normally
## doesn't need to be used except for test cases that are time-sensitive. ## doesn't need to be used except for test cases that are time-sensitive.
global flush_logs: function(): count; global flush_logs: function(): count;
@ -383,29 +424,6 @@ export {
## ##
## Returns: true if a new event forwarding/subscription is now registered. ## Returns: true if a new event forwarding/subscription is now registered.
global forward: function(topic_prefix: string): bool; global forward: function(topic_prefix: string): bool;
## Automatically send an event to any interested peers whenever it is
## locally dispatched. (For example, using "event my_event(...);" in a
## script.)
##
## topic: a topic string associated with the event message.
## Peers advertise interest by registering a subscription to some
## prefix of this topic name.
##
## ev: a Zeek event value.
##
## Returns: true if automatic event sending is now enabled.
global auto_publish: function(topic: string, ev: any): bool;
## Stop automatically sending an event to peers upon local dispatch.
##
## topic: a topic originally given to :zeek:see:`Broker::auto_publish`.
##
## ev: an event originally given to :zeek:see:`Broker::auto_publish`.
##
## Returns: true if automatic events will not occur for the topic/event
## pair.
global auto_unpublish: function(topic: string, ev: any): bool;
} }
@load base/bif/comm.bif @load base/bif/comm.bif
@ -447,29 +465,6 @@ function listen(a: string, p: port, retry: interval): port
return bound; return bound;
} }
event retry_listen_websocket(a: string, p: port, retry: interval)
{
listen_websocket(a, p, retry);
}
function listen_websocket(a: string, p: port, retry: interval): port
{
local bound = __listen(a, p, Broker::WEBSOCKET);
if ( bound == 0/tcp )
{
local e = getenv("ZEEK_DEFAULT_LISTEN_RETRY");
if ( e != "" )
retry = double_to_interval(to_double(e));
if ( retry != 0secs )
schedule retry { retry_listen_websocket(a, p, retry) };
}
return bound;
}
function peer(a: string, p: port, retry: interval): bool function peer(a: string, p: port, retry: interval): bool
{ {
return __peer(a, p, retry); return __peer(a, p, retry);
@ -480,6 +475,11 @@ function unpeer(a: string, p: port): bool
return __unpeer(a, p); return __unpeer(a, p);
} }
function is_outbound_peering(a: string, p: port): bool
{
return __is_outbound_peering(a, p);
}
function peers(): vector of PeerInfo function peers(): vector of PeerInfo
{ {
return __peers(); return __peers();
@ -490,6 +490,11 @@ function node_id(): string
return __node_id(); return __node_id();
} }
function peering_stats(): table[string] of BrokerPeeringStats
{
return __peering_stats();
}
function flush_logs(): count function flush_logs(): count
{ {
return __flush_logs(); return __flush_logs();
@ -514,13 +519,3 @@ function unsubscribe(topic_prefix: string): bool
{ {
return __unsubscribe(topic_prefix); return __unsubscribe(topic_prefix);
} }
function auto_publish(topic: string, ev: any): bool
{
return __auto_publish(topic, ev);
}
function auto_unpublish(topic: string, ev: any): bool
{
return __auto_unpublish(topic, ev);
}

View file

@ -1,6 +1,7 @@
# Load the core cluster support. # Load the core cluster support.
@load ./main @load ./main
@load ./pools @load ./pools
@load ./telemetry
@if ( Cluster::is_enabled() ) @if ( Cluster::is_enabled() )
@ -14,6 +15,12 @@ redef Broker::log_topic = Cluster::rr_log_topic;
# Add a cluster prefix. # Add a cluster prefix.
@prefixes += cluster @prefixes += cluster
# Broker-specific additions:
@if ( Cluster::backend == Cluster::CLUSTER_BACKEND_BROKER )
@load ./broker-backpressure
@load ./broker-telemetry
@endif
@if ( Supervisor::is_supervised() ) @if ( Supervisor::is_supervised() )
# When running a supervised cluster, populate Cluster::nodes from the node table # When running a supervised cluster, populate Cluster::nodes from the node table
# the Supervisor provides to new Zeek nodes. The management framework configures # the Supervisor provides to new Zeek nodes. The management framework configures

View file

@ -0,0 +1,29 @@
# Notifications for Broker-reported backpressure overflow.
# See base/frameworks/broker/backpressure.zeek for context.
@load base/frameworks/telemetry
module Cluster;
global broker_backpressure_disconnects_cf = Telemetry::register_counter_family(Telemetry::MetricOpts(
$prefix="zeek",
$name="broker-backpressure-disconnects",
$unit="",
$label_names=vector("peer"),
$help_text="Number of Broker peerings dropped due to a neighbor falling behind in message I/O",
));
event Broker::peer_removed(endpoint: Broker::EndpointInfo, msg: string)
{
if ( ! endpoint?$network || "caf::sec::backpressure_overflow" !in msg )
return;
local nn = nodeid_to_node(endpoint$id);
Cluster::log(fmt("removed due to backpressure overflow: %s%s:%s (%s)",
nn$name != "" ? "" : "non-cluster peer ",
endpoint$network$address, endpoint$network$bound_port,
nn$name != "" ? nn$name : endpoint$id));
Telemetry::counter_family_inc(broker_backpressure_disconnects_cf,
vector(nn$name != "" ? nn$name : "unknown"));
}

View file

@ -0,0 +1,104 @@
# Additional Broker-specific metrics that use Zeek cluster-level node names.
@load base/frameworks/telemetry
module Cluster;
## This gauge tracks the current number of locally queued messages in each
## Broker peering's send buffer. The "peer" label identifies the remote side of
## the peering, containing a Zeek cluster node name.
global broker_peer_buffer_messages_gf = Telemetry::register_gauge_family(Telemetry::MetricOpts(
$prefix="zeek",
$name="broker-peer-buffer-messages",
$unit="",
$label_names=vector("peer"),
$help_text="Number of messages queued in Broker's send buffers",
));
## This gauge tracks recent maximum queue lengths for each Broker peering's send
## buffer. Most of the time the send buffers are nearly empty, so this gauge
## helps understand recent bursts of messages. "Recent" here means
## :zeek:see:`Broker::buffer_stats_reset_interval`. The time window advances in
## increments of at least the stats interval, not incrementally with every new
## observed message. That is, Zeek keeps a timestamp of when the window started,
## and once it notices that the interval has passed, it moves the start of the
## window to current time.
global broker_peer_buffer_recent_max_messages_gf = Telemetry::register_gauge_family(Telemetry::MetricOpts(
$prefix="zeek",
$name="broker-peer-buffer-recent-max-messages",
$unit="",
$label_names=vector("peer"),
$help_text="Maximum number of messages recently queued in Broker's send buffers",
));
## This counter tracks for each Broker peering the number of times its send
## buffer has overflowed. For the "disconnect" policy this can at most be 1,
## since Broker stops the peering at this time. For the "drop_oldest" and
## "drop_newest" policies (see :zeek:see:`Broker:peer_overflow_policy`) the count
## instead reflects the number of messages lost.
global broker_peer_buffer_overflows_cf = Telemetry::register_counter_family(Telemetry::MetricOpts(
$prefix="zeek",
$name="broker-peer-buffer-overflows",
$unit="",
$label_names=vector("peer"),
$help_text="Number of overflows in Broker's send buffers",
));
# A helper to track overflow counts over past peerings as well as the current
# one. The peer_id field allows us to identify when the counter has reset: a
# Broker ID different from the one on file means it's a new peering.
type EpochData: record {
peer_id: string;
num_overflows: count &default=0;
num_past_overflows: count &default=0;
};
# This maps from a cluster node name to its EpochData.
global peering_epoch_data: table[string] of EpochData;
hook Telemetry::sync()
{
local peers = Broker::peering_stats();
local nn: NamedNode;
local labels: vector of string;
local ed: EpochData;
for ( peer_id, stats in peers )
{
# Translate the Broker IDs to Zeek-level node names. We skip
# telemetry for peers where this mapping fails, i.e. ones for
# connections to external systems.
nn = nodeid_to_node(peer_id);
if ( |nn$name| == 0 )
next;
labels = vector(nn$name);
Telemetry::gauge_family_set(broker_peer_buffer_messages_gf,
labels, stats$num_queued);
Telemetry::gauge_family_set(broker_peer_buffer_recent_max_messages_gf,
labels, stats$max_queued_recently);
if ( nn$name !in peering_epoch_data )
peering_epoch_data[nn$name] = EpochData($peer_id=peer_id);
ed = peering_epoch_data[nn$name];
if ( peer_id != ed$peer_id )
{
# A new peering. Ensure that we account for overflows in
# past ones. There is a risk here that we might have
# missed a peering altogether if we scrape infrequently,
# but re-peering should be a rare event.
ed$peer_id = peer_id;
ed$num_past_overflows += ed$num_overflows;
}
ed$num_overflows = stats$num_overflows;
Telemetry::counter_family_set(broker_peer_buffer_overflows_cf,
labels, ed$num_past_overflows + ed$num_overflows);
}
}

View file

@ -40,10 +40,6 @@ export {
## worker nodes in a cluster. Used with broker-enabled cluster communication. ## worker nodes in a cluster. Used with broker-enabled cluster communication.
const worker_topic = "zeek/cluster/worker" &redef; const worker_topic = "zeek/cluster/worker" &redef;
## The topic name used for exchanging messages that are relevant to
## time machine nodes in a cluster. Used with broker-enabled cluster communication.
const time_machine_topic = "zeek/cluster/time_machine" &redef &deprecated="Remove in v7.1: Unused.";
## A set of topic names to be used for broadcasting messages that are ## A set of topic names to be used for broadcasting messages that are
## relevant to all nodes in a cluster. Currently, there is not a common ## relevant to all nodes in a cluster. Currently, there is not a common
## topic to broadcast to, because enabling implicit Broker forwarding would ## topic to broadcast to, because enabling implicit Broker forwarding would
@ -53,9 +49,6 @@ export {
manager_topic, manager_topic,
proxy_topic, proxy_topic,
worker_topic, worker_topic,
@pragma push ignore-deprecations
time_machine_topic,
@pragma pop ignore-deprecations
}; };
## The topic prefix used for exchanging messages that are relevant to ## The topic prefix used for exchanging messages that are relevant to
@ -82,6 +75,19 @@ export {
## :zeek:see:`Cluster::create_store` with the *persistent* argument set true. ## :zeek:see:`Cluster::create_store` with the *persistent* argument set true.
const default_persistent_backend = Broker::SQLITE &redef; const default_persistent_backend = Broker::SQLITE &redef;
## The default maximum queue size for WebSocket event dispatcher instances.
##
## If the maximum queue size is reached, events from external WebSocket
## clients will be stalled and processed once the queue has been drained.
##
## An internal metric named ``cluster_onloop_queue_stalls`` and
## labeled with a ``WebSocketEventDispatcher:<host>:<port>`` tag
## is incremented when the maximum queue size is reached.
const default_websocket_max_event_queue_size = 32 &redef;
## The default ping interval for WebSocket clients.
const default_websocket_ping_interval = 5 sec &redef;
## Setting a default dir will, for persistent backends that have not ## Setting a default dir will, for persistent backends that have not
## been given an explicit file path via :zeek:see:`Cluster::stores`, ## been given an explicit file path via :zeek:see:`Cluster::stores`,
## automatically create a path within this dir that is based on the name of ## automatically create a path within this dir that is based on the name of
@ -169,10 +175,6 @@ export {
PROXY, PROXY,
## The node type doing all the actual traffic analysis. ## The node type doing all the actual traffic analysis.
WORKER, WORKER,
## A node acting as a traffic recorder using the
## `Time Machine <https://github.com/zeek/time-machine>`_
## software.
TIME_MACHINE &deprecated="Remove in v7.1: Unused.",
}; };
## Record type to indicate a node in a cluster. ## Record type to indicate a node in a cluster.
@ -187,12 +189,8 @@ export {
## The port that this node will listen on for peer connections. ## The port that this node will listen on for peer connections.
## A value of ``0/unknown`` means the node is not pre-configured to listen. ## A value of ``0/unknown`` means the node is not pre-configured to listen.
p: port &default=0/unknown; p: port &default=0/unknown;
## Identifier for the interface a worker is sniffing.
interface: string &optional &deprecated="Remove in v7.1: interface is not required and not set consistently on workers. Replace usages with packet_source() or keep a separate worker-to-interface mapping in a global table.";
## Name of the manager node this node uses. For workers and proxies. ## Name of the manager node this node uses. For workers and proxies.
manager: string &optional; manager: string &optional;
## Name of a time machine node with which this node connects.
time_machine: string &optional &deprecated="Remove in v7.1: Unused.";
## A unique identifier assigned to the node by the broker framework. ## A unique identifier assigned to the node by the broker framework.
## This field is only set while a node is connected. ## This field is only set while a node is connected.
id: string &optional; id: string &optional;
@ -257,10 +255,17 @@ export {
## of the cluster that is started up. ## of the cluster that is started up.
const node = getenv("CLUSTER_NODE") &redef; const node = getenv("CLUSTER_NODE") &redef;
## Function returning this node's identifier.
##
## By default this is :zeek:see:`Broker::node_id`, but can be
## redefined by other cluster backends. This identifier should be
## a short lived identifier that resets when a node is restarted.
global node_id: function(): string = Broker::node_id &redef;
## Interval for retrying failed connections between cluster nodes. ## Interval for retrying failed connections between cluster nodes.
## If set, the ZEEK_DEFAULT_CONNECT_RETRY (given in number of seconds) ## If set, the ZEEK_DEFAULT_CONNECT_RETRY (given in number of seconds)
## environment variable overrides this option. ## environment variable overrides this option.
const retry_interval = 1min &redef; const retry_interval = 1sec &redef;
## When using broker-enabled cluster framework, nodes broadcast this event ## When using broker-enabled cluster framework, nodes broadcast this event
## to exchange their user-defined name along with a string that uniquely ## to exchange their user-defined name along with a string that uniquely
@ -285,7 +290,7 @@ export {
## ##
## Returns: a topic string that may used to send a message exclusively to ## Returns: a topic string that may used to send a message exclusively to
## a given cluster node. ## a given cluster node.
global node_topic: function(name: string): string; global node_topic: function(name: string): string &redef;
## Retrieve the topic associated with a specific node in the cluster. ## Retrieve the topic associated with a specific node in the cluster.
## ##
@ -294,9 +299,126 @@ export {
## ##
## Returns: a topic string that may used to send a message exclusively to ## Returns: a topic string that may used to send a message exclusively to
## a given cluster node. ## a given cluster node.
global nodeid_topic: function(id: string): string; global nodeid_topic: function(id: string): string &redef;
## Retrieve the cluster-level naming of a node based on its node ID,
## a backend-specific identifier.
##
## id: the node ID of a peer.
##
## Returns: the :zeek:see:`Cluster::NamedNode` for the requested node, if
## known, otherwise a "null" instance with an empty name field.
global nodeid_to_node: function(id: string): NamedNode;
## Initialize the cluster backend.
##
## Cluster backends usually invoke this from a :zeek:see:`zeek_init` handler.
##
## Returns: T on success, else F.
global init: function(): bool;
## Subscribe to the given topic.
##
## topic: The topic to subscribe to.
##
## Returns: T on success, else F.
global subscribe: function(topic: string): bool;
## Unsubscribe from the given topic.
##
## topic: The topic to unsubscribe from.
##
## Returns: T on success, else F.
global unsubscribe: function(topic: string): bool;
## An event instance for cluster pub/sub.
##
## See :zeek:see:`Cluster::publish` and :zeek:see:`Cluster::make_event`.
type Event: record {
## The event handler to be invoked on the remote node.
ev: any;
## The arguments for the event.
args: vector of any;
};
## The TLS options for a WebSocket server.
##
## If cert_file and key_file are set, TLS is enabled. If both
## are unset, TLS is disabled. Any other combination is an error.
type WebSocketTLSOptions: record {
## The cert file to use.
cert_file: string &optional;
## The key file to use.
key_file: string &optional;
## Expect peers to send client certificates.
enable_peer_verification: bool &default=F;
## The CA certificate or CA bundle used for peer verification.
## Empty will use the implementations's default when
## ``enable_peer_verification`` is T.
ca_file: string &default="";
## The ciphers to use. Empty will use the implementation's defaults.
ciphers: string &default="";
};
## WebSocket server options to pass to :zeek:see:`Cluster::listen_websocket`.
type WebSocketServerOptions: record {
## The address to listen on, cannot be used together with ``listen_host``.
listen_addr: addr &optional;
## The port the WebSocket server is supposed to listen on.
listen_port: port;
## The maximum event queue size for this server.
max_event_queue_size: count &default=default_websocket_max_event_queue_size;
## Ping interval to use. A WebSocket client not responding to
## the pings will be disconnected. Set to a negative value to
## disable pings. Subsecond intervals are currently not supported.
ping_interval: interval &default=default_websocket_ping_interval;
## The TLS options used for this WebSocket server. By default,
## TLS is disabled. See also :zeek:see:`Cluster::WebSocketTLSOptions`.
tls_options: WebSocketTLSOptions &default=WebSocketTLSOptions();
};
## Start listening on a WebSocket address.
##
## options: The server :zeek:see:`Cluster::WebSocketServerOptions` to use.
##
## Returns: T on success, else F.
global listen_websocket: function(options: WebSocketServerOptions): bool;
## Network information of an endpoint.
type NetworkInfo: record {
## The IP address or hostname where the endpoint listens.
address: string;
## The port where the endpoint is bound to.
bound_port: port;
};
## Information about a WebSocket endpoint.
type EndpointInfo: record {
id: string;
network: NetworkInfo;
## The value of the X-Application-Name HTTP header, if any.
application_name: string &optional;
};
## A hook invoked for every :zeek:see:`Cluster::subscribe` call.
##
## Breaking from this hook has no effect.
##
## topic: The topic string as given to :zeek:see:`Cluster::subscribe`.
global on_subscribe: hook(topic: string);
## A hook invoked for every :zeek:see:`Cluster::subscribe` call.
##
## Breaking from this hook has no effect.
##
## topic: The topic string as given to :zeek:see:`Cluster::subscribe`.
global on_unsubscribe: hook(topic: string);
} }
# Needs declaration of Cluster::Event type.
@load base/bif/cluster.bif
@load base/bif/plugins/Zeek_Cluster_WebSocket.events.bif.zeek
# Track active nodes per type. # Track active nodes per type.
global active_node_ids: table[NodeType] of set[string]; global active_node_ids: table[NodeType] of set[string];
@ -316,7 +438,7 @@ function nodes_with_type(node_type: NodeType): vector of NamedNode
{ return strcmp(n1$name, n2$name); }); { return strcmp(n1$name, n2$name); });
} }
function Cluster::get_node_count(node_type: NodeType): count function get_node_count(node_type: NodeType): count
{ {
local cnt = 0; local cnt = 0;
@ -329,7 +451,7 @@ function Cluster::get_node_count(node_type: NodeType): count
return cnt; return cnt;
} }
function Cluster::get_active_node_count(node_type: NodeType): count function get_active_node_count(node_type: NodeType): count
{ {
return node_type in active_node_ids ? |active_node_ids[node_type]| : 0; return node_type in active_node_ids ? |active_node_ids[node_type]| : 0;
} }
@ -374,6 +496,17 @@ function nodeid_topic(id: string): string
return nodeid_topic_prefix + id + "/"; return nodeid_topic_prefix + id + "/";
} }
function nodeid_to_node(id: string): NamedNode
{
for ( name, n in nodes )
{
if ( n?$id && n$id == id )
return NamedNode($name=name, $node=n);
}
return NamedNode($name="", $node=Node($node_type=NONE, $ip=0.0.0.0));
}
event Cluster::hello(name: string, id: string) &priority=10 event Cluster::hello(name: string, id: string) &priority=10
{ {
if ( name !in nodes ) if ( name !in nodes )
@ -406,7 +539,7 @@ event Broker::peer_added(endpoint: Broker::EndpointInfo, msg: string) &priority=
if ( ! Cluster::is_enabled() ) if ( ! Cluster::is_enabled() )
return; return;
local e = Broker::make_event(Cluster::hello, node, Broker::node_id()); local e = Broker::make_event(Cluster::hello, node, Cluster::node_id());
Broker::publish(nodeid_topic(endpoint$id), e); Broker::publish(nodeid_topic(endpoint$id), e);
} }
@ -416,16 +549,32 @@ event Broker::peer_lost(endpoint: Broker::EndpointInfo, msg: string) &priority=1
{ {
if ( n?$id && n$id == endpoint$id ) if ( n?$id && n$id == endpoint$id )
{ {
Cluster::log(fmt("node down: %s", node_name));
delete n$id;
delete active_node_ids[n$node_type][endpoint$id];
event Cluster::node_down(node_name, endpoint$id); event Cluster::node_down(node_name, endpoint$id);
break; break;
} }
} }
} }
event node_down(name: string, id: string) &priority=10
{
local found = F;
for ( node_name, n in nodes )
{
if ( n?$id && n$id == id )
{
Cluster::log(fmt("node down: %s", node_name));
delete n$id;
delete active_node_ids[n$node_type][id];
found = T;
break;
}
}
if ( ! found )
Reporter::error(fmt("No node found in Cluster::node_down() node:%s id:%s",
name, id));
}
event zeek_init() &priority=5 event zeek_init() &priority=5
{ {
# If a node is given, but it's an unknown name we need to fail. # If a node is given, but it's an unknown name we need to fail.
@ -435,7 +584,7 @@ event zeek_init() &priority=5
terminate(); terminate();
} }
Log::create_stream(Cluster::LOG, [$columns=Info, $path="cluster", $policy=log_policy]); Log::create_stream(Cluster::LOG, Log::Stream($columns=Info, $path="cluster", $policy=log_policy));
} }
function create_store(name: string, persistent: bool &default=F): Cluster::StoreInfo function create_store(name: string, persistent: bool &default=F): Cluster::StoreInfo
@ -517,5 +666,55 @@ function create_store(name: string, persistent: bool &default=F): Cluster::Store
function log(msg: string) function log(msg: string)
{ {
Log::write(Cluster::LOG, [$ts = network_time(), $node = node, $message = msg]); Log::write(Cluster::LOG, Info($ts = network_time(), $node = node, $message = msg));
}
function init(): bool
{
return Cluster::Backend::__init(Cluster::node_id());
}
function subscribe(topic: string): bool
{
return Cluster::__subscribe(topic);
}
function unsubscribe(topic: string): bool
{
return Cluster::__unsubscribe(topic);
}
function listen_websocket(options: WebSocketServerOptions): bool
{
return Cluster::__listen_websocket(options);
}
function format_endpoint_info(ei: EndpointInfo): string
{
local s = fmt("'%s' (%s:%d)", ei$id, ei$network$address, ei$network$bound_port);
if ( ei?$application_name )
s += fmt(" application_name=%s", ei$application_name);
return s;
}
event websocket_client_added(endpoint: EndpointInfo, subscriptions: string_vec)
{
local msg = fmt("WebSocket client %s subscribed to %s",
format_endpoint_info(endpoint), subscriptions);
Cluster::log(msg);
}
event websocket_client_lost(endpoint: EndpointInfo, code: count, reason: string)
{
local msg = fmt("WebSocket client %s gone with code %d%s",
format_endpoint_info(endpoint), code,
|reason| > 0 ? fmt(" and reason '%s'", reason) : "");
Cluster::log(msg);
}
# If a backend reports an error, propagate it via a reporter error message.
event Cluster::Backend::error(tag: string, message: string)
{
local msg = fmt("Cluster::Backend::error: %s (%s)", tag, message);
Reporter::error(msg);
} }

View file

@ -18,6 +18,8 @@ export {
site_id: count; site_id: count;
## Whether the node is currently alive and can receive work. ## Whether the node is currently alive and can receive work.
alive: bool &default=F; alive: bool &default=F;
## The pre-computed result from Cluster::node_topic
topic: string;
}; };
## A pool specification. ## A pool specification.
@ -172,7 +174,7 @@ function hrw_topic(pool: Pool, key: any): string
local site = HashHRW::get_site(pool$hrw_pool, key); local site = HashHRW::get_site(pool$hrw_pool, key);
local pn: PoolNode = site$user_data; local pn: PoolNode = site$user_data;
return Cluster::node_topic(pn$name); return pn$topic;
} }
function rr_topic(pool: Pool, key: string): string function rr_topic(pool: Pool, key: string): string
@ -198,7 +200,7 @@ function rr_topic(pool: Pool, key: string): string
if ( pn$alive ) if ( pn$alive )
{ {
rval = Cluster::node_topic(pn$name); rval = pn$topic;
break; break;
} }
@ -276,7 +278,7 @@ function init_pool_node(pool: Pool, name: string): bool
else else
{ {
local pn = PoolNode($name=name, $alias=alias, $site_id=site_id, local pn = PoolNode($name=name, $alias=alias, $site_id=site_id,
$alive=Cluster::node == name); $alive=Cluster::node == name, $topic=Cluster::node_topic(name));
pool$nodes[name] = pn; pool$nodes[name] = pn;
pool$node_list += pn; pool$node_list += pn;

View file

@ -36,6 +36,8 @@ function connect_peer(node_type: NodeType, node_name: string)
status)); status));
return; return;
} }
Reporter::warning(fmt("connect_peer: node '%s' (%s) not found", node_name, node_type));
} }
function connect_peers_with_type(node_type: NodeType) function connect_peers_with_type(node_type: NodeType)
@ -69,7 +71,7 @@ event zeek_init() &priority=-10
local pool = registered_pools[i]; local pool = registered_pools[i];
if ( node in pool$nodes ) if ( node in pool$nodes )
Broker::subscribe(pool$spec$topic); Cluster::subscribe(pool$spec$topic);
} }
switch ( self$node_type ) { switch ( self$node_type ) {
@ -78,34 +80,47 @@ event zeek_init() &priority=-10
case CONTROL: case CONTROL:
break; break;
case LOGGER: case LOGGER:
Broker::subscribe(Cluster::logger_topic); Cluster::subscribe(Cluster::logger_topic);
Broker::subscribe(Broker::default_log_topic_prefix);
break; break;
case MANAGER: case MANAGER:
Broker::subscribe(Cluster::manager_topic); Cluster::subscribe(Cluster::manager_topic);
if ( Cluster::manager_is_logger )
Broker::subscribe(Broker::default_log_topic_prefix);
break; break;
case PROXY: case PROXY:
Broker::subscribe(Cluster::proxy_topic); Cluster::subscribe(Cluster::proxy_topic);
break; break;
case WORKER: case WORKER:
Broker::subscribe(Cluster::worker_topic); Cluster::subscribe(Cluster::worker_topic);
break; break;
@pragma push ignore-deprecations
case TIME_MACHINE:
Broker::subscribe(Cluster::time_machine_topic);
break;
@pragma pop ignore-deprecations
default: default:
Reporter::error(fmt("Unhandled cluster node type: %s", self$node_type)); Reporter::error(fmt("Unhandled cluster node type: %s", self$node_type));
return; return;
} }
Broker::subscribe(nodeid_topic(Broker::node_id())); Cluster::subscribe(nodeid_topic(Cluster::node_id()));
Broker::subscribe(node_topic(node)); Cluster::subscribe(node_topic(node));
# Listening and connecting to other peers is broker specific,
# short circuit if Zeek is configured with a different
# cluster backend.
#
# In the future, this could move into a policy script, but
# for the time being it's easier for backwards compatibility
# to keep this here.
if ( Cluster::backend != Cluster::CLUSTER_BACKEND_BROKER )
return;
# Logging setup: Anything handling logging additionally subscribes
# to Broker::default_log_topic_prefix.
switch ( self$node_type ) {
case LOGGER:
Cluster::subscribe(Broker::default_log_topic_prefix);
break;
case MANAGER:
if ( Cluster::manager_is_logger )
Cluster::subscribe(Broker::default_log_topic_prefix);
break;
}
if ( self$p != 0/unknown ) if ( self$p != 0/unknown )
{ {
@ -121,11 +136,6 @@ event zeek_init() &priority=-10
case MANAGER: case MANAGER:
connect_peers_with_type(LOGGER); connect_peers_with_type(LOGGER);
@pragma push ignore-deprecations
if ( self?$time_machine )
connect_peer(TIME_MACHINE, self$time_machine);
@pragma pop ignore-deprecations
break; break;
case PROXY: case PROXY:
connect_peers_with_type(LOGGER); connect_peers_with_type(LOGGER);
@ -141,11 +151,6 @@ event zeek_init() &priority=-10
if ( self?$manager ) if ( self?$manager )
connect_peer(MANAGER, self$manager); connect_peer(MANAGER, self$manager);
@pragma push ignore-deprecations
if ( self?$time_machine )
connect_peer(TIME_MACHINE, self$time_machine);
@pragma pop ignore-deprecations
break; break;
} }
} }

View file

@ -42,11 +42,7 @@ function __init_cluster_nodes(): bool
if ( endp$role in rolemap ) if ( endp$role in rolemap )
typ = rolemap[endp$role]; typ = rolemap[endp$role];
cnode = [$node_type=typ, $ip=endp$host, $p=endp$p]; cnode = Cluster::Node($node_type=typ, $ip=endp$host, $p=endp$p);
@pragma push ignore-deprecations
if ( endp?$interface )
cnode$interface = endp$interface;
@pragma pop ignore-deprecations
if ( |manager_name| > 0 && cnode$node_type != Cluster::MANAGER ) if ( |manager_name| > 0 && cnode$node_type != Cluster::MANAGER )
cnode$manager = manager_name; cnode$manager = manager_name;
if ( endp?$metrics_port ) if ( endp?$metrics_port )

View file

@ -0,0 +1,39 @@
## Module for cluster telemetry.
module Cluster::Telemetry;
export {
type Type: enum {
## Creates counter metrics for incoming and for outgoing
## events without labels.
INFO,
## Creates counter metrics for incoming and outgoing events
## labeled with handler and normalized topic names.
VERBOSE,
## Creates histogram metrics using the serialized message size
## for events, labeled by topic, handler and script location
## (outgoing only).
DEBUG,
};
## The telemetry types to enable for the core backend.
const core_metrics: set[Type] = {
INFO,
} &redef;
## The telemetry types to enable for WebSocket backends.
const websocket_metrics: set[Type] = {
INFO,
} &redef;
## Table used for normalizing topic names that contain random parts.
## Map to an empty string to skip recording a specific metric
## completely.
const topic_normalizations: table[pattern] of string = {
[/^zeek\/cluster\/nodeid\/.*/] = "zeek/cluster/nodeid/__normalized__",
} &ordered &redef;
## For the DEBUG metrics, the histogram buckets to use.
const message_size_bounds: vector of double = {
10.0, 50.0, 100.0, 500.0, 1000.0, 5000.0, 10000.0, 50000.0,
} &redef;
}

View file

@ -40,14 +40,14 @@ event zeek_init() &priority=5
return; return;
for ( fi in config_files ) for ( fi in config_files )
Input::add_table([$reader=Input::READER_CONFIG, Input::add_table(Input::TableDescription($reader=Input::READER_CONFIG,
$mode=Input::REREAD, $mode=Input::REREAD,
$source=fi, $source=fi,
$name=cat("config-", fi), $name=cat("config-", fi),
$idx=ConfigItem, $idx=ConfigItem,
$val=ConfigItem, $val=ConfigItem,
$want_record=F, $want_record=F,
$destination=current_config]); $destination=current_config));
} }
event InputConfig::new_value(name: string, source: string, id: string, value: any) event InputConfig::new_value(name: string, source: string, id: string, value: any)
@ -67,11 +67,11 @@ function read_config(filename: string)
local iname = cat("config-oneshot-", filename); local iname = cat("config-oneshot-", filename);
Input::add_event([$reader=Input::READER_CONFIG, Input::add_event(Input::EventDescription($reader=Input::READER_CONFIG,
$mode=Input::MANUAL, $mode=Input::MANUAL,
$source=filename, $source=filename,
$name=iname, $name=iname,
$fields=EventFields, $fields=EventFields,
$ev=config_line]); $ev=config_line));
Input::remove(iname); Input::remove(iname);
} }

View file

@ -60,7 +60,7 @@ global Config::cluster_set_option: event(ID: string, val: any, location: string)
function broadcast_option(ID: string, val: any, location: string) &is_used function broadcast_option(ID: string, val: any, location: string) &is_used
{ {
for ( topic in Cluster::broadcast_topics ) for ( topic in Cluster::broadcast_topics )
Broker::publish(topic, Config::cluster_set_option, ID, val, location); Cluster::publish(topic, Config::cluster_set_option, ID, val, location);
} }
event Config::cluster_set_option(ID: string, val: any, location: string) event Config::cluster_set_option(ID: string, val: any, location: string)
@ -89,7 +89,7 @@ function set_value(ID: string, val: any, location: string &default = ""): bool
option_cache[ID] = OptionCacheValue($val=val, $location=location); option_cache[ID] = OptionCacheValue($val=val, $location=location);
broadcast_option(ID, val, location); broadcast_option(ID, val, location);
@else @else
Broker::publish(Cluster::manager_topic, Config::cluster_set_option, Cluster::publish(Cluster::manager_topic, Config::cluster_set_option,
ID, val, location); ID, val, location);
@endif @endif
@ -109,7 +109,7 @@ event Cluster::node_up(name: string, id: string) &priority=-10
# When a node connects, send it all current Option values. # When a node connects, send it all current Option values.
if ( name in Cluster::nodes ) if ( name in Cluster::nodes )
for ( ID in option_cache ) for ( ID in option_cache )
Broker::publish(Cluster::node_topic(name), Config::cluster_set_option, ID, option_cache[ID]$val, option_cache[ID]$location); Cluster::publish(Cluster::node_topic(name), Config::cluster_set_option, ID, option_cache[ID]$val, option_cache[ID]$location);
} }
@endif @endif
@ -153,7 +153,7 @@ function config_option_changed(ID: string, new_value: any, location: string): an
event zeek_init() &priority=10 event zeek_init() &priority=10
{ {
Log::create_stream(LOG, [$columns=Info, $ev=log_config, $path="config", $policy=log_policy]); Log::create_stream(LOG, Log::Stream($columns=Info, $ev=log_config, $path="config", $policy=log_policy));
# Limit logging to the manager - everyone else just feeds off it. # Limit logging to the manager - everyone else just feeds off it.
@if ( !Cluster::is_enabled() || Cluster::local_node_type() == Cluster::MANAGER ) @if ( !Cluster::is_enabled() || Cluster::local_node_type() == Cluster::MANAGER )

View file

@ -7,6 +7,7 @@
@load-sigs ./java @load-sigs ./java
@load-sigs ./office @load-sigs ./office
@load-sigs ./programming @load-sigs ./programming
@load-sigs ./python
@load-sigs ./video @load-sigs ./video
@load-sigs ./libmagic @load-sigs ./libmagic

View file

@ -41,66 +41,3 @@ signature file-elc {
file-mime "application/x-elc", 10 file-mime "application/x-elc", 10
file-magic /\x3bELC[\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7\xa8\xa9\xaa\xab\xac\xad\xae\xaf\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7\xe8\xe9\xea\xeb\xec\xed\xee\xef\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff]/ file-magic /\x3bELC[\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7\xa8\xa9\xaa\xab\xac\xad\xae\xaf\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7\xe8\xe9\xea\xeb\xec\xed\xee\xef\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff]/
} }
# Python 1 bytecode
signature file-pyc-1 {
file-magic /^(\xfc\xc4|\x99\x4e)\x0d\x0a/
file-mime "application/x-python-bytecode", 80
}
# Python 2 bytecode
signature file-pyc-2 {
file-magic /^(\x87\xc6|[\x2a\x2d]\xed|[\x3b\x45\x59\x63\x6d\x77\x81\x8b\x8c\x95\x9f\xa9\xb3\xc7\xd1\xdb\xe5\xef\xf9]\xf2|\x03\xf3)\x0d\x0a/
file-mime "application/x-python-bytecode", 80
}
# Python 3.0 bytecode
signature file-pyc-3-0 {
file-magic /^([\xb8\xc2\xcc\xd6\xe0\xea\xf4\xf5\xff]\x0b|[\x09\x13\x1d\x1f\x27\x3b]\x0c)\x0d\x0a/
file-mime "application/x-python-bytecode", 80
}
# Python 3.1 bytecode
signature file-pyc-3-1 {
file-magic /^[\x45\x4f]\x0c\x0d\x0a/
file-mime "application/x-python-bytecode", 80
}
# Python 3.2 bytecode
signature file-pyc-3-2 {
file-magic /^[\x58\x62\x6c]\x0c\x0d\x0a/
file-mime "application/x-python-bytecode", 80
}
# Python 3.3 bytecode
signature file-pyc-3-3 {
file-magic /^[\x76\x80\x94\x9e]\x0c\x0d\x0a/
file-mime "application/x-python-bytecode", 80
}
# Python 3.4 bytecode
signature file-pyc-3-4 {
file-magic /^[\xb2\xcc\xc6\xd0\xda\xe4\xee]\x0c\x0d\x0a/
file-mime "application/x-python-bytecode", 80
}
# Python 3.5 bytecode
signature file-pyc-3-5 {
file-magic /^(\xf8\x0c|[\x02\x0c\x16\x17]\x0d)\x0d\x0a/
file-mime "application/x-python-bytecode", 80
}
# Python 3.6 bytecode
signature file-pyc-3-6 {
file-magic /^[\x20\x21\x2a-\x2d\x2f-\x33]\x0d\x0d\x0a/
file-mime "application/x-python-bytecode", 80
}
# Python 3.7 bytecode
signature file-pyc-3-7 {
file-magic /^[\x3e-\x42]\x0d\x0d\x0a/
file-mime "application/x-python-bytecode", 80
}

Some files were not shown because too many files have changed in this diff Show more