Skip to content

Commit 37af572

Browse files
authored
Snort: init at 3.6.3.0 (#381363)
2 parents 95b88bf + c1bdbaa commit 37af572

File tree

4 files changed

+214
-36
lines changed

4 files changed

+214
-36
lines changed

pkgs/by-name/li/libdaq/package.nix

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
{
2+
lib,
3+
stdenv,
4+
fetchFromGitHub,
5+
autoreconfHook,
6+
pkg-config,
7+
libpcap,
8+
}:
9+
10+
stdenv.mkDerivation (finalAttrs: {
11+
pname = "libdaq";
12+
version = "3.0.18";
13+
14+
src = fetchFromGitHub {
15+
owner = "snort3";
16+
repo = "libdaq";
17+
tag = "v${finalAttrs.version}";
18+
hash = "sha256-PMb8q8QcfUXxEf0s2UdaZogmxzqUCw0wRdzfT1xio/E=";
19+
};
20+
21+
nativeBuildInputs = [
22+
autoreconfHook
23+
pkg-config
24+
];
25+
26+
buildInputs = [
27+
libpcap
28+
stdenv.cc.cc # libstdc++
29+
];
30+
31+
outputs = [
32+
"lib"
33+
"dev"
34+
"out"
35+
];
36+
37+
autoreconfPhase = ''
38+
./bootstrap
39+
'';
40+
41+
postInstall = ''
42+
# remove build directory (/build/**, or /tmp/nix-build-**) from RPATHs
43+
for f in "$out"/bin/*; do
44+
local nrp="$(patchelf --print-rpath "$f" | sed -E 's@(:|^)'$NIX_BUILD_TOP'[^:]*:@\1@g')"
45+
patchelf --set-rpath "$nrp" "$f"
46+
done
47+
'';
48+
49+
meta = {
50+
description = "Data AcQuisition library (libDAQ), for snort packet I/O";
51+
homepage = "https://www.snort.org";
52+
maintainers = with lib.maintainers; [
53+
aycanirican
54+
brianmcgillion
55+
];
56+
license = lib.licenses.gpl2;
57+
outputsToInstall = [
58+
"lib"
59+
"dev"
60+
];
61+
platforms = with lib.platforms; linux;
62+
};
63+
})
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
From a4dd3bf78fc8d4c22b40ddb4e91f525012703a5a Mon Sep 17 00:00:00 2001
2+
From: Brian McGillion <[email protected]>
3+
Date: Mon, 10 Feb 2025 23:31:47 +0400
4+
Subject: [PATCH] cmake: fix pkg-config path for libdir
5+
6+
on systems that prefer absolute paths there is a mixing and matching of
7+
the relative and absolute paths that can result in the below creation of
8+
libdir having the prefix and the full path appended to it.
9+
10+
** added to highlight
11+
12+
``prefix=/nix/store/3npvhj5wfwhc0q42qwiinj64bzfb1vvz-snort-3.6.3.0
13+
exec_prefix=${prefix}
14+
bindir=${exec_prefix}/bin
15+
**libdir=${prefix}//nix/store/3npvhj5wfwhc0q42qwiinj64bzfb1vvz-snort-3.6.3.0/lib**
16+
includedir=${prefix}/include
17+
datarootdir=${prefix}/share
18+
datadir=${datarootdir}
19+
mandir=${datarootdir}/man
20+
infodir=${datarootdir}/info
21+
``
22+
23+
In order to preserve backwards compatibility we will use the cmake
24+
fullpath option ${CMAKE_INSTALL_FULL_LIBDIR} in place of
25+
${prefix}/${CMAKE_INSTALL_LIBDIR} which will support both contexts.
26+
27+
Signed-off-by: Brian McGillion <[email protected]>
28+
---
29+
cmake/create_pkg_config.cmake | 2 +-
30+
1 file changed, 1 insertion(+), 1 deletion(-)
31+
32+
diff --git a/cmake/create_pkg_config.cmake b/cmake/create_pkg_config.cmake
33+
index 300350cbd..4ce8b16e6 100644
34+
--- a/cmake/create_pkg_config.cmake
35+
+++ b/cmake/create_pkg_config.cmake
36+
@@ -5,7 +5,7 @@
37+
set(prefix "${CMAKE_INSTALL_PREFIX}")
38+
set(exec_prefix "\${prefix}")
39+
set(bindir "\${exec_prefix}/bin")
40+
-set(libdir "\${prefix}/${CMAKE_INSTALL_LIBDIR}")
41+
+set(libdir "\${CMAKE_INSTALL_FULL_LIBDIR}")
42+
set(includedir "\${prefix}/include")
43+
set(datarootdir "\${prefix}/share")
44+
set(datadir "\${datarootdir}")
45+
--
46+
2.47.2
47+

pkgs/by-name/sn/snort/package.nix

Lines changed: 34 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,68 +1,66 @@
11
{
22
lib,
33
stdenv,
4-
pkg-config,
4+
fetchFromGitHub,
5+
cmake,
6+
libdaq,
7+
libdnet,
8+
flex,
9+
hwloc,
510
luajit,
611
openssl,
7-
fetchurl,
812
libpcap,
9-
pcre,
10-
libdnet,
11-
daq,
13+
pcre2,
14+
pkg-config,
1215
zlib,
13-
flex,
14-
bison,
15-
makeWrapper,
16-
libtirpc,
16+
xz,
1717
}:
1818

19-
stdenv.mkDerivation rec {
20-
version = "2.9.20";
19+
stdenv.mkDerivation (finalAttrs: {
2120
pname = "snort";
21+
version = "3.6.3.0";
2222

23-
src = fetchurl {
24-
name = "${pname}-${version}.tar.gz";
25-
url = "https://snort.org/downloads/archive/snort/${pname}-${version}.tar.gz";
26-
sha256 = "sha256-KUAOE/U7GDHguLEOwSJKHLqm3BUzpTIqIN2Au4S0mBw=";
23+
src = fetchFromGitHub {
24+
owner = "snort3";
25+
repo = "snort3";
26+
rev = "refs/tags/${finalAttrs.version}";
27+
hash = "sha256-loMmmpoaEncW31FUIE9Zf9w635Prvke6vCY+mIt6oGI=";
2728
};
2829

2930
nativeBuildInputs = [
30-
makeWrapper
31+
libdaq
3132
pkg-config
33+
cmake
3234
];
35+
3336
buildInputs = [
37+
libdaq
38+
libpcap
39+
stdenv.cc.cc # libstdc++
40+
libdnet
41+
flex
42+
hwloc
3443
luajit
3544
openssl
3645
libpcap
37-
pcre
38-
libdnet
39-
daq
46+
pcre2
4047
zlib
41-
flex
42-
bison
43-
libtirpc
48+
xz
4449
];
4550

46-
env.NIX_CFLAGS_COMPILE = toString [ "-I${libtirpc.dev}/include/tirpc" ];
51+
# Patch that is tracking upstream PR https://github.com/snort3/snort3/pull/399
52+
patches = [ ./0001-cmake-fix-pkg-config-path-for-libdir.patch ];
4753

4854
enableParallelBuilding = true;
4955

50-
configureFlags = [
51-
"--disable-static-daq"
52-
"--enable-control-socket"
53-
"--with-daq-includes=${daq}/includes"
54-
"--with-daq-libraries=${daq}/lib"
55-
];
56-
57-
postInstall = ''
58-
wrapProgram $out/bin/snort --add-flags "--daq-dir ${daq}/lib/daq --dynamic-preprocessor-lib-dir $out/lib/snort_dynamicpreprocessor/ --dynamic-engine-lib-dir $out/lib/snort_dynamicengine"
59-
'';
60-
6156
meta = {
6257
description = "Network intrusion prevention and detection system (IDS/IPS)";
6358
homepage = "https://www.snort.org";
64-
maintainers = with lib.maintainers; [ aycanirican ];
59+
maintainers = with lib.maintainers; [
60+
aycanirican
61+
brianmcgillion
62+
];
6563
license = lib.licenses.gpl2;
6664
platforms = with lib.platforms; linux;
6765
};
68-
}
66+
})

pkgs/by-name/sn/snort2/package.nix

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
{
2+
lib,
3+
stdenv,
4+
pkg-config,
5+
luajit,
6+
openssl,
7+
fetchurl,
8+
libpcap,
9+
pcre,
10+
libdnet,
11+
daq,
12+
zlib,
13+
flex,
14+
bison,
15+
makeWrapper,
16+
libtirpc,
17+
}:
18+
19+
stdenv.mkDerivation (finalAttrs: {
20+
version = "2.9.20";
21+
pname = "snort2";
22+
23+
# TODO: remove this package after 25.05 release
24+
# https://github.com/NixOS/nixpkgs/pull/381363#issuecomment-2653483597
25+
src = fetchurl rec {
26+
name = "snort-${finalAttrs.version}.tar.gz";
27+
url = "https://snort.org/downloads/snort/${name}";
28+
sha256 = "sha256-KUAOE/U7GDHguLEOwSJKHLqm3BUzpTIqIN2Au4S0mBw=";
29+
};
30+
31+
nativeBuildInputs = [
32+
makeWrapper
33+
pkg-config
34+
];
35+
buildInputs = [
36+
luajit
37+
openssl
38+
libpcap
39+
pcre
40+
libdnet
41+
daq
42+
zlib
43+
flex
44+
bison
45+
libtirpc
46+
];
47+
48+
env.NIX_CFLAGS_COMPILE = toString [ "-I${libtirpc.dev}/include/tirpc" ];
49+
50+
enableParallelBuilding = true;
51+
52+
configureFlags = [
53+
"--disable-static-daq"
54+
"--enable-control-socket"
55+
"--with-daq-includes=${daq}/includes"
56+
"--with-daq-libraries=${daq}/lib"
57+
];
58+
59+
postInstall = ''
60+
wrapProgram $out/bin/snort --add-flags "--daq-dir ${daq}/lib/daq --dynamic-preprocessor-lib-dir $out/lib/snort_dynamicpreprocessor/ --dynamic-engine-lib-dir $out/lib/snort_dynamicengine"
61+
'';
62+
63+
meta = {
64+
description = "Network intrusion prevention and detection system (IDS/IPS)";
65+
homepage = "https://www.snort.org";
66+
maintainers = with lib.maintainers; [ aycanirican ];
67+
license = lib.licenses.gpl2;
68+
platforms = with lib.platforms; linux;
69+
};
70+
})

0 commit comments

Comments
 (0)