Commit graph

143 commits

Author SHA1 Message Date
Robin Sommer
0040111955
Integrate the Spicy plugin into Zeek proper.
This reflects the `spicy-plugin` code as of `d8c296b81cc2a11`.

In addition to moving the code into Zeek's source tree, this comes
with a couple small functional changes:

- `spicyz` no longer tries to infer if it's running from the build
  directory. Instead `ZEEK_SPICY_LIBRARY` can be set to a custom
  location. `zeek-set-path.sh` does that now.

- ZEEK_CONFIG can be set to change what `spicyz -z` print out. This is
  primarily for backwards compatibility.

Some further notes on specifics:

- We raise the minimum Spicy version to 1.8 (i.e., current `main`
  branch).

- Renamed the `compiler/` subdirectory to `spicyz` to avoid
  include-path conflicts with the Spicy headers.

- In `cmake/`, the corresponding PR brings a new/extended version of
  `FindZeek`, which Spicy analyzer packages need. We also now install
  some of the files that the Spicy plugin used to bring for testing,
  so that existing packages keep working.

- For now, this all remains backwards compatible with the current
  `zkg` analyzer templates so that they work with both external and
  integrated Spicy support. Later, once we don't need to support any
  external Spicy plugin versions anymore, we can clean up the
  templates as well.

- All the plugin's tests have moved into the standard test suite. They
  are skipped if configure with `--disable-spicy`.

This holds off on adapting the new code further to Zeek's coding
conventions, so that it remains easier to maintain it in parallel to
the (now legacy) external plugin. We'll make a pass over the
formatting for (presumable) Zeek 6.1.
2023-05-16 10:17:45 +02:00
Tim Wojtulewicz
44b7e91f87 Merge remote-tracking branch 'origin/topic/neverlord/gh-2711'
* origin/topic/neverlord/gh-2711:
  Integrate review feedback
  Include compiler in --show-config output
  Fix CMake option defaults on Windows
  Move build defaults from configure to CMake
2023-05-04 10:56:46 -07:00
Dominik Charousset
7b35d471ad Include compiler in --show-config output 2023-05-02 20:44:48 +02:00
Dominik Charousset
7af3611807 Move build defaults from configure to CMake
Moving the defaults for build variables from the `configure` script to
`CMakeLists.txt` gives the same default behavior on platforms where the
`configure` script is not available (Windows) and also allows a pure
CMake-based work flow (e.g., the standard `cmake -S . -B build`) without
having to manually adjust the defaults.

The `configure` script also becomes much simpler as a result.
2023-04-29 11:04:30 +02:00
Arne Welzel
f0b9c59adb Add experimental JavaScript support when libnode is available
zeek.on('zeek_init', () => {
        console.log('Hello, Zeek!');
    });

For interaction with external systems and HTTP APIs, JavaScript and the
Node.js ecosystem beat Zeek script. Make it more easily accessible by
including ZeekJS with Zeek directly.

When a recent enough libnode version is found on the build system, ZeekJS is
added as a builtin plugin. This behavior can be disabled via
``--disable-javascript``. Linux distributions providing such a package are
Ubuntu (22.10) and Debian (testing/bookworm) as libnode-dev.
Fedora provides it as nodejs-devel.

This plugin takes over loading of .js or .cjs files. When no such files
are provided to Zeek, Node and the V8 engine are not initialized and
should not get into the way.

This should be considered experimental.
2023-04-14 11:26:41 +02:00
Tim Wojtulewicz
4f902c0f39 Add configure option for preallocating PortVal objects 2023-03-15 10:12:32 -07:00
Arne Welzel
bfd182f583 configure: Quote --include-plugins argument
This is allowed and documented to use `;` for separation. The newer
eval functionality then sees that as a command terminator.
2023-03-08 20:57:26 +01:00
Dominik Charousset
c4d5e3cda7 Configure script: drop --with-caf, add -D option 2022-11-05 09:00:13 +01:00
Tim Wojtulewicz
04ba6033c6 Add configure --display-cmake argument 2022-11-02 12:29:47 -07:00
Arne Welzel
0bc7d0905e Include in Jan's AF_PACKET plugin as builtin plugin
This has come up a few times and the motivation is mainly better "first timer"
experience with Zeek. Concretely, if one wants to run a Zeek cluster with
multiple workers and reasonable load balancing on Linux, AF_PACKET is a decent
start. Without AF_PACKET support being built into Zeek, however, a new user's
next experience is that of setting up a development environment in order
to compile an external plugin (think compiler, kernel headers, zkg, ...).
Only to get what could be termed basic functionality.

