Commit graph

4716 commits

Author SHA1 Message Date
Tim Wojtulewicz
9cb6de7447 Add weird for unknown HTTP/0.9 request method 2023-03-10 15:45:11 -07:00
Tim Wojtulewicz
0003495a9b Special case HTTP 0.9 early on
Mostly, treat HTTP0.9 completely separate. Because we're doing raw
delivery of a body directly, fake enough (connection_close=1, and finish
headers manually) so that the MIME infrastructure thinks it is seeing a
body.

This deals better with the body due to accounting for the first line. Also
it avoids the content line analyzer to strip CRLF/LF and the analyzer
then adding CRLF unconditionally by fully bypassing the content line
analyzer.

Concretely, the vlan-mpls test case contains a HTTP response with LF only,
but the previous implementation would use CRLF, accounting for two many bytes.
Same for the http.no-version test which would previously report a body
length of 280 and now is at 323 (which agrees with wireshark).

Further, the mime_type detection for the http-09 test case works because
it's now seeing the full body.

Drawback: We don't extract headers when a server actually replies with
a HTTP/1.1 message, but grrr, something needs to give I guess.
2023-03-10 09:52:34 -07:00
Arne Welzel
2251c67e56 get_dns_stats: Expose total cache size and cached text entries
It wasn't possible from script land to determine the total size
of the cache table held by the DNS_Mgr. Add the total and also
also the TEXT entries count.
2023-03-10 09:22:45 +01:00
Arne Welzel
16bdcd27bd Merge remote-tracking branch 'origin/topic/awelzel/next-break-no-error-but-warning'
* origin/topic/awelzel/next-break-no-error-but-warning:
  ScriptValidation: Make break/next a warning until Zeek 6.1
2023-03-10 09:05:27 +01:00
Johanna Amann
b56b856da9 SSL/TLS: Parse CertificateRequest message
This commit introduces parsing of the CertificateRequest message in the
TLS handshake. It introduces a new event ssl_certificate_request, as
well as a new function parse_distinguished_name, which can be used to
parse part of the ssl_certificate_request event parameters.

This commit also introduces a new policy script, which appends
information about the CAs a TLS server requests in the
CertificateRequest message, if it sends it.
2023-03-09 09:12:29 +01:00
Arne Welzel
1912ba7002 cirrus: Add smoke testing for builtin plugins
This adds two example plugins within testing/builtin-plugins/Files:

* protocol-plugin copied over from testing/btest/plugins/protocol-plugin

* py-lib-plugin that embeds Python to have a dependency on an external
  shared library which was already available in CI and fun to use, too.

Closes #2837
2023-03-08 22:32:29 +01:00
Arne Welzel
c8cdc75f2b Merge remote-tracking branch 'origin/topic/vern/Mar23-script-opt-maint'
* origin/topic/vern/Mar23-script-opt-maint:
  extend BTest "path" canonicalization to include compiled-to-C++ variable names
  use a subclass of TableType for incremental construction of compiled scripts
  script_opt/CPP: errors, recursive type fixes, fix embedded comments
  Fix for EnumVal's returning their underlying value
2023-03-08 10:43:28 +01:00
Vern Paxson
cdcd3f79aa extend BTest "path" canonicalization to include compiled-to-C++ variable names 2023-03-08 10:19:21 +01:00
Vern Paxson
c0dd2b4e81 script_opt/CPP: errors, recursive type fixes, fix embedded comments
better (than nothing) run-time errors for compiled scripts
fixes for dealing with recursive types in compiled scripts
fix for values in compiled scripts containing embedded comment markers
2023-03-08 10:19:17 +01:00
Tim Wojtulewicz
2735109ad7 Update external testing commit hashes for telemetry changes 2023-03-02 13:41:09 -07:00
Tim Wojtulewicz
f6d3ed2395 Default known stores to false to avoid Broker stores 2023-03-02 12:48:53 -07:00
Arne Welzel
56c76e5949 ScriptValidation: Make break/next a warning until Zeek 6.1
The ja3 package uses next instead of return and triggers the new
errors with Zeek 5.2. That seems somewhat bad.

