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