This is using the ZEEK_INCLUDE_PLUGINS infrastructure. I've used the all
upper case spelling of AF_PACKET in the help output because it seems everyone
else references/writes it like that. I think we should also write it
like that in the docs.
2022-10-13 13:29:27 +02:00
Benjamin Bannier
13d011da66 Use correct variable to pass existing Spicy root to spicy-plugin.
spicy-plugin can find Spicy in paths given by `SPICY_ROOT_DIR` while
`./configure` instead set `SPICY_ROOT`. With this patch we now set the
correct variable.

We also adjust variations of the previous variable name with different
capitalization which caused us to not properly configure spicy-plugin
(which triggers finding Spicy in its given prefix).

Closes #2363.
2022-08-23 09:10:57 +02:00
Tim Wojtulewicz
d3169e48c0 Remove deprecated --enable-mobile-ipv6 configure argument 2022-06-30 17:42:18 +00:00
Christian Kreibich
0be74a0aa8 Provide zeek-client by default
The user so far had to configure with --enable-zeek-client to trigger
installation of the client (from auxil/zeek-client). This flips it around to
allow disabling the installation, and removes --enable-zeek-client from the
Docker build in CI, where we've already been using it to allow the cluster
testsuite to run tests with that image.
2022-06-21 18:17:51 -07:00
Christian Kreibich
9860b5686d Ensure presence of Zeek-related directories in toplevel CMakeLists.txt
This establishes several of the Zeek installation's directories in
CMakeLists.txt, and adds a new ZEEK_STATE_DIR (via `configure --state-dir`) for
arbitrary Zeek-related variable state. It defaults to ZEEK_ROOT/var/lib.

This leaves the existing, zeekctl-related ZEEK_LOCAL_STATE_DIR unchanged and
does not use it. We'll likely deprecate it when removal of zeekctl approaches.
2022-05-23 14:16:59 -07:00
Benjamin Bannier
95aff9a1e3 Include spicy in build. 2022-05-16 09:07:11 +02:00
Tim Wojtulewicz
824bc372c5 Update doc gen VM to ubuntu-latest, output cmake version during configure 2022-04-22 13:10:37 -07:00
Christian Kreibich
e403dd5fe1 Build Gen-ZAM from a submodule and support use of pre-existing executable
This separates Gen-ZAM from the main Zeek distribution and places it in a
submodule at auxil/gen-zam, reflecting binpac and bifcl. Configuring with
--with-gen-zam=... allws reuse of an existing executable.
2022-03-21 15:30:07 -07:00
Tim Wojtulewicz
7a6501296b Restore --disable-zeekctl configure argument 2021-12-08 09:18:54 -07:00
Christian Kreibich
5c44dfbb9e Flip unit tests to being enabled by default
This flips --enable-cpp-tests to --disable-cpp-tests, enabling unit testing by
default. The help output has a minor corresponding tweak as well.
2021-12-06 12:17:22 -08:00
Christian Kreibich
f8b8401d84 Alphabetically sort configure's enable/disable/with options 2021-12-06 12:17:20 -08:00
Benjamin Bannier
1f388e3f40 Format shell scripts with shfmt.
All changes in this patch were performed automatically with `shfmt` with
configuration flags specified in `.pre-commit-config.yaml`.

In addition to fixing whitespace the roundtrip through shfmt's AST also
transforms command substitutions

    `cmd`
    # becomes
    $(cmd)

and some redirects

    >&2 echo "msg"
    # becomes
    echo >&2 "msg"
2021-11-24 23:13:02 +01:00
Christian Kreibich
a6b0fde65f Add zeek-client via new submodule
The new module resides in auxil/zeek-client. It does not get installed unless
one configures with --enable-zeek-client.
2021-07-08 13:12:53 -07:00
Tim Wojtulewicz
b14cd1ef16 GH-1216: Enable Mobile IPv6 support by default
This removes the ENABLE_MOBILE_IPV6 #define variable. It also marks the
--enable-mobile-ipv6 configure argument as deprecated.
2021-06-28 11:11:55 -07:00
Seth Hall
e399b537ca Added --include-plugins configure argument 2021-06-10 10:39:13 -07:00
Johanna Amann
f76a95a2c2 Merge remote-tracking branch 'origin/topic/christian/install-btest-tooling'
* origin/topic/christian/install-btest-tooling:
  Explain zeek-config options in help output
  Sort variables at top of zeek-config alphabetically
  Install Zeek's btest tooling with the distribution
