Commit Graph

469 Commits (123b36b9f597d479ddb0c78a5f49faa040028de4)

Author SHA1 Message Date
Victor Julien 5c10ea2dc8 version: start development towards 7.0.1 2 years ago
Shivani Bhardwaj 21ec99aa76 release: 7.0.0; update changelog 2 years ago
Jason Ish 401d895b1d configure: set minimum rust version to 1.63.0
Ticket: #4163
2 years ago
Victor Julien 639c5cc4df version: start development towards 7.0.0-rc3 2 years ago
Shivani Bhardwaj da99a69c5b release: 7.0.0-rc2; update changelog 2 years ago
Jason Ish f0885a2a2e install: create runtime data directory
On installation, make sure the data directory is created. This will
usually be /var/lib/suricata/data, but otherwise follows the
autoconf/automake instructions.

This directory is for runtime state information, which for now is
datasets but may be expanded in the future.  Suricata already expects
this directory to exist for "state" and "save" datasets, but it has
been up to the user to create it.
2 years ago
Jason Ish 03442a36ef windows: add -lntdll to Windows builds
Rust 1.70 has introduced some possible issues between LLVM and gcc
causing link errors that are fixed by explicitly adding -lntdll.

Thanks to https://github.com/extendr/rextendr/pull/285 for the fix.
2 years ago
Lukas Sismis fee79ff3c4 dpdk: add linker flag for DPDK Bond library
Header checking (AC_CHECK_HEADER) did not work as
DPDK 19.11 included rte_eth_bond.h file even if net/bonding
driver was disabled. However, it was still not available in
ldconfig configuration. For this reason Bond PMD is checked with
ldconfig tool.
However when installing the DPDK library manually, the user needs to
update the entries in ldconfig to be able to find the Bond PMD.

Ticket: #6099
2 years ago
Eric Leblond 020cfbcd61 profiling: introduce rules profiling
Performance measurement of rules is important on live Suricata
as bad rules can cause severe performance regression. This patch
introduces the --enable-profiling-rules that activate profiling
for the rules. This reduces the performance impact of full
profiling  and provide visiblity on the rules performance at
the same time.
2 years ago
Victor Julien 7dbf8a54f1 configure: spelling 2 years ago
Victor Julien a3c8105ac4 fuzz: spelling: AFLFUZZ_PERSISTENT_MODE 2 years ago
Jason Ish 6f14aed0e6 rust: bundle Cargo.lock
Cargo.lock has to be provided as template, Cargo.lock.in so it can
live beside Cargo.lock in out of tree automake builds, like distcheck.

This will pin Rust dependencies even for git builds, updating
Cargo.lock will now be a manual process that we'll have to take care
of periodically.
2 years ago
Jason Ish 744759b0c9 source-xf-xdp: update for deprecated function in libbpf
libbpf 0.8 deprecates bpf_get_link_xpd_id, and 1.0 removes it. Add
./configure check to see if this method is available and use it if so,
otherwise use the deprecated method which is not available on older
but still supported Linux distributions.

Ticket: #5924
2 years ago
Jason Ish c6c781ef67 config: put version in configuration as a proper value
Adds a new field, "suricata-version" to the configuration file with
the major and minor version of the Suricata that generated the
configuration file.

This may be useful in the future for presenting warnings about
important changes, or even providing different defaults based on what
the user might expect.

Ticket: 5822
2 years ago
Victor Julien 935dedf1e8 version: start development towards 7.0.0-rc2 2 years ago
Shivani Bhardwaj d9e6301af2 release: 7.0.0-rc1; update changelog 2 years ago
Jeff Lucovsky f8474344cd log: Add module and subsystem identifiers to log
Issue: 2497

This changeset provides subsystem and module identifiers in the log when
the log format string contains "%S". By convention, the log format
surrounds "%S" with brackets.

The subsystem name is generally the same as the thread name. The module
name is derived from the source code module name and usually consists of
the first one or 2 segments of the name using the dash character as the
segment delimiter.
2 years ago
Richard McConnell 6e128f48a2 af-xdp: Add AF_XDP socket support
AF_XDP support is a recent technology introduced that aims at improving
capture performance. With this update, Suricata now provides a new
capture source 'af-xdp' that attaches an eBPF program to the network
interface card. Packets received in the NIC queue are forwarded to
a RX ring in user-space, bypassing the Linux network stack.

