Commit graph

5155 commits

Author SHA1 Message Date
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
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
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
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
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
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
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
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
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
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
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
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
9b75de4e09 Merge some GLOBAL module sections in init-bare 2025-01-23 11:21:08 -07: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
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
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
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
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
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
Tim Wojtulewicz
0fcbc8546e Update btests for new local-only subnets 2025-01-09 22:16:42 -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
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
Vern Paxson
7a908a2876 Extended ZAM validation to include macros 2025-01-02 15:32:30 -08:00
Benjamin Bannier
4278ab2b04 Bump auxil/spicy to latest development snapshot 2024-12-20 15:18:20 -07:00
Tim Wojtulewicz
eb8f99da92 Require spicy for spicy.analyzer-id btest 2024-12-20 14:25:04 -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
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
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
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
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