Initial Commit

- initial default booting image
This commit is contained in:
2026-11-06 20:45:42 +01:00
commit b8783708ae
15201 changed files with 602532 additions and 0 deletions

View File

@@ -0,0 +1,37 @@
From 7ab4d5eb55e1d3900390b76e5f46e80e22d4e80e Mon Sep 17 00:00:00 2001
From: Fabrice Fontaine <fontaine.fabrice@gmail.com>
Date: Sat, 10 Oct 2020 21:34:21 +0200
Subject: [PATCH] configure.ac: allow the user to override RUST_TARGET
When cross-compiling, RUST_TARGET is not always equal to host_triplet
(e.g. buildroot) so allow the user to override this default value
through RUST_TARGET environment variable
Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
[Bernd: rebased for version 8.0.4]
Signed-off-by: Bernd Kuhls <bernd@kuhls.net>
---
configure.ac | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/configure.ac b/configure.ac
index 32c230209..7d7c9373f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2146,7 +2146,12 @@ fi
have_rust_vendor="no"
if test "x$cross_compiling" = "xyes"; then
- RUST_SURICATA_LIB_XC_DIR="${host_alias}/"
+ if test "x$RUST_TARGET" != "x"; then
+ RUST_SURICATA_LIB_XC_DIR="$RUST_TARGET/"
+ AC_SUBST([RUST_TARGET],["--target $RUST_TARGET"])
+ else
+ RUST_SURICATA_LIB_XC_DIR="${host_alias}/"
+ fi
else
if test "x$CARGO_BUILD_TARGET" = "x"; then
RUST_SURICATA_LIB_XC_DIR=
--
2.28.0

View File

@@ -0,0 +1,53 @@
From 6e1d8aceea8c4e49f00d8e630b681641a36c688f Mon Sep 17 00:00:00 2001
From: Fabrice Fontaine <fontaine.fabrice@gmail.com>
Date: Mon, 6 May 2024 09:31:05 +0200
Subject: [PATCH] configure.ac: fix static build
static build is broken since
https://github.com/OISF/suricata/commit/31ba4fd1522dd0d7f933767b9205c67a4e726fe5
because AC_CHECK_LIB is called before PKG_CHECK_MODULES:
configure:22378: checking for pcap_open_dead in -lpcap
configure:22407: /home/buildroot/autobuild/run/instance-3/output-1/host/bin/x86_64-linux-gcc -o conftest -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -O2 -g0 -static -std=c11 -march=native -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -static -rdynamic conftest.c -lpcap -ljansson -lpthread -lyaml -lpcre -latomic -lz >&5
/home/buildroot/autobuild/run/instance-3/output-1/host/opt/ext-toolchain/bin/../lib/gcc/x86_64-buildroot-linux-musl/12.3.0/../../../../x86_64-buildroot-linux-musl/bin/ld: /home/buildroot/autobuild/run/instance-3/output-1/host/x86_64-buildroot-linux-musl/sysroot/usr/lib/../lib64/libpcap.a(pcap-linux.o): in function `nl80211_init':
pcap-linux.c:(.text+0xc34): undefined reference to `nl_socket_alloc'
[...]
checking for pcap_open_dead in -lpcap... no
Fixes:
- http://autobuild.buildroot.org/results/9e25c2508bd4100d2d1d3180e79060d762361213
Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
Upstream: https://redmine.openinfosecfoundation.org/issues/7008
[Bernd: rebased for version 8.0.4]
Signed-off-by: Bernd Kuhls <bernd@kuhls.net>
---
configure.ac | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/configure.ac b/configure.ac
index 232ee9bed..6277cb9b6 100644
--- a/configure.ac
+++ b/configure.ac
@ -1263,6 +1263,8 @@
fi
fi
+ PKG_CHECK_MODULES([PCAP],libpcap,[CPPFLAGS="${CPPFLAGS} ${PCAP_CFLAGS}" LIBS="${LIBS} ${PCAP_LIBS}" with_pkgconfig_pcap=yes],[with_pkgconfig_pcap=no])
+
if test "$have_wpcap" != "yes"; then
AC_CHECK_LIB(pcap, pcap_open_dead, [], [
echo
@@ -1278,7 +1280,6 @@
PCAP_LIB_NAME="pcap"
fi
- PKG_CHECK_MODULES([PCAP],libpcap,[CPPFLAGS="${CPPFLAGS} ${PCAP_CFLAGS}" LIBS="${LIBS} ${PCAP_LIBS}" with_pkgconfig_pcap=yes],[with_pkgconfig_pcap=no])
if test "$with_pkgconfig_pcap" != "yes"; then
AC_PATH_PROG(HAVE_PCAP_CONFIG, pcap-config, "no")
if test "$HAVE_PCAP_CONFIG" = "no" -o "x$cross_compiling" = "xyes"; then
--
2.43.0

View File

@@ -0,0 +1,26 @@
config BR2_PACKAGE_SURICATA
bool "suricata"
depends on BR2_PACKAGE_HOST_RUSTC_TARGET_ARCH_SUPPORTS
depends on BR2_USE_MMU # fork()
depends on BR2_USE_WCHAR
depends on BR2_TOOLCHAIN_HAS_THREADS
select BR2_PACKAGE_HOST_RUSTC
select BR2_PACKAGE_JANSSON
select BR2_PACKAGE_LIBHTP
select BR2_PACKAGE_LIBPCAP
select BR2_PACKAGE_LIBYAML
select BR2_PACKAGE_PCRE2
help
Suricata is a free and open source, mature, fast and robust
network threat detection engine.
The Suricata engine is capable of real time intrusion
detection (IDS), inline intrusion prevention (IPS), network
security monitoring (NSM) and offline pcap processing.
https://suricata.io
comment "suricata needs a toolchain w/ wchar, threads"
depends on BR2_PACKAGE_HOST_RUSTC_TARGET_ARCH_SUPPORTS
depends on BR2_USE_MMU
depends on !BR2_USE_WCHAR || !BR2_TOOLCHAIN_HAS_THREADS

View File

@@ -0,0 +1,64 @@
#!/bin/sh
DAEMON=suricata
PIDFILE=/var/run/$DAEMON.pid
SURICATA_ARGS="-c /etc/suricata/suricata.yaml -i eth0"
SURICATA_RELOAD=0
[ -r "/etc/default/$DAEMON" ] && . "/etc/default/$DAEMON"
start() {
printf 'Starting %s: ' "$DAEMON"
mkdir -p /var/log/suricata
start-stop-daemon -b -m -S -q -p "$PIDFILE" -x "/usr/bin/$DAEMON" \
-- $SURICATA_ARGS
status=$?
if [ "$status" -eq 0 ]; then
echo "OK"
else
echo "FAIL"
fi
return "$status"
}
stop() {
printf 'Stopping %s: ' "$DAEMON"
start-stop-daemon -K -q -p "$PIDFILE"
status=$?
if [ "$status" -eq 0 ]; then
rm -f "$PIDFILE"
echo "OK"
else
echo "FAIL"
fi
return "$status"
}
restart() {
stop
sleep 1
start
}
# SIGUSR2 makes suricata reload rules
reload() {
printf 'Reloading %s: ' "$DAEMON"
start-stop-daemon -K -s "$SURICATA_RELOAD" -q -p "$PIDFILE"
status=$?
if [ "$status" -eq 0 ]; then
echo "OK"
else
echo "FAIL"
fi
return "$status"
}
case "$1" in
start|stop|restart|reload)
"$1";;
*)
echo "Usage: $0 {start|stop|restart|reload}"
exit 1
esac

