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