2021-05-10 10:26:59 +01:00
Vlad Grigorescu
4557b0907c Expose a configure-time option to set the plugin path.
I believe that this is the last option presented during the build summary which wasn't available to be set by the user.
2021-03-12 21:22:01 -06:00
Christian Kreibich
463d159bfc Install Zeek's btest tooling with the distribution
This creates $PREFIX/share/btest in the install tree, with the
following folders:

- scripts/ for the canonifiers
- data/ for random.seed
- data/pcaps for the test pcaps

The pcaps can be skipped by configuring with --disable-btest-pcaps.
2021-03-11 13:00:15 -08:00
Jon Siwek
3405b961b9 Remove RocksDB configure script options
Fixes GH-1399
2021-02-11 11:13:17 -08:00
Christian Kreibich
a6e086b662 Install BTest with Zeek
Configuring with --disable-btest skips the installation. The main
reason for doing this is that many Zeek packages come with testsuites
that nearly always require btest, so providing btest out of the box
makes sense. Note that zkg's recent additions to its PATH environment
variable management mean that this btest instance is automatically
found also when the Zeek installation's binary folder isn't in the
path.
2021-01-20 13:52:14 -08:00
Christian Kreibich
d1d218b5cc Install zkg as part of the Zeek distribution.
- Add auxil/package-manager submodule as an optional build
  source. When the submodule is present, zkg gets installed into the
  Zeek installation's bin directory, its config file into etc/zkg, and
  its state into var/lib/zkg. Like zeekctl, zkg finds its own module
  independently of any PYTHONPATH. Installation via pip remains
  supported. You can skip zkg explicitly via --disable-zkg. See the
  NEWS update for details.

- Establish a "zeek/python" subdirectory under libdir as the common place
  for Python modules in the Zeek distribution. This now separates out
  the Broker Python bindings, ZeekControl, and zkg's Python module.

- Add configure flags to allow customizing this Python folder, in
  three ways: --python-dir, --python-prefix, and --python-home. These
  differ in the logic they automatically add to the path, and build on
  the logic already used in Broker.

- Include a (comented-out) @load for zkg's packages folder in
  local.zeek.

- Bump zeekctl to move to this new location.

- Bump doc to include installation instructions

- Update NEWS accordingly.
2020-12-11 18:43:47 -08:00
Dominik Charousset
cf2b5f7e05 Migrate to CAF 0.18 2020-12-07 14:56:19 +01:00
Christian Kreibich
ec76b2510a Improve support for custom libdir locations
- Remove hardwiring of $ZEEK_ROOT/lib throughout the three and
  defaults the name of Zeek's library directory to the default on the
  given platform (e.g. lib64), via GNUInstallDirs.

- Consistently use that lib directory, instead of two lib folders
  resulting when using a custom libdir.

- Remove the old lib directory in the installation prefix, if one exists

- Add --lib_dir to zeek-config (and sort its options a bit).

- Bump submodules for corresponding changes
2020-11-19 23:27:10 -08:00
Jon Siwek
1a4990fc7e Add zeek-archiver tool as submodule
This is added to the default Zeek build as a convenience since it's the
new suggested method for archiving the logs produced by a Supervised
Zeek Cluster.
2020-07-20 16:06:44 -07:00
Jon Siwek
c55bbcfcda Merge remote-tracking branch 'origin/topic/timw/disable-broker-tests'
* origin/topic/timw/disable-broker-tests:
  Disable broker tests from building on the CI
  Disable broker documentation examples if disabling broker tests
2020-05-13 11:16:30 -07:00
Tim Wojtulewicz
63f8897e10 Disable broker documentation examples if disabling broker tests 2020-05-12 12:21:39 -07:00
Jon Siwek
6721685202 Change --enable-fuzzing to --enable-fuzzers
Since it controls whether to build the fuzzer targets, not whether those
fuzzer targets actually use a fuzzing engine.
2020-04-24 11:59:10 -07:00
Jon Siwek
8f1b34b915 Add basic structure for fuzzing targets
General changes:

