Commit graph

13262 commits

Author SHA1 Message Date
Vern Paxson
e1a760e674 extensive rewrite of generation & execution of run-time initialization 2021-11-07 17:00:19 -08:00
Vern Paxson
bc3bf4ea6c factoring out CPPEscape to be a standalone function 2021-11-07 16:57:52 -08:00
Vern Paxson
14abfc6831 removing unused SubNetType class 2021-11-07 16:56:57 -08:00
Tim Wojtulewicz
f2ea56379b Remove no-op false-teredo test 2021-11-05 15:51:22 -07:00
Florian Wilkens
cc9e38f58b add missing call to EVP_KDF_CTX_set_params 2021-11-05 22:03:29 +01:00
Christian Kreibich
1a6da54aed Update broker submodule [nomail] [skip ci] 2021-11-05 13:40:04 -07:00
Christian Kreibich
4974402be7 Merge branch 'topic/christian/ci-update'
* topic/christian/ci-update:
  Only push CI's Docker images when we're on the main repo
  Add macOS Monterey and drop Catalina in CI
  Add Fedora 35 to CI
2021-11-05 12:50:43 -07:00
Christian Kreibich
c39f33527a Update broker and zeek-archiver submodules [nomail] [skip ci] 2021-11-05 12:49:24 -07:00
Robin Sommer
34eaf42b92 Add new hook HookLoadFileExtended that allows plugins to supply Zeek script code to parse.
The new hooks works similar to the existing `HookLoadFile` but,
additionally, allows the plugin to return a string that contains the
code to be used for the file being loaded. If the plugin does so, the
content of any actual file on disk will be ignored (in fact, there
doesn't even need to be a file on disk in that case). This works for
both Zeek scripts and signatures.

There's a new test that covers the new functionality, testing loading
both scripts and signatures from memory. I also manually tested that the
debugger integration works, but I don't see much of a way to add a
regression test for that part.

We keep the existing hook as well for backwards compatibility. We could
decide to deprecate it, but not sure that buys us much, so left that
out.

Closes #1757.
2021-11-05 13:01:19 +01:00
Robin Sommer
1efaf8d7a4 Move logic to execute HookLoadFile for signatures into rule matcher code.
This (1) fixes an issue where signature files supplied on the command
line wouldn't pass through the hooks, and (2) prepares for allowing
hooks to supply the content of a signature file directly.
2021-11-05 12:58:38 +01:00
Christian Kreibich
f080a814c4 Merge branch 'fix-set-intersection' of github.com:/ynadji/zeek
* 'fix-set-intersection' of github.com:/ynadji/zeek:
  Curse you tabs!
  Remove unused tbl
  Add reverse order intersection check
  Fix C++ Intersection code
  Change set intersection test to be correct
2021-11-04 14:31:41 -07:00
Christian Kreibich
c1ebb279ca Only push CI's Docker images when we're on the main repo 2021-11-03 16:22:10 -07:00
Christian Kreibich
bac833a2f9 Add macOS Monterey and drop Catalina in CI 2021-11-03 16:22:06 -07:00
Christian Kreibich
f7d18eeb9e Add Fedora 35 to CI 2021-11-03 13:40:22 -07:00
Yacin Nadji
cdb52e6460 Curse you tabs! 2021-11-03 15:46:17 -04:00
Yacin Nadji
96c45a6c93 Remove unused tbl 2021-11-03 15:44:55 -04:00
Yacin Nadji
d426e285eb Add reverse order intersection check 2021-11-03 14:52:45 -04:00
Yacin Nadji
aacb812b9a Fix C++ Intersection code 2021-11-03 14:26:31 -04:00
Yacin Nadji
75e584cb73 Change set intersection test to be correct 2021-11-03 14:21:02 -04:00
Tim Wojtulewicz
a23a4c7d66 Merge remote-tracking branch 'origin/topic/timw/693-pcap-append'
* origin/topic/timw/693-pcap-append:
  GH-693: use pcap_dump_open_append where supported
2021-11-03 09:37:10 -07:00
Tim Wojtulewicz
4feb4198c7 Merge branch 'topic/timw/1781-git-blame-ignore-revs'
* topic/timw/1781-git-blame-ignore-revs:
  GH-1781: Add .git-blame-ignore-revs file
2021-11-03 09:35:27 -07:00
Christian Kreibich
4c7aac079f Update doc submodule [nomail] [skip ci] 2021-11-02 21:44:06 -07:00
Tim Wojtulewicz
ceaec09024 GH-693: use pcap_dump_open_append where supported 2021-11-02 17:09:39 -07:00
Tim Wojtulewicz
c2372ca9d8 GH-1781: Add .git-blame-ignore-revs file 2021-11-02 16:06:36 -07:00
Christian Kreibich
c25d5cecb2 Update btest submodule to 0.71 [nomail] [skip ci] 2021-11-01 12:10:39 -07:00
Tim Wojtulewicz
86e5aec477 Merge remote-tracking branch 'origin/topic/timw/myricom-fix'
* origin/topic/timw/myricom-fix:
  Fix issue with broken libpcaps that return repeat packets
2021-11-01 09:20:28 -07:00
Tim Wojtulewicz
b6444dce0c Fix issue with broken libpcaps that return repeat packets
This is apparently a problem with the Myricom version of libpcap, where
instead of returning a null or a zero if no packets are available, it
returns the previous packet. This causes Zeek to improperly parse the
packet and crash. We thought we had fixed this previously with a check
for a null packet but that fix was not enough.
2021-11-01 09:19:55 -07:00
Christian Kreibich
f1c81e3ab9 Update btest submodule to 0.70 [nomail] [skip ci] 2021-10-28 13:18:46 -07:00
Johanna Amann
e14b695497 Accept packets that use tcp segment offloading.
When checksum offloading is enabled, we now forward packets that
have 0 header lengths set - and assume that they have TSO enabled.

If checksum offloading is not enabled, we drop the packets.

Addresses GH-1829
2021-10-28 17:12:54 +02:00
Tim Wojtulewicz
20d1b89caa Merge remote-tracking branch 'origin/topic/timw/clang-format-update'
* origin/topic/timw/clang-format-update:
  Apply some missing clang-format changes
2021-10-21 17:24:02 -07:00
Tim Wojtulewicz
e63ea95664 Apply some missing clang-format changes 2021-10-21 16:38:57 -07:00
zeek-bot
34694e67ea Update doc submodule [nomail] [skip ci] 2021-10-21 00:34:50 +00:00
Tim Wojtulewicz
3621fa943b Merge branch 'topic/timw/trailing-whitespace'
* topic/timw/trailing-whitespace:
  Remove trailing whitespace from script files
2021-10-20 11:13:36 -07:00
Tim Wojtulewicz
a6378531db Remove trailing whitespace from script files 2021-10-20 09:57:09 -07:00
zeek-bot
237a21c3bf Update doc submodule [nomail] [skip ci] 2021-10-20 00:44:09 +00:00
Johanna Amann
fe4e06e8ca TLS decryption: remove payload from ssl_encrypted_data again.
There is no reason to make the payload available in the event - it is
still encrypted.
2021-10-19 17:36:48 +02:00
Johanna Amann
303e84ad86 Merge branch 'master' of https://github.com/FlyingWithJerome/zeek
Merge includes small changes, e.g. fixing the comsumption of remaining
raw data.

* 'master' of https://github.com/FlyingWithJerome/zeek:
  remove excussive fields in dns_svcb_rr
  address code reviews (formatting and type and intrusiveptr)
  newlines at the end of test outputs
  lazy commit
  use tabs in init-bare.zeek
  add svcb test case
  add a dns https test case
  remove test logs
  fix a few syntax errors
  initial commit for SVCB/HTTPS records
2021-10-19 15:03:08 +02:00
Johanna Amann
1b3b9a3cfc Merge branch 'fsync-shadow-files-before-rename' of https://github.com/awelzel/zeek
* 'fsync-shadow-files-before-rename' of https://github.com/awelzel/zeek:
  logging/writers/ascii: shadow files: Add fsync() before rename()
2021-10-15 09:47:08 +01:00
Johanna Amann
eabb6eb743 TLS 1.2 decryption: adapt OpenSSL 3.0 changes for 1.1
Now this should compile and work with both OpenSSL 3 and OpenSSL 1.1.
2021-10-15 09:13:31 +01:00
Tim Wojtulewicz
59013dedcf Fix typo in typedef changes that broke tests on 32-bit Debian 9 2021-10-14 13:09:54 -07:00
Christian Kreibich
5d3568d08d Bump zeek-aux submodule to pull in update-changes tweak [nomail] [skip ci] 2021-10-14 11:57:48 -07:00
Johanna Amann
08c2e45e1a Merge branch 'topic/fwilkens/tls12-decryption' of https://github.com/UHH-ISS/zeek into topic/johanna/tls12-decryption
* 'topic/fwilkens/tls12-decryption' of https://github.com/UHH-ISS/zeek:
  ssl: adapt TLS-PRF to openSSL 3.0
2021-10-14 16:54:25 +01:00
Florian Wilkens
8393868207 ssl: adapt TLS-PRF to openSSL 3.0 2021-10-14 17:45:41 +02:00
Arne Welzel
dc6e21d6ae logging/writers/ascii: shadow files: Add fsync() before rename()
We're using shadow files for log rotation on systems with ext4 running
Linux 4.19. We've observed zero-length shadow files in the logger's working
directory after a power-outage. This leads to a broken/stuck logger
process due to empty shadow files being considered invalid and the
process exiting:

    error: failed to process leftover log 'conn.log.gz': Found leftover log, 'conn.log.gz', but the associated shadow  file, '.shadow.conn.log.gz', required to process it is invalid

PR #1137 introduced atomic renaming of shadow files and was supposed to
handle this. However, after more investigation, the rename() has to be
preceded by an fsync() in order to avoid zero-length files in the presence
of hard-crashes or power-failures. This is generally operating system
and filesystem dependent, but should not hurt to add. The performance impact
can likely be neglected due to the low frequency and limited number of
log streams.

This has happened to others, too. Some references around this issue:

* https://stackoverflow.com/questions/7433057/is-rename-without-fsync-safe
* https://unix.stackexchange.com/questions/464382/which-filesystems-require-fsync-for-crash-safety-when-replacing-an-existing-fi
* https://bugzilla.kernel.org/show_bug.cgi?id=15910

Reproducer

This issue was reproduced artificially on Linux using the sysrq-trigger
functionality to hard-reset the system shortly after a .shadow file was
renamed to it's final destination with the following script watching for
.shadow.conn.log.gz:

    #!/bin/bash
    set -eu
    dir=/data/logger-01/

    # Allow everything via /proc/sysrq-trigger
    echo "1" > /proc/sys/kernel/sysrq

    inotifywait -m -e MOVED_TO --format '%e %w%f' "${dir}" | while read -r line; do
        if echo "${line}" | grep -q '^MOVED_TO .*/.shadow.conn.log.gz$'; then
            echo "RESET: $line"
            sleep 4
            # Trigger a hard-reset without sync/unmount
            echo "b" > /proc/sysrq-trigger
        fi
    done

This quite reliably (4 out of 4 times) yielded a system with zero-length
shadow files and a broken logger after it came back online:

    $ ls -lha /data/logger-01/.shadow.*
    -rw-r--r-- 1 bro bro 0 Oct 14 02:26 .shadow.conn.log.gz
    -rw-r--r-- 1 bro bro 0 Oct 14 02:26 .shadow.dns.log.gz
    -rw-r--r-- 1 bro bro 0 Oct 14 02:26 .shadow.files.log.gz

After this change while running the reproducer, the shadow files always
contained content after a hard-reset.

Rework with util::safe_fsync helper
2021-10-14 15:54:45 +02:00
Johanna Amann
b8b6ac744e Merge remote-tracking branch 'origin/master' into topic/johanna/tls12-decryption 2021-10-13 10:49:29 +01:00
FlyingWithJerome
605d4024e4 remove excussive fields in dns_svcb_rr 2021-10-12 21:40:56 -04:00
FlyingWithJerome
c957e3e91e address code reviews (formatting and type and intrusiveptr) 2021-10-12 20:36:35 -04:00
FlyingWithJerome
ac1ea204fe newlines at the end of test outputs 2021-10-12 17:43:32 -04:00
FlyingWithJerome
b238cf3dca lazy commit 2021-10-12 17:43:32 -04:00
FlyingWithJerome
33c7fd5fba use tabs in init-bare.zeek 2021-10-12 17:43:32 -04:00