In case we want to do a 5.2.1 that makes this a warning, this
would be change to do so.
2023-03-02 18:46:10 +01:00
Arne Welzel
802d24cad7 Merge remote-tracking branch 'origin/topic/awelzel/try-log-stream-metrics'
* origin/topic/awelzel/try-log-stream-metrics:
  Bump external test suites, filter some telemetry.log entries
  logging/Manager: Remove unused variable
  logging: Add telemetry for streams and log writers
2023-03-02 10:45:54 +01:00
Johanna Amann
989e9c29d2 X.509: expose the signature type inside the tbs certificate
This change exposes the signature tyope inside the signed portion of an
X.509 certificate. In the past, we only exposed the signature type that
is contained inside the signature, which is outside the signed portion
of the X.509 certificate.

In theory, both signature fields should have the same value; it is,
however, possible to encode differing values in both fields. The new
field is not logged by default.
2023-02-28 19:24:16 +00:00
Arne Welzel
bfc2374c8f Bump external test suites, filter some telemetry.log entries 2023-02-27 15:42:18 +01:00
Arne Welzel
69a98e2cbb logging: Add telemetry for streams and log writers
This adds one metric per log stream and one metric per log writer (path based)
to track the number of writes on a stream level as well as on a writer level.

    $ curl -sSf localhost:8181/metrics | grep Conn
    zeek_log_writer_writes_total{endpoint="",filter-name="default",module="HTTP",path="http",stream="HTTP::LOG",writer="Log::WRITER_SQLITE"} 1 1677497572770
    zeek_log_stream_writes_total{endpoint="",module="HTTP",stream="HTTP::LOG"} 1 1677497572770

The initial version of this change also included metrics around log
write vetoes, but given no log policies exist in the default configuration
and they are mostly interesting for a few streams/writers only, skip this
for now. These can always be added by the script writer, too.

The difference between the stream level writes and concrete writers can
be used to deduce the number of vetoes (or errors) as a starting point.
2023-02-27 12:51:03 +01:00
Arne Welzel
3be4712163 tests: Add regression tests for zeek/cmake#61 2023-02-24 19:37:52 +01:00
Arne Welzel
0ddfe69bed tests/bifs-and-scripts-install: Remove unused activate.zeek 2023-02-24 16:14:05 +01:00
Arne Welzel
a693924099 Merge remote-tracking branch 'origin/topic/awelzel/2572-event-handler-stats'
* origin/topic/awelzel/2572-event-handler-stats:
  Bump external baselines
  external/testing-setup: Less telemetry.log volume
  EventHandler: Use telemetry framework for EventHandler.call_count
2023-02-22 12:59:41 +01:00
Arne Welzel
bf693aaaa5 Bump external baselines 2023-02-22 12:27:35 +01:00
Arne Welzel
d9e5cc3078 external/testing-setup: Less telemetry.log volume
For traces spanning a long time period, don't produce immense
amounts of logs. Also filter down the event handler invocation
entries to connection related events in telemetry.log.
2023-02-22 12:10:10 +01:00
Arne Welzel
56a8b99965 EventHandler: Use telemetry framework for EventHandler.call_count
Put the IntCounter into a std::optional rather than initializing
it at EventHandler construction time as that will currently expose
a time series per event handler through the Prometheus API.
2023-02-22 12:10:10 +01:00
Tim Wojtulewicz
18ee3a16ad Merge remote-tracking branch 'origin/topic/awelzel/2777-redef-error-messages'
* origin/topic/awelzel/2777-redef-error-messages:
  parse.y: Improve error reporting of type redef
