Skip to content

Commit c1bdbaa

Browse files
snort: init at 3.6.3.0
Snort 3 aka snort++ is the next generation Snort IPS (Intrusion Prevention System). snort3 is actively maintained and developed unlike the snort2 baseline so this with replace the old snort2 as the default version. snort2 is not yet removed from the pkgs to allow folks to utilize that if required. In addition to the primary binary `snort` there is `snort2lua` a tool to convert Snort 2.X conf and rules to the new form. Signed-off-by: Brian McGillion <[email protected]>
1 parent ba3b6a7 commit c1bdbaa

File tree

2 files changed

+113
-0
lines changed

2 files changed

+113
-0
lines changed
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: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
{
2+
lib,
3+
stdenv,
4+
fetchFromGitHub,
5+
cmake,
6+
libdaq,
7+
libdnet,
8+
flex,
9+
hwloc,
10+
luajit,
11+
openssl,
12+
libpcap,
13+
pcre2,
14+
pkg-config,
15+
zlib,
16+
xz,
17+
}:
18+
19+
stdenv.mkDerivation (finalAttrs: {
20+
pname = "snort";
21+
version = "3.6.3.0";
22+
23+
src = fetchFromGitHub {
24+
owner = "snort3";
25+
repo = "snort3";
26+
rev = "refs/tags/${finalAttrs.version}";
27+
hash = "sha256-loMmmpoaEncW31FUIE9Zf9w635Prvke6vCY+mIt6oGI=";
28+
};
29+
30+
nativeBuildInputs = [
31+
libdaq
32+
pkg-config
33+
cmake
34+
];
35+
36+
buildInputs = [
37+
libdaq
38+
libpcap
39+
stdenv.cc.cc # libstdc++
40+
libdnet
41+
flex
42+
hwloc
43+
luajit
44+
openssl
45+
libpcap
46+
pcre2
47+
zlib
48+
xz
49+
];
50+
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 ];
53+
54+
enableParallelBuilding = true;
55+
56+
meta = {
57+
description = "Network intrusion prevention and detection system (IDS/IPS)";
58+
homepage = "https://www.snort.org";
59+
maintainers = with lib.maintainers; [
60+
aycanirican
61+
brianmcgillion
62+
];
63+
license = lib.licenses.gpl2;
64+
platforms = with lib.platforms; linux;
65+
};
66+
})

0 commit comments

Comments
 (0)