View File

@@ -0,0 +1,6 @@
# Locally computed:
sha256 81cee7bae69848a9751b2ce0867620eefa52b192e79c20b5eac897600b28b191 suricata-8.0.4.tar.gz
# Hash for license files:
sha256 8177f97513213526df2cf6184d8ff986c675afb514d4e68a404010521b880643 COPYING
sha256 8177f97513213526df2cf6184d8ff986c675afb514d4e68a404010521b880643 LICENSE

View File

@@ -0,0 +1,140 @@
################################################################################
#
# suricata
#
################################################################################
SURICATA_VERSION = 8.0.4
SURICATA_SITE = https://www.openinfosecfoundation.org/download
SURICATA_LICENSE = GPL-2.0
SURICATA_LICENSE_FILES = COPYING LICENSE
SURICATA_CPE_ID_VENDOR = oisf
# 0001-configure.ac-allow-the-user-to-override-RUST_TARGET.patch
# 0002-configure.ac-fix-static-build.patch
SURICATA_AUTORECONF = YES
SURICATA_DEPENDENCIES = \
host-pkgconf \
host-rustc \
jansson \
$(if $(BR2_PACKAGE_LIBCAP_NG),libcap-ng) \
$(if $(BR2_PACKAGE_LIBEVENT),libevent) \
libhtp \
$(if $(BR2_PACKAGE_LIBNFNETLINK),libnfnetlink) \
libpcap \
libyaml \
$(if $(BR2_PACKAGE_LZ4),lz4) \
pcre2 \
$(if $(BR2_PACKAGE_XZ),xz)
SURICATA_CONF_ENV = \
ac_cv_path_HAVE_SPHINXBUILD=no \
CARGO_HOME=$(BR_CARGO_HOME) \
RUSTDOC=true \
RUST_TARGET=$(RUSTC_TARGET_NAME)
SURICATA_MAKE_ENV = \
CARGO_TARGET_$(call UPPERCASE,$(RUSTC_TARGET_NAME))_LINKER=$(TARGET_CROSS)gcc
SURICATA_CONF_OPTS = \
--disable-gccprotect \
--disable-pie \
--disable-suricata-update \
--enable-non-bundled-htp
# install: install binaries
# install-conf: install initial configuration files
# install-full: install binaries, configuration and rules (rules will be
# download through wget/curl)
SURICATA_INSTALL_TARGET_OPTS = DESTDIR=$(TARGET_DIR) install install-conf
ifeq ($(BR2_TOOLCHAIN_HAS_LIBATOMIC),y)
SURICATA_CONF_ENV += LIBS=-latomic
endif
ifeq ($(BR2_PACKAGE_FILE),y)
SURICATA_DEPENDENCIES += file
SURICATA_CONF_OPTS += --enable-libmagic
else
SURICATA_CONF_OPTS += --disable-libmagic
endif
ifeq ($(BR2_PACKAGE_LIBMAXMINDDB),y)
SURICATA_DEPENDENCIES += libmaxminddb
SURICATA_CONF_OPTS += --enable-geoip
else
SURICATA_CONF_OPTS += --disable-geoip
endif
ifeq ($(BR2_PACKAGE_HIREDIS),y)
SURICATA_DEPENDENCIES += hiredis
SURICATA_CONF_OPTS += --enable-hiredis
else
SURICATA_CONF_OPTS += --disable-hiredis
endif
ifeq ($(BR2_PACKAGE_LIBNET),y)
SURICATA_DEPENDENCIES += libnet
SURICATA_CONF_OPTS += --with-libnet-includes=$(STAGING_DIR)/usr/include
endif
ifeq ($(BR2_PACKAGE_LIBNETFILTER_LOG),y)
SURICATA_DEPENDENCIES += libnetfilter_log
SURICATA_CONF_OPTS += --enable-nflog
else
SURICATA_CONF_OPTS += --disable-nflog
endif
ifeq ($(BR2_PACKAGE_LIBNETFILTER_QUEUE),y)
SURICATA_DEPENDENCIES += libnetfilter_queue
SURICATA_CONF_OPTS += --enable-nfqueue
else
SURICATA_CONF_OPTS += --disable-nfqueue
endif
ifeq ($(BR2_PACKAGE_LIBNSPR),y)
SURICATA_DEPENDENCIES += libnspr
SURICATA_CONF_OPTS += --enable-nspr
else
SURICATA_CONF_OPTS += --disable-nspr
endif
ifeq ($(BR2_PACKAGE_LIBNSS),y)
SURICATA_DEPENDENCIES += libnss
SURICATA_CONF_OPTS += --enable-nss
else
SURICATA_CONF_OPTS += --disable-nss
endif
ifeq ($(BR2_PACKAGE_LUA),y)
SURICATA_CONF_OPTS += --enable-lua
SURICATA_DEPENDENCIES += lua
else
SURICATA_CONF_OPTS += --disable-lua
endif
ifeq ($(BR2_PACKAGE_LUAJIT),y)
SURICATA_CONF_OPTS += --enable-luajit
SURICATA_DEPENDENCIES += luajit
else
SURICATA_CONF_OPTS += --disable-luajit
endif
ifeq ($(BR2_PACKAGE_PYTHON3),y)
SURICATA_CONF_OPTS += --enable-python
SURICATA_DEPENDENCIES += python3
else
SURICATA_CONF_OPTS += --disable-python
endif
define SURICATA_INSTALL_INIT_SYSV
$(INSTALL) -D -m 0755 package/suricata/S99suricata \
$(TARGET_DIR)/etc/init.d/S99suricata
endef
define SURICATA_INSTALL_INIT_SYSTEMD
$(INSTALL) -D -m 644 package/suricata/suricata.service \
$(TARGET_DIR)/usr/lib/systemd/system/suricata.service
endef
$(eval $(autotools-package))

View File

@@ -0,0 +1,14 @@
[Unit]
Description=Suricata Intrusion Detection Service
After=network.target
[Service]
EnvironmentFile=-/etc/default/suricata
ExecStartPre=/bin/rm -f /var/run/suricata.pid
ExecStartPre=/usr/bin/mkdir -p /var/log/suricata
ExecStart=/usr/bin/suricata -c /etc/suricata/suricata.yaml -i eth0 --pidfile /var/run/suricata.pid
ExecReload=/bin/kill -USR2 $MAINPID
Restart=always
[Install]
WantedBy=multi-user.target