2023-02-21 16:48:09 -07:00
Arne Welzel
f56785740c ftp: Limit user, password, arg and reply_msg column sizes in log
The user and password fields are replicated to each of the ftp.log
entries. Using a very large username (100s of KBs) allows to bloat
the log without actually sending much traffic. Further, limit the
arg and reply_msg columns to large, but not unbounded values.
2023-02-21 12:28:07 -07:00
Tim Wojtulewicz
8cf1e51623 Add max_size argument for find_all/find_all_ordered BIFs 2023-02-21 12:27:54 -07:00
Arne Welzel
2f4f01d3f5 parse.y: Improve error reporting of type redef
It's happening regularly to me that I forget the type specifier when redef'ing
records or enums and usually it takes me a while to figure out what's going
on as the errors are not descriptive. Improve the error reporting and just
bail as there's no sensible way to continue.

Closes #2777
2023-02-21 11:58:33 +01:00
Tim Wojtulewicz
c30b8f90ef Merge remote-tracking branch 'ekoyle/add-protocol-pbb'
* ekoyle/add-protocol-pbb:
  Update seemingly-unrelated btests
  Use a default analyzer
  Simplify PBB analyzer by using Ethernet analyzer
  Add btest for PBB and update baselines
  Use constexpr instead of #define
  Cleanup and add customer MAC addresses
  Add PBB (802.1ah) support
2023-02-19 19:24:15 -07:00
Benjamin Bannier
328688cb18 Trim diffed output in test spicy.spicy-dump.
We previously would include any and all output from stderr during
compilation in the test baseline. Depending on the used compiler this
output may contain C++ compilation warnings which are uninteresting for
the behavior under test.

(cherry picked from commit 5221edf474)
2023-02-17 09:58:59 -07:00
Arne Welzel
0fd92555d9 Merge remote-tracking branch 'origin/topic/awelzel/propagate-on-change-through-copy'
* origin/topic/awelzel/propagate-on-change-through-copy:
  TableVal: Propagate &on_change attribute through copy()
  testing/btest: Add test showing &expire_func/&create_expire is copied
2023-02-17 17:38:37 +01:00
Arne Welzel
9f16520aa9 Merge remote-tracking branch 'origin/topic/awelzel/2793-propagate-order-through-copy'
* origin/topic/awelzel/2793-propagate-order-through-copy:
  TableVal: Propagate &ordered through copy()
2023-02-17 17:36:19 +01:00
Arne Welzel
ec998dbfb6 Type/is_supported_index_type: Deal with recursive record types
This plugs the issue reported in #2690, there might be more though.

Closes #2690
2023-02-17 17:35:05 +01:00
Arne Welzel
754831d7b0 TableVal: Propagate &ordered through copy()
Copying an &ordered table or set would result in a copy that is not ordered.
This seems rather surprising behavior, so propagate the &ordered attribute.

Closes #2793
2023-02-17 16:28:50 +01:00
Arne Welzel
b2c4f8fd92 TableVal: Propagate &on_change attribute through copy()
Mostly for consistency with &default, &expire_func and other attributes
being propagated through a copy(). Seems this was just missed during
the implementation and/or was never tested for.
2023-02-17 16:21:32 +01:00
Arne Welzel
2b5db43270 testing/btest: Add test showing &expire_func/&create_expire is copied
Does not seem there is a test, but current implementation is that
&expire_func and &create_expire are propagated through copy().
2023-02-17 16:16:06 +01:00
Eldon Koyle
d17329c95b Update seemingly-unrelated btests
For some reason, the plugin order appears to have changed in the files btests.
2023-02-17 08:10:28 -07:00
Eldon Koyle
32afbae9db Use a default analyzer
Use a default analyzer instead of hardcoding a protocol number.
2023-02-16 19:39:27 -07:00
Eldon Koyle
56aa03031d Simplify PBB analyzer by using Ethernet analyzer
After the first 4 bytes, this traffic actually just looks like Ethernet.
Rather than try to re-implement the ethernet analyzer, just check the
length, skip 4 bytes, and pass it on.
2023-02-16 08:19:30 -07:00
Eldon Koyle
1e73716172 Add btest for PBB and update baselines 2023-02-15 14:36:26 -07:00
Christian Kreibich
863a25f5ef Bump external zeek-testing commit hash to bring it up to master 2023-02-14 13:19:24 -08:00
Arne Welzel
3284259561 Add zeek -V/--build-info
This adds a new utility called ci/collect-repo-info.py to produce a JSON
document that is then baked into the Zeek executable file. Further, when
creating a tarball via `make dist`, put a top-level repo-info.json file
in place that is picked when no .git directory exists.