Note, there is a configuration option (force-xdp-mode) that forces the
packet through the normal Linux network stack.

libxdp and libbpf is required for this feature and is compile time
configured.

This capture source operates on single and multi-queue NIC's via
suricata.yaml. Here, various features can be enabled, disabled
or edited as required by the use case.

This feature currently only supports receiving packets via AF_XDP,
no TX support has been developed.

Ticket: https://redmine.openinfosecfoundation.org/issues/3306

Additional reading:
https://www.kernel.org/doc/html/latest/networking/af_xdp.html
2 years ago
Victor Julien addc9b301d version: require libhtp 0.5.42 2 years ago
Victor Julien c56fa0a805 version: development towards 7.0.0-rc1 2 years ago
Philippe Antoine 41d529fb24 pcre: configurable paths for PCRE2 for include/lib
Ticket: #5572
2 years ago
Philippe Antoine a003640ecf security: prevents process creation
with setrlimit NPROC.

So that, if Suricata wants to execve or such to create a new process
the OS will forbid it so that RCE exploits are more painful to write.

Ticket: #5373
2 years ago
Richard McConnell 88b98a54df suricata: add sd_notify support
Upon all threads reaching a running state the system generates
a notification for systems running and configured for systemd

Implements feature 5384
(https://redmine.openinfosecfoundation.org/issues/5384)
2 years ago
Shivani Bhardwaj 79a78611ad release: 7.0.0-beta1; update changelog 2 years ago
Victor Julien afe4bdca6f rust: compile check rewording 2 years ago
Victor Julien 39cf5b151a src: includes cleanup
Work towards making `suricata-common.h` only introduce system headers
and other things that are independent of complex internal Suricata
data structures.

Update files to compile after this.

Remove special DPDK handling for strlcpy and strlcat, as this caused
many compilation failures w/o including DPDK headers for all files.

Remove packet macros from decode.h and move them into their own file,
turn them into functions and rename them to match our function naming
policy.
2 years ago
Sascha Steinbiss 148b53125b ebpf: update deprecated API calls
This fixes build errors when libbpf 1.0 is used. It removes previously
deprecated API functions that were still in use in Suricata's eBPF
code.
2 years ago
Eric Leblond 485d5a4ea4 landlock: basic implementation
This patch is adding support for Landlock, a Linux
Security Module available since Linux 5.13.

The concept is to prevent any file operation on directories where
Suricata is not supposed to access.

Landlock support is built by default if the header is present. The
feature is disabled by default and need to be activated in the YAML
to be active.

Landlock documentation: https://docs.kernel.org/userspace-api/landlock.html

Feature: #5479
3 years ago
Victor Julien 3eb4fee040 rust: set MSRV to 1.58.1
Ticket: #4163.
3 years ago
Jason Ish 9a1d6af858 python: install without distutils
Instead of using distutils/setuptools for installing the Python code,
just install it into our own Python directory.

Distutils is being removed from Python, and setuptools doesn't work well
when trying to install into your own location. For our usage its just
simpler to install with make.

In addition to removing the configure check for distutils, also remove
the check for pyyaml. This lets the user install pyyaml after Suricata
is installed, and Suricata-Update does handle this case gracefully.

Issue: #5313
3 years ago
Philippe Antoine c6cf61a39b quic: complete parsing of initial for non gquic
The format of initial packet for quic ietf, ie quic v1,
is described in rfc 9000, section 17.2.2

Parse more frames and logs interesting extensions from crypto frame

Do not try to parse encrypted data, ie after we have seen
a crypto frame in each direction.

Use sni from crypto frame with tls for detection already implemented

Ticket: #4967
3 years ago
Sascha Steinbiss af745e4cc4 configure.ac: handle undefined LEVEL1_DCACHE_LINESIZE
On some platforms (riscv64, s390x) this value is "undefined" as returned
from getconf. We also need to handle this to avoid using the string
"undefined" blindly in further #defines.
3 years ago
Victor Julien d56b2455bc libhtp: require 0.5.40
Ticket: #4970.
3 years ago
Victor Julien e9e517534b cbindgen: handle version to stderr change 3 years ago
Juliana Fajardini 67af1504b3 devguide: drop use of mscgen script in builds/make
Currently, it seems easier to upload the diagram images to git than to
try to make the image generation script work with out of the tree builds
and other corner cases.

This means, however, that one must activelly remember to update msc
diagram files, run the script and re-add new png files, if those ever
need to be updated. To raise awareness to that, a watermark was added
to the diagram images.

Also removed configuration steps that added mscgen as dependency
(locally and for workflow builds and readthedocs).
3 years ago
Juliana Fajardini 6f77c722a2 devguide: move into userguide as last chapter
Moved devguide dir into userguide dir.
Since the devguide is now incorporated as the last chapter of the
userguide, removed build and configuration files from the devguide
dir, as these are no longer needed.

Task #4909
3 years ago
Juliana Fajardini d38e294a43 build-info: add info about fuzztargets
We were missing that information from the Development information
3 years ago
Jeff Lucovsky deb49862cd config/debug: Debug probe for getattr_np
This commit adds a probe for a non-portable function to be used in
diagnostic debug display of a thread's stack size.
3 years ago
Jason Ish 2ebb525f7e build: remove configure check for cargo vendor
cargo vendor has been part of the core cargo command since Rust 1.37,
and are minimum Rust version is not 1.41, so remove the check. Its
always available now.
3 years ago
Jason Ish 31ba4fd152 configure: fallback to libpcap on Windows
If npcap/wpcap is not found on Windows, try libpcap. This allows
Suricata to build without NPCap on Windows, however live capture won't
be available.
3 years ago
Jason Ish 9d7a497cc1 rule-path: always use $localstatedir/lib/suricata/rules
Always use the same path for default-rule-path whether or not
Suricata-Update will be installed as part of the Suricata install or
not.

This provides consistency, and maps better to our recommendation that
Suricata-Update be used to manage rules.

Probably should have been done as part of
55852d0de3.

Ticket #4912.
3 years ago
Jason Ish 2ffe88c1f0 rust: remove feature function-macro
The function macro existed so it would only be enabled on Rust
versions that supported.  Now that our MSRV is 1.41, which is
greater than 1.38 we can assume we always have support for
this macro.
3 years ago
Shivani Bhardwaj 613b12b0e7 rust: bump MSRV to 1.41.1
Ticket: #4902.
(cherry picked from commit 87f04475aa)
3 years ago
Jeff Lucovsky 303dd29b50 configure.ac: Support libunwind configuration
This commit adds support for enabling libunwind -- a library that can be
used to display stack information.

Libunwind is enabled and used by Suricata if present during
configuration.  A diagnostic message is displayed if libunwind
cannot be found.
3 years ago
Lukas Sismis fcfee6994e dpdk: edit configure.ac to include DPDK compilation option
Add a build flag --enable-dpdk to support DPDK parts in the source code.
3 years ago
Jeff Lucovsky 142a579971 netmap: allow specifying a library directory
Ticket: #4482
3 years ago
Victor Julien e93dc24383 mingw: add bcrypt to LDADD for rust compilation 3 years ago
Jeff Lucovsky 1c1c21be9e config/netmap: Check for latest API version
This commit checks for the latest Netmap API version.
3 years ago
Jason Ish 75bc9d9dd8 queue.h: wrap the system sys/queue.h
Instead of using local implementations for the queue.h macro,
wrap the system provided queue.h and then adding missing
features as needed.

The idea is that Suricata when integrated with another library
that includes sys/queue.h can look at the same source of truth
for these macros.

But not all operating systems include a queue.h with the same
features, and some don't include it at all, like Windows. So
on Windows this will be a full implementation of all the queue.h
features Suricata needs.
3 years ago
Juliana Fajardini a5b344e015 doc/devguide: add Transactions documentation page
A guide on what is a transaction for Suricata engine, focusing on
developers.
- What's the purpose of a transaction;
- transaction states and API callbacks;
- Examples and sequence diagrams.
- doc/devguide: add transactions.rst
- doc/devguide/extending/app-layer/index.rst: add transactions.rst
3 years ago
Philippe Antoine bce3c46874 pcre2: remove PCRE1 as dependency 3 years ago
Philippe Antoine acb1ab08a2 pcre2: introduce as a new depdendency 3 years ago
Jason Ish 54be743c48 prelude: remove the prelude output
It was broken in 6 and that didn't cause much issue. Just remove
it for 7.
4 years ago
Jason Ish 27d1ee98ce rust: derive crate: for custom derives
Currently has one derive, AppLayerEvent to be used like:

  #[derive(AppLayerEvent)]
  pub enum DNSEvent {
      MalformedData,
      NotRequest,
      NotResponse,
      ZFlagSet,
  }

Code will be generated to:
- Convert enum to a c type string
- Convert string to enum variant
- Convert id to enum variant
4 years ago
Eric Leblond d477d3a878 util/ebpf: fix deprecation warning
The function bpf_program__title has been deprecated in favor of
bpf_program__section_name.
4 years ago
Philippe Antoine e8415f249b fuzz: adds structure aware target
so as not to fuzz libpcap
and generate structure aware signatures
4 years ago
Jason Ish abb3cc85d5 install: better warning on install-full and don't fail
If suricata-update is not available on "make install-full", don't
exit 1, instead give the reason why its not installed, but still
succeed the install.
4 years ago
Philippe Antoine a04b5566a6 http: makes decompression time limit configurable 4 years ago
Jason Ish dfd930a13e libsuricata-config: program to print build flags
Following the pattern of many other libraries, provide a -config
program to output cflags and libs to properly link an application
against the library.

usage: libsuricata-config [--cflags] [--libs] [--static]

--cflags and --libs can be used infividually or together.

--static will link against the static libraries instead of the
shared library. Note that if the shared library is not available,
the static libraries will be provided even without this option.
4 years ago
Jason Ish 2c5e1d6a6d rust: separate the rust lib from RUST_LDADD
Fix another issue with library ordering when breaking apart
LDFLAGS from LIBS for outputting usable command lines for
users of a Suricata library.

RUST_LDADD should just contain the extra libs required by
Rust, not the actual Suricata Rust library.
4 years ago
Jason Ish d648446c32 configure: put lua libs in LIBS not LDFLAGS
This is required to separate LIBS from LDFLAGS when outputting
a usable LIBS configuration line for users of the shared library.
4 years ago
Jason Ish dbae17dbc0 install: makefile target to install libraries
As we don't install the libraries by default, provide a make target,
"install-library" to install the libsuricata library files.

If shared library support exists, both the static and shared
libraries will be installed, otherwise only the static libraries
will be installed.
4 years ago
Jason Ish e227d97e5e lib: build shared library on Linux
Building the shared library on Linux is not something by default.
Instead a user must opt-in to building by running the
"make libsuricata.so" target in the src/ directory.

Currently shared library support is only available on Linux. More
OSs will be supported as we can test them.
4 years ago
Jason Ish a178ec6bef rust: rename lib to libsuricata_rust
Previously it was libsuricata.a, but eventually we want to get
to a place where libsuricata.a is a combination of the Rust
and C code.
4 years ago
Eric Leblond 37b1595c20 configure: fix llc detection on recent Debian
Where clang --version was returning:

clang version 9.0.1-15+b1
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin

Newer version like clang-10 on Debian are returning:

Debian clang version 10.0.1-8+b1
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin

As a result the parsing was failing to determine which llc was
available on the system.
4 years ago
Jason Ish 6dfc888966 configure.ac: remove tests for libnspr and libnss 4 years ago
Victor Julien 3fdfec860f version: start 7.0.0 development 4 years ago
Victor Julien e860b9eee9 version: set to 6.0.1 4 years ago
Victor Julien f5af8864f7 configure: require libhtp 0.5.36 4 years ago
Jason Ish f3c59ef8a6 rust: handle windows naming change from .lib to .a
Prior to Rust 1.44, Cargo would name static libs with the .lib
extension. 1.44 changes this extension to .a when running under
a GNU environment on Windows like msys to make it more similar
to other unix environments.

Now assume static library name to be the same on Windows and
unix, but rename the .lib if found to still support older
versions of Rust on Windows.
4 years ago
Jason Ish 10f639e9d1 configure/mingw: move libs in LDFLAGS to LDADD
Moving the libs specified in LDFLAGS to LDADD put them into the
correct placement on in the link command.
4 years ago
Philippe Antoine 466466883b rust: do not rebuild stdlib when coverage is enabled
Because both seem incompatible for now
4 years ago
Victor Julien 8d0b0e8739 atomics: fix compilation on ppc64 4 years ago
Victor Julien 95729e923f configure: remove left over reference to unified2 4 years ago
Victor Julien 8fdee4f685 version: start development towards 6.0.1 4 years ago
Victor Julien 5219691f45 version: update to 6.0.0, require libhtp 0.5.35 4 years ago
Philippe Antoine 4f963717f8 fuzz: better configure checks for MSAN building
More compatible check for rust nightly
Checks for CARGO_BUILD_TARGET
Builds release or debug mode independently
4 years ago
Philippe Antoine 222b386102 rust: rebuilds std when building fuzzers
so as to have MSAN working
5 years ago
Victor Julien 2bef41a630 version: continue 6 development 5 years ago
Victor Julien 914391697a version: update to 6.0.0-rc1 5 years ago
Philippe Antoine 9b5c923327 http: disables lzma by default for HTTP 5 years ago
Jason Ish ea1338b464 rust: function macro now returns the function name
Borrow a macro from https://github.com/popzxc/stdext-rs that
will give us the Rust function name in SCLog messages in Rust.

As this trick only works on Rust 1.38 and newer, keep the old
macro around and set a feature based on a Rust version test
done during ./configure.
5 years ago
Jason Ish da3930e488 configure: fix test for rust headers for cross compile
Use "if test ..." instead of AC_CHECK_FILES which does not work
when cross compiling.
5 years ago
Jeff Lucovsky 5c725d5050 config/lua: Cross-compiling support
This commit guards the run-time check for a Lua integer so that it no
longer attempts execution in a cross-compilation environment.
5 years ago
Jeff Lucovsky 3e8db21ef3 config/pcre: Improved support for cross-compiling
This commit changes the logic used to determine if pcre_jit_exec is
available from a run-time to a compile-time check.
5 years ago
Jason Ish fbc9da450d configure: fix detection of netfilter_queue with older headers
Define _GNU_SOURCE and include sys/types.h so older
netfilter_queue headers can be detected properly, as they are
using u_int_xx style integers.
5 years ago
Victor Julien 22c70f7d66 version: continue 6 development 5 years ago
Victor Julien bb01d8ca31 version: update to 6.0.0-beta1 5 years ago
Jason Ish ff81212d8b configure: check for plugin support
Currently plugin support requires the dlfcn.h header
file and compiler support for -rdynamic.
5 years ago
Jason Ish 900f1522b4 plugins: config.h: move into src and rename to autoconf.h
While fixing files that include config.h, just remove the
include if possible.
5 years ago
Jason Ish e6668560e0 rust: only run cbindgen if needed
Only run cbindgen when necessary. This is a bit tricky. When
building a dist we want to unconditionally build the headers.

When going through a "make; sudo make install" type process,
cbindgen should not be run as the headers already exist, are
valid, and the environment under sudo is more often than
not suitable to pick up the Rust toolchains when installed
with rustup.

For the normal "make" case we have the gen/rust-bindings.h file
depend on library file, this will cause it to only be rebuilt
if the code was modified.

For "make dist" we unconditionally create "dist/rust-bindings.h".
This means the generated file could be in 2 locations, so update
configure.ac, and the library search find to find it.

The "gen/rust-bindings.h" should be picked up first if it exists,
for those who develop from a dist archive where "dist/rust-bindings.h"
also exists.

Not completely happy having the same file in 2 locations, but not
sure how else to get the dependency tracking correct.
5 years ago
Jeff Lucovsky 15b4554ab3 output: Check for fwrite_unlocked
This commit creates a macro for fwrite_unlocked which is probed during
configuration time.
5 years ago
Philippe Antoine 4554ca168a build: allows use of env variable CARGO_BUILD_TARGET
needed by oss-fuzz
5 years ago
Shivani Bhardwaj 6db1f19d62 rust: Add debug_validate_bug_on macro
This macro allows to check if certain parts of the code are reachable
during fuzzing.
5 years ago
Victor Julien f8159bd372 build: default to c11 standard
Rearrange pcap includes to fix builds on MinGW
5 years ago
Victor Julien 1893e40e79 build: don't limit C std to c99 (gnu99)
Now that C11 atomics and thread local storage are supported, the
compiler can figure out what version to use.
5 years ago
Victor Julien 7691fc4f9e configure: check for u_int and friends 5 years ago
Victor Julien 3ba4afd40b threads: make thread local storage manadatory
Support either the __thread GNUism or the C11 _Thread_local.

Use 'thread_local' to point to the one that is used. Convert existing
__thread user to 'thread_local'.

Remove non-thread-local code from the packet pool code.
5 years ago
Victor Julien 32cfd71f1a atomics: stdatomics.h version of SC_ATOMIC_* wrappers 5 years ago
Victor Julien 1cb7eec52d atomics: remove spinlocked fallback 5 years ago