Commit graph

17683 commits

Author SHA1 Message Date
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
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
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
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