Closes #1405
2023-02-13 12:23:29 +01:00
Tim Wojtulewicz
b3fbfebd6a Merge remote-tracking branch 'origin/topic/vern/ZAM-Feb23-maint'
* origin/topic/vern/ZAM-Feb23-maint:
  better error reporting when ZAM code calls a function
  fix for ZAM compilation of "in" expressions
2023-02-11 22:07:45 -07:00
Vern Paxson
2c9857a618 better error reporting when ZAM code calls a function 2023-02-09 11:24:35 -08:00
Tim Wojtulewicz
3ae135e857 Remove files in build/src/3rdparty from coverage reports 2023-02-09 12:04:53 -07:00
Arne Welzel
b928a7d84d krb/smb2_krb_nokeytab: Register get_file_handle() to avoid warnings
Now that the common event handler logs a warning, ensure there's one
in place, even if it's just returning stub data.
2023-02-06 18:09:11 +01:00
Tim Wojtulewicz
376f13125f Update local-compat test for 6.0 2023-02-03 10:07:55 -07:00
Robin Sommer
bc252c63dc
Add BIF have_spicy_analyzers().
We previously used the Spicy plugin's `Spicy::available` to test for
Spicy support. However, having Spicy support does not necessarily mean that we
have built Zeek with its in-tree Spicy analyzers: the Spicy plugin
could have been pulled in from external. The new BIF now reliably
tells us whether the Spicy analyzers are available; its result
corresponds to what `zeek-config --have-spicy-analyzers` returns as
well.

We also move the two current checks over to use this BIF.

(Note: I refrained from renaming the CMake-side `USE_SPICY_ANALYERS`
to `HAVE_SPICY_ANALYZERS`. We should do this eventually for
consistency, but I didn't want to make more changes than necessary
right now.)
2023-02-03 13:47:26 +01:00
Arne Welzel
4ac65ce8ca btest/decode_base_errors: Avoid binary output in baseline
Zeek prints the input string verbatim to the terminal and that's
upsetting btest just on Alpine.
2023-02-02 18:49:00 +01:00
Arne Welzel
b6df7773a9 Merge remote-tracking branch 'origin/topic/awelzel/arm64-container-follow-ups-2'
* origin/topic/awelzel/arm64-container-follow-ups-2:
  Bump private testsuite for char handling fixes
  Base64: report byte as positive integer
  netbios_decode: use unsigned char for result
  analyzer/http: Do not assume char is signed
  cirrus: Run tests in a Debian 11 container, too
2023-02-02 18:35:02 +01:00
Arne Welzel
bbe0a86d4a Bump private testsuite for char handling fixes 2023-02-02 16:24:41 +01:00
Arne Welzel
5dc54fb40e Base64: report byte as positive integer
A baseline difference between arm64 and x86 showed up. We would
print a wrong character as negative value on x86 due to chars
being signed by default. Force an unsigned interpretation which
is also more reasonable because we'd have never indexed the
base64 table with -112

    -XXXXXXXXXX.XXXXXX      XXXXXXXXXXX     131.243.99.154  3288 193.159.183.138 80      base64_illegal_encoding character -112 ignored by Base64 decoding       F       zeek    -
    +XXXXXXXXXX.XXXXXX      XXXXXXXXXXX     131.243.99.154  3288 193.159.183.138 80      base64_illegal_encoding character 144 ignored by Base64 decoding        F       zeek    -

Fixes more of #2742
2023-02-02 15:49:22 +01:00