Gentoo Archives: gentoo-commits

From: Marek Szuba <marecki@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: net-analyzer/suricata/
Date: Wed, 01 Feb 2023 10:51:13
Message-Id: 1675248637.8b6d65a2f8918e747d3801e689c9349f9de02140.marecki@gentoo
1 commit: 8b6d65a2f8918e747d3801e689c9349f9de02140
2 Author: Marek Szuba <marecki <AT> gentoo <DOT> org>
3 AuthorDate: Wed Feb 1 10:47:06 2023 +0000
4 Commit: Marek Szuba <marecki <AT> gentoo <DOT> org>
5 CommitDate: Wed Feb 1 10:50:37 2023 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=8b6d65a2
7
8 net-analyzer/suricata: add 6.0.10
9
10 Signed-off-by: Marek Szuba <marecki <AT> gentoo.org>
11
12 net-analyzer/suricata/Manifest | 2 +
13 net-analyzer/suricata/suricata-6.0.10.ebuild | 211 +++++++++++++++++++++++++++
14 2 files changed, 213 insertions(+)
15
16 diff --git a/net-analyzer/suricata/Manifest b/net-analyzer/suricata/Manifest
17 index 2314e0a6d360..d2780384de9a 100644
18 --- a/net-analyzer/suricata/Manifest
19 +++ b/net-analyzer/suricata/Manifest
20 @@ -1,3 +1,5 @@
21 +DIST suricata-6.0.10.tar.gz 27374715 BLAKE2B a2b334c0139ead0b914ba6039c116ebad30dd3b5c0d4bb751f608af83e1487a67b96224ffe61635468dc49a9e44f03a76facf2af66582ba18e364f233029b532 SHA512 3e49d491cf1fb56a6773308380cae826016041018c18753d18529572712a6ffa415df2798805bffdf8482312fdb69c3f2e05f38870a5b725d333f928b840e1e2
22 +DIST suricata-6.0.10.tar.gz.sig 566 BLAKE2B 911c3587911dd6b8fbf0932608b2eb80928223d5ed6636abfd9355fcdf6fcb2ff0e3d064d472d2c89417679c68d496ee105dd0cee1f3e8c33de9cd6c90290d9d SHA512 5c6ab8937d82472b0bccae00c94094ee503ac423884d958947f276a4f2d7e9a88646e5ca8deb4b03cb4d035238774a6cd20ddbea9a08a6c5b45b646c1458dca8
23 DIST suricata-6.0.8.tar.gz 32697425 BLAKE2B 1e445885f3a672081cbb8f17de9fb0fa21a2c618b80ea8d3d9362c0475149d833986cac047ad90b1c1a5b5b19025ff501a695e0f197c00457859b3858f51ecba SHA512 ab1eceedde70179e4a447297039e64132e0a2361e8424ad42c9037273a3f6eaf4c8d5d0306af6f26c8b373636b621ac1d7d505952306d9170c6a87e6fb863b61
24 DIST suricata-6.0.8.tar.gz.sig 566 BLAKE2B 817756401d628e49fb0f54faca05d87131711946aa641d0f0a5957fa2f5d6378e1b5cafeaf67b176b66cb0be0afd790aea1312042a195535e57571276aef1edc SHA512 d0d354b6fca3ef088e2371d6262f4bd45fb06747fcc32519510e690ced933d828fc1acf64d8d1b17d0360ce280905e5bf4b1c9fb8016d82cdee57a432bded884
25 DIST suricata-6.0.9.tar.gz 27352128 BLAKE2B 966657eeff216894f6357989f0317b7c5eed82602ca2381269446cbe4c015be449f5598726b2f58924f20aca30c4e130ecafe642ea4ce39f1671f46093292551 SHA512 09a24a90db11e74da2d584904987c2d751243a95cf237d13a8b57cdffc6659281c9d572404caea657e637d7eed01ecfe40bdfcfc79c09e1ca8eb26637dddbb6c
26
27 diff --git a/net-analyzer/suricata/suricata-6.0.10.ebuild b/net-analyzer/suricata/suricata-6.0.10.ebuild
28 new file mode 100644
29 index 000000000000..69445880fb19
30 --- /dev/null
31 +++ b/net-analyzer/suricata/suricata-6.0.10.ebuild
32 @@ -0,0 +1,211 @@
33 +# Copyright 1999-2023 Gentoo Authors
34 +# Distributed under the terms of the GNU General Public License v2
35 +
36 +EAPI=8
37 +
38 +LUA_COMPAT=( lua5-1 luajit )
39 +PYTHON_COMPAT=( python3_{9..11} )
40 +
41 +inherit autotools flag-o-matic linux-info lua-single python-single-r1 systemd tmpfiles verify-sig
42 +
43 +DESCRIPTION="High performance Network IDS, IPS and Network Security Monitoring engine"
44 +HOMEPAGE="https://suricata.io/"
45 +SRC_URI="https://www.openinfosecfoundation.org/download/${P}.tar.gz
46 + verify-sig? ( https://www.openinfosecfoundation.org/download/${P}.tar.gz.sig )"
47 +
48 +LICENSE="GPL-2"
49 +SLOT="0/6"
50 +KEYWORDS="~amd64 ~riscv ~x86"
51 +IUSE="+af-packet bpf control-socket cuda debug +detection geoip hardened hyperscan lua lz4 nflog +nfqueue redis systemd test"
52 +VERIFY_SIG_OPENPGP_KEY_PATH="${BROOT}/usr/share/openpgp-keys/openinfosecfoundation.org.asc"
53 +
54 +RESTRICT="!test? ( test )"
55 +
56 +REQUIRED_USE="${PYTHON_REQUIRED_USE}
57 + bpf? ( af-packet )
58 + lua? ( ${LUA_REQUIRED_USE} )"
59 +
60 +RDEPEND="${PYTHON_DEPS}
61 + acct-group/suricata
62 + acct-user/suricata
63 + dev-libs/jansson:=
64 + dev-libs/libpcre
65 + dev-libs/libyaml
66 + net-libs/libnet:*
67 + net-libs/libnfnetlink
68 + dev-libs/nspr
69 + dev-libs/nss
70 + $(python_gen_cond_dep '
71 + dev-python/pyyaml[${PYTHON_USEDEP}]
72 + ')
73 + >=net-libs/libhtp-0.5.42
74 + net-libs/libpcap
75 + sys-apps/file
76 + sys-libs/libcap-ng
77 + bpf? ( <dev-libs/libbpf-1.0.0 )
78 + cuda? ( dev-util/nvidia-cuda-toolkit )
79 + geoip? ( dev-libs/libmaxminddb:= )
80 + hyperscan? ( dev-libs/hyperscan )
81 + lua? ( ${LUA_DEPS} )
82 + lz4? ( app-arch/lz4 )
83 + nflog? ( net-libs/libnetfilter_log )
84 + nfqueue? ( net-libs/libnetfilter_queue )
85 + redis? ( dev-libs/hiredis:= )"
86 +DEPEND="${RDEPEND}
87 + >=sys-devel/autoconf-2.69-r5
88 + virtual/rust"
89 +BDEPEND="verify-sig? ( >=sec-keys/openpgp-keys-oisf-20200807 )"
90 +
91 +PATCHES=(
92 + "${FILESDIR}/${PN}-5.0.1_configure-no-lz4-automagic.patch"
93 + "${FILESDIR}/${PN}-5.0.6_configure-no-sphinx-pdflatex-automagic.patch"
94 + "${FILESDIR}/${PN}-5.0.7_configure-no-hyperscan-automagic.patch"
95 + "${FILESDIR}/${PN}-6.0.0_default-config.patch"
96 +)
97 +
98 +pkg_pretend() {
99 + if use bpf && use kernel_linux; then
100 + if kernel_is -lt 4 15; then
101 + ewarn "Kernel 4.15 or newer is necessary to use all XDP features like the CPU redirect map"
102 + fi
103 +
104 + CONFIG_CHECK="~XDP_SOCKETS"
105 + ERROR_XDP_SOCKETS="CONFIG_XDP_SOCKETS is not set, making it impossible for Suricata to load XDP programs. "
106 + ERROR_XDP_SOCKETS+="Other eBPF features should work normally."
107 + check_extra_config
108 + fi
109 +}
110 +
111 +src_prepare() {
112 + default
113 + sed -ie 's/docdir =.*/docdir = ${datarootdir}\/doc\/'${PF}'\//' "${S}/doc/Makefile.am" || die
114 + eautoreconf
115 +}
116 +
117 +src_configure() {
118 + # Bug #861242
119 + filter-lto
120 +
121 + local myeconfargs=(
122 + "--localstatedir=/var" \
123 + "--runstatedir=/run" \
124 + "--enable-non-bundled-htp" \
125 + "--enable-gccmarch-native=no" \
126 + "--enable-python" \
127 + $(use_enable af-packet) \
128 + $(use_enable bpf ebpf) \
129 + $(use_enable control-socket unix-socket) \
130 + $(use_enable cuda) \
131 + $(use_enable detection) \
132 + $(use_enable geoip) \
133 + $(use_enable hardened gccprotect) \
134 + $(use_enable hardened pie) \
135 + $(use_enable hyperscan) \
136 + $(use_enable lz4) \
137 + $(use_enable nflog) \
138 + $(use_enable nfqueue) \
139 + $(use_enable redis hiredis) \
140 + $(use_enable test unittests) \
141 + "--disable-coccinelle"
142 + )
143 + if use lua; then
144 + if use lua_single_target_luajit; then
145 + myeconfargs+=( --enable-luajit )
146 + else
147 + myeconfargs+=( --enable-lua )
148 + fi
149 + fi
150 +
151 + if use debug; then
152 + myeconfargs+=( $(use_enable debug) )
153 + # so we can get a backtrace according to "reporting bugs" on upstream web site
154 + CFLAGS="-ggdb -O0" econf ${myeconfargs[@]}
155 + else
156 + econf ${myeconfargs[@]}
157 + fi
158 +}
159 +
160 +src_install() {
161 + emake DESTDIR="${D}" install
162 + python_optimize
163 + # Bug #878855
164 + python_fix_shebang "${ED}"/usr/bin/
165 +
166 + if use bpf; then
167 + rm -f ebpf/Makefile.{am,in} || die
168 + dodoc -r ebpf/
169 + keepdir /usr/libexec/suricata/ebpf
170 + fi
171 +
172 + insinto "/etc/${PN}"
173 + doins etc/{classification,reference}.config threshold.config suricata.yaml
174 +
175 + keepdir "/var/lib/${PN}/rules" "/var/lib/${PN}/update"
176 + keepdir "/var/log/${PN}"
177 +
178 + fowners -R ${PN}: "/var/lib/${PN}" "/var/log/${PN}" "/etc/${PN}"
179 + fperms 750 "/var/lib/${PN}" "/var/log/${PN}" "/etc/${PN}"
180 + fperms 2750 "/var/lib/${PN}/rules" "/var/lib/${PN}/update"
181 +
182 + newinitd "${FILESDIR}/${PN}.initd" ${PN}
183 + newconfd "${FILESDIR}/${PN}.confd" ${PN}
184 + systemd_dounit "${FILESDIR}"/${PN}.service
185 + newtmpfiles "${FILESDIR}"/${PN}.tmpfiles ${PN}.conf
186 +
187 + insopts -m0644
188 + insinto /etc/logrotate.d
189 + newins etc/${PN}.logrotate ${PN}
190 +}
191 +
192 +pkg_postinst() {
193 + tmpfiles_process ${PN}.conf
194 +
195 + elog
196 + if use systemd; then
197 + elog "Suricata requires either the mode of operation (e.g. --af-packet) or the interface to listen on (e.g. -i eth0)"
198 + elog "to be specified on the command line. The provided systemd unit launches Suricata in af-packet mode and relies"
199 + elog "on file configuration to specify interfaces, should you prefer to run it differently you will have to customise"
200 + elog "said unit. The simplest way of doing it is to override the Environment=OPTIONS='...' line using a .conf file"
201 + elog "placed in the directory ${EPREFIX}/etc/systemd/system/suricata.service.d/ ."
202 + elog "For details, see the section on drop-in directories in systemd.unit(5)."
203 + else
204 + elog "The ${PN} init script expects to find the path to the configuration"
205 + elog "file as well as extra options in /etc/conf.d."
206 + elog
207 + elog "To create more than one ${PN} service, simply create a new .yaml file for it"
208 + elog "then create a symlink to the init script from a link called"
209 + elog "${PN}.foo - like so"
210 + elog " cd /etc/${PN}"
211 + elog " ${EDITOR##*/} suricata-foo.yaml"
212 + elog " cd /etc/init.d"
213 + elog " ln -s ${PN} ${PN}.foo"
214 + elog "Then edit /etc/conf.d/${PN} and make sure you specify sensible options for foo."
215 + elog
216 + elog "You can create as many ${PN}.foo* services as you wish."
217 + fi
218 +
219 + if use bpf; then
220 + elog
221 + elog "eBPF/XDP files must be compiled (using sys-devel/clang[llvm_targets_BPF]) before use"
222 + elog "because their configuration is hard-coded. You can find the default ones in"
223 + elog " ${EPREFIX}/usr/share/doc/${PF}/ebpf"
224 + elog "and the common location for eBPF bytecode is"
225 + elog " ${EPREFIX}/usr/libexec/${PN}"
226 + elog "For more information, see https://${PN}.readthedocs.io/en/${P}/capture-hardware/ebpf-xdp.html"
227 + fi
228 +
229 + if use debug; then
230 + elog
231 + elog "You have enabled the debug USE flag. Please read this link to report bugs upstream:"
232 + elog "https://redmine.openinfosecfoundation.org/projects/suricata/wiki/Reporting_Bugs"
233 + elog "You need to also ensure the FEATURES variable in make.conf contains the"
234 + elog "'nostrip' option to produce useful core dumps or back traces."
235 + fi
236 +
237 + elog
238 + if [[ -z "${REPLACING_VERSIONS}" ]]; then
239 + elog "To download and install an initial set of rules, run:"
240 + elog " suricata-update"
241 + fi
242 + elog
243 +}