* Add -D/--deterministic command line option as
  convenience/alternative to -G/--load-seeds (i.e. no file needed, it just
  uses zero-initialized random seeds).  It also changes Broker data
  stores over to using deterministic timing rather than real time.

* Add option to make Reporter abort on runtime scripting errors
2020-04-23 12:51:25 -07:00
Jon Siwek
3c1ad8b962 GH-878: Make RocksDB usage opt-in and add --enable-rocksdb configure flag 2020-03-26 12:18:42 -07:00
Jon Siwek
d33613c2a5 Merge branch 'master' of https://github.com/ffontaine/zeek
- Also removed the setting of BinPAC_ROOT_DIR in the configure
  script's --with-binpac= option as that breaks the cross-compilation
  use-case

* 'master' of https://github.com/ffontaine/zeek:
  CMakeLists.txt: fix cross-compilation with binpac
2020-02-03 13:05:50 -08:00
Tim Wojtulewicz
4fa3e4b9b4 Modify IOSource Manager to implement new loop architecture
- Removes entire FindSoonest method that includes all of the calls to select() for checking for ready sources
- Removes FD_Set checking against IOSources
- Adds system for registering and unregistering file descriptors from IOSources. This allows individual sources to mark themselves as ready to be checked by the loop as they become available.
- Adds entirely new loop architecture based on checking the IOSources for when their next timeout is, and then waiting for either that timeout or when the next source is ready. This also implements the polling based on what the OS supports, instead of just calling select() on all platforms. Currently it supports kqueue, epoll, and plain poll.
- Adds system for pinging the loop to force it to wake up
2020-01-31 10:13:09 -07:00
Jon Siwek
4735165d31 Improve --sanitizers configure option
* Rename SANITIZERS CMake variable to ZEEK_SANITIZERS for clarity

* Use -O1 by default to improve speed (set NO_OPTIMIZATIONS env. var.
  to override and use -O0).  Uses -fno-optimize-sibling-calls with -O1
  to still get "perfect stack traces".

* Updates various sub-projects with sanitizer improvements:
  binpac and bifcl, by default, now ignore leaks reported by LeakSanitizer
  so that it doesn't interfere with the Zeek build
2019-12-30 14:09:26 -08:00
Jon Siwek
17fd371eae Merge remote-tracking branch 'origin/topic/neverlord/doctest'
- Minor whitespace tweaks
- Add line to build summary output for whether unit tests are enabled

* origin/topic/neverlord/doctest:
  Add doctest license and copyright
  Integrate review feedback
  Fix submodule reference for doctest
  Add initial scaffold for unit testing via doctest
2019-11-14 19:17:37 -08:00
Jon Siwek
0e0063335a Merge branch 'topic/simon/configure-fail-hint' of https://github.com/simonhf/zeek
- Adjusted the hint text a bit during merge

* 'topic/simon/configure-fail-hint' of https://github.com/simonhf/zeek:
  Add hint to run make distclean if configure fails
2019-11-14 17:30:06 -08:00
Simon Hardy-Francis
ca41512826 Add hint to run make distclean if configure fails 2019-11-13 15:40:22 -08:00
Dominik Charousset
f6407a4e0f Add initial scaffold for unit testing via doctest 2019-11-12 10:03:49 +01:00
Johanna Amann
f98d4cb9e9 Add --libdir convenience flag to configure.
The flag sets the library installation directory.
2019-10-30 10:42:16 -07:00
Dominik Charousset
e380a12a8b Fix check for cmake commands on POSIX shells 2019-10-21 08:44:46 +02:00
Dominik Charousset
2885f3ead4 Prefer cmake3 command, add --cmake=PATH option 2019-10-19 17:42:00 +02:00
Dominik Charousset
e73bd60d04 Add --build-dir as alias for --builddir
This alias makes it easier for tooling that deals with both Zeek and
Broker (which uses `--build-dir`). Also, it's one less quirk to remember
when working with both repositories.
2019-09-21 11:49:18 +02:00
Jon Siwek
11f90bc9f5 GH-512: add --mandir configure option 2019-08-01 11:26:18 -07:00