Gentoo Archives: gentoo-commits

From: Jeroen Roovers <jer@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: net-analyzer/snort/
Date: Sun, 15 Dec 2019 11:56:01
Message-Id: 1576410956.00751515b5fa5f6a499b51d827ad7305365792af.jer@gentoo
1 commit: 00751515b5fa5f6a499b51d827ad7305365792af
2 Author: Jeroen Roovers <jer <AT> gentoo <DOT> org>
3 AuthorDate: Sun Dec 15 11:55:37 2019 +0000
4 Commit: Jeroen Roovers <jer <AT> gentoo <DOT> org>
5 CommitDate: Sun Dec 15 11:55:56 2019 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=00751515
7
8 net-analyzer/snort: Version 2.9.15
9
10 Package-Manager: Portage-2.3.81, Repoman-2.3.20
11 Signed-off-by: Jeroen Roovers <jer <AT> gentoo.org>
12
13 net-analyzer/snort/Manifest | 1 +
14 net-analyzer/snort/snort-2.9.15.ebuild | 258 +++++++++++++++++++++++++++++++++
15 2 files changed, 259 insertions(+)
16
17 diff --git a/net-analyzer/snort/Manifest b/net-analyzer/snort/Manifest
18 index dee8cd9c2d8..0e5321e5027 100644
19 --- a/net-analyzer/snort/Manifest
20 +++ b/net-analyzer/snort/Manifest
21 @@ -1,2 +1,3 @@
22 DIST snort-2.9.12.tar.gz 6456877 BLAKE2B af5584fe01caf9af2f2188e1362bd927a884354ddcb3026af514dddc1264b557691e1644d3c24e85c3b5b5f515dd9fccdd8d38ebc7c28d2f384fb822e27d8bb8 SHA512 6f759b321ca5496abf27c9e4f4fa003cd5167f8c8a160bf5f0b1aee1a93aa8d27de89b84bdf993a0bfb3a93c6315cb2bdbdc3fdb3b09b8d4d1d3c22b69c6783f
23 +DIST snort-2.9.15.tar.gz 6704763 BLAKE2B adef13e3368dbbb9e023d79ec4f75c9652af8d26642b83f1f413e39faf966281b09713854e3a8aa385647b375102a667b10ee96d6f1cebb2f92c9fc7f29a2eb5 SHA512 21830dc4c9ce7b5bc96defa800f78de6ad24c1ab96dbeab0d79a7bf4298a81d6bdb4be8fd3bbec3b28b33aa7bb27cdc48a2a00b33c494f68d1649bc609928eea
24 DIST snort-2.9.8.3.tar.gz 6244304 BLAKE2B cb77c80dde0b5b32ba0fe36cd07e1f6f465127e4be207ba6cd3b7c7dff75f4537c86c6a88d744a924b99d0b4ac864add2c9111c63e51dc4c7dc23f8d19a6c792 SHA512 2f3dfe46e14a5106a02ca60b2d334549f4924ff916de0804b2b7792cdd31e104fbb454b4b932855b5f25a861698db0f8988844782b12b0e5fa132d88d4a7a687
25
26 diff --git a/net-analyzer/snort/snort-2.9.15.ebuild b/net-analyzer/snort/snort-2.9.15.ebuild
27 new file mode 100644
28 index 00000000000..e9688b46d28
29 --- /dev/null
30 +++ b/net-analyzer/snort/snort-2.9.15.ebuild
31 @@ -0,0 +1,258 @@
32 +# Copyright 1999-2019 Gentoo Authors
33 +# Distributed under the terms of the GNU General Public License v2
34 +
35 +EAPI=7
36 +inherit autotools user systemd tmpfiles multilib
37 +
38 +DESCRIPTION="The de facto standard for intrusion detection/prevention"
39 +HOMEPAGE="https://www.snort.org"
40 +SRC_URI="https://www.snort.org/downloads/archive/${PN}/${P}.tar.gz"
41 +LICENSE="GPL-2"
42 +SLOT="0"
43 +KEYWORDS="~amd64 ~arm ~mips ~ppc ~ppc64 ~sparc ~x86"
44 +IUSE="static +gre +ppm +perfprofiling
45 ++non-ether-decoders control-socket file-inspect high-availability
46 +shared-rep side-channel sourcefire linux-smp-stats inline-init-failopen
47 ++threads debug +active-response reload-error-restart open-appid
48 ++react +flexresp3 large-pcap-64bit selinux +libtirpc"
49 +
50 +DEPEND=">=net-libs/libpcap-1.3.0
51 + >=net-libs/daq-2.0.2
52 + >=dev-libs/libpcre-8.33
53 + dev-libs/libdnet
54 + net-libs/libnsl:0=
55 + sys-libs/zlib
56 + !libtirpc? ( sys-libs/glibc[rpc(-)] )
57 + libtirpc? ( net-libs/libtirpc )
58 + open-appid? ( dev-lang/luajit:= )
59 +"
60 +
61 +RDEPEND="${DEPEND}
62 + selinux? ( sec-policy/selinux-snort )"
63 +
64 +REQUIRED_USE="!kernel_linux? ( !shared-rep )"
65 +
66 +PATCHES=(
67 + "${FILESDIR}"/${PN}-2.9.8.3-no-implicit.patch
68 + "${FILESDIR}"/${PN}-2.9.8.3-rpc.patch
69 + "${FILESDIR}"/${PN}-2.9.12-snort.pc.patch
70 +)
71 +
72 +pkg_setup() {
73 + # pre_inst() is a better place to put this
74 + # but we need it here for the 'fowners' statements in src_install()
75 + enewgroup snort
76 + enewuser snort -1 -1 /dev/null snort
77 +
78 +}
79 +
80 +src_prepare() {
81 + default
82 +
83 + # Multilib fix for the sf_engine
84 + ebegin "Applying multilib fix"
85 + sed -i -e 's|${exec_prefix}/lib|${exec_prefix}/'$(get_libdir)'|g' \
86 + "${WORKDIR}/${P}/src/dynamic-plugins/sf_engine/Makefile.am" \
87 + || die "sed for sf_engine failed"
88 +
89 + # Multilib fix for the curent set of dynamic-preprocessors
90 + for i in file ftptelnet smtp ssh dns ssl dcerpc2 sdf imap pop sip reputation gtp modbus dnp3; do
91 + sed -i -e 's|${exec_prefix}/lib|${exec_prefix}/'$(get_libdir)'|g' \
92 + "${WORKDIR}/${P}/src/dynamic-preprocessors/$i/Makefile.am" \
93 + || die "sed for $i failed."
94 + done
95 + eend
96 +
97 + mv configure.{in,ac} || die
98 +
99 + AT_M4DIR=m4 eautoreconf
100 +}
101 +
102 +src_configure() {
103 + econf \
104 + $(use_enable !static shared) \
105 + $(use_enable static) \
106 + $(use_enable static so-with-static-lib) \
107 + $(use_enable gre) \
108 + $(use_enable control-socket) \
109 + $(use_enable file-inspect) \
110 + $(use_enable high-availability ha) \
111 + $(use_enable non-ether-decoders) \
112 + $(use_enable shared-rep) \
113 + $(use_enable side-channel) \
114 + $(use_enable sourcefire) \
115 + $(use_enable ppm) \
116 + $(use_enable perfprofiling) \
117 + $(use_enable linux-smp-stats) \
118 + $(use_enable inline-init-failopen) \
119 + $(use_enable open-appid) \
120 + $(use_enable threads pthread) \
121 + $(use_enable debug) \
122 + $(use_enable debug debug-msgs) \
123 + $(use_enable debug corefiles) \
124 + $(use_enable !debug dlclose) \
125 + $(use_enable active-response) \
126 + $(use_enable reload-error-restart) \
127 + $(use_enable react) \
128 + $(use_enable flexresp3) \
129 + $(use_enable large-pcap-64bit large-pcap) \
130 + $(use_with libtirpc) \
131 + --enable-mpls \
132 + --enable-normalizer \
133 + --enable-reload \
134 + --enable-targetbased \
135 + --disable-build-dynamic-examples \
136 + --disable-profile \
137 + --disable-ppm-test \
138 + --disable-intel-soft-cpm \
139 + --disable-static-daq
140 +}
141 +
142 +src_install() {
143 + default
144 +
145 + keepdir /var/log/snort \
146 + /etc/snort/rules \
147 + /etc/snort/so_rules \
148 + /usr/$(get_libdir)/snort_dynamicrules
149 +
150 + # config.log and build.log are needed by Sourcefire
151 + # to trouble shoot build problems and bug reports so we are
152 + # perserving them incase the user needs upstream support.
153 + dodoc RELEASE.NOTES ChangeLog \
154 + doc/* \
155 + tools/u2boat/README.u2boat
156 +
157 + insinto /etc/snort
158 + doins etc/attribute_table.dtd \
159 + etc/classification.config \
160 + etc/gen-msg.map \
161 + etc/reference.config \
162 + etc/threshold.conf \
163 + etc/unicode.map
164 +
165 + # We use snort.conf.distrib because the config file is complicated
166 + # and the one shipped with snort can change drastically between versions.
167 + # Users should migrate setting by hand and not with etc-update.
168 + newins etc/snort.conf snort.conf.distrib
169 +
170 + # config.log and build.log are needed by Sourcefire
171 + # to troubleshoot build problems and bug reports so we are
172 + # preserving them incase the user needs upstream support.
173 + if [ -f "${WORKDIR}/${PF}/config.log" ]; then
174 + dodoc "${WORKDIR}/${PF}/config.log"
175 + fi
176 + if [ -f "${T}/build.log" ]; then
177 + dodoc "${T}/build.log"
178 + fi
179 +
180 + insinto /etc/snort/preproc_rules
181 + doins preproc_rules/decoder.rules \
182 + preproc_rules/preprocessor.rules \
183 + preproc_rules/sensitive-data.rules
184 +
185 + fowners -R snort:snort \
186 + /var/log/snort \
187 + /etc/snort
188 +
189 + newinitd "${FILESDIR}/snort.rc12" snort
190 + newconfd "${FILESDIR}/snort.confd.2" snort
191 + systemd_newunit "${FILESDIR}/snort_at.service" "snort@.service"
192 +
193 + newtmpfiles "${FILESDIR}"/snort.tmpfiles snort.conf
194 +
195 + # Sourcefire uses Makefiles to install docs causing Bug #297190.
196 + # This removes the unwanted doc directory and rogue Makefiles.
197 + rm -rf "${ED%/}"/usr/share/doc/snort || die "Failed to remove SF doc directories"
198 + rm "${ED%/}"/usr/share/doc/"${PF}"/Makefile* || die "Failed to remove doc make files"
199 +
200 + # Remove unneeded .la files (Bug #382863)
201 + rm "${ED%/}"/usr/$(get_libdir)/snort_dynamicengine/libsf_engine.la || die
202 + rm "${ED%/}"/usr/$(get_libdir)/snort_dynamicpreprocessor/libsf_*_preproc.la || die "Failed to remove libsf_?_preproc.la"
203 +
204 + # Set the correct lib path for dynamicengine, dynamicpreprocessor, and dynamicdetection
205 + sed -i -e 's|/usr/local/lib|/usr/'$(get_libdir)'|g' \
206 + "${ED%/}/etc/snort/snort.conf.distrib" || die
207 +
208 + # Set the correct rule location in the config
209 + sed -i -e 's|RULE_PATH ../rules|RULE_PATH /etc/snort/rules|g' \
210 + "${ED%/}/etc/snort/snort.conf.distrib" || die
211 +
212 + # Set the correct preprocessor/decoder rule location in the config
213 + sed -i -e 's|PREPROC_RULE_PATH ../preproc_rules|PREPROC_RULE_PATH /etc/snort/preproc_rules|g' \
214 + "${ED%/}/etc/snort/snort.conf.distrib" || die
215 +
216 + # Enable the preprocessor/decoder rules
217 + sed -i -e 's|^# include $PREPROC_RULE_PATH|include $PREPROC_RULE_PATH|g' \
218 + "${ED%/}/etc/snort/snort.conf.distrib" || die
219 +
220 + sed -i -e 's|^# dynamicdetection directory|dynamicdetection directory|g' \
221 + "${ED%/}/etc/snort/snort.conf.distrib" || die
222 +
223 + # Just some clean up of trailing /'s in the config
224 + sed -i -e 's|snort_dynamicpreprocessor/$|snort_dynamicpreprocessor|g' \
225 + "${ED%/}/etc/snort/snort.conf.distrib" || die
226 +
227 + # Make it clear in the config where these are...
228 + sed -i -e 's|^include classification.config|include /etc/snort/classification.config|g' \
229 + "${ED%/}/etc/snort/snort.conf.distrib" || die
230 +
231 + sed -i -e 's|^include reference.config|include /etc/snort/reference.config|g' \
232 + "${ED%/}/etc/snort/snort.conf.distrib" || die
233 +
234 + # Disable all rule files by default.
235 + sed -i -e 's|^include $RULE_PATH|# include $RULE_PATH|g' \
236 + "${ED%}/etc/snort/snort.conf.distrib" || die
237 +
238 + # Set the configured DAQ to afpacket
239 + sed -i -e 's|^# config daq: <type>|config daq: afpacket|g' \
240 + "${ED%}/etc/snort/snort.conf.distrib" || die
241 +
242 + # Set the location of the DAQ modules
243 + sed -i -e 's|^# config daq_dir: <dir>|config daq_dir: /usr/'$(get_libdir)'/daq|g' \
244 + "${ED%}/etc/snort/snort.conf.distrib" || die
245 +
246 + # Set the DAQ mode to passive
247 + sed -i -e 's|^# config daq_mode: <mode>|config daq_mode: passive|g' \
248 + "${ED%}/etc/snort/snort.conf.distrib" || die
249 +
250 + # Set snort to run as snort:snort
251 + sed -i -e 's|^# config set_gid:|config set_gid: snort|g' \
252 + "${ED%/}/etc/snort/snort.conf.distrib" || die
253 + sed -i -e 's|^# config set_uid:|config set_uid: snort|g' \
254 + "${ED%/}/etc/snort/snort.conf.distrib" || die
255 +
256 + # Set the default log dir
257 + sed -i -e 's|^# config logdir:|config logdir: /var/log/snort/|g' \
258 + "${ED%/}/etc/snort/snort.conf.distrib" || die
259 +
260 + # Set the correct so_rule location in the config
261 + sed -i -e 's|SO_RULE_PATH ../so_rules|SO_RULE_PATH /etc/snort/so_rules|g' \
262 + "${ED%/}/etc/snort/snort.conf.distrib" || die
263 +}
264 +
265 +pkg_postinst() {
266 + tmpfiles_process snort.conf
267 +
268 + einfo "There have been a number of improvements and new features"
269 + einfo "added to ${P}. Please review the RELEASE.NOTES and"
270 + einfo "ChangLog located in /usr/share/doc/${PF}."
271 + einfo
272 + elog "The Sourcefire Vulnerability Research Team (VRT) recommends that"
273 + elog "users migrate their snort.conf customizations to the latest config"
274 + elog "file released by the VRT. You can find the latest version of the"
275 + elog "Snort config file in /etc/snort/snort.conf.distrib."
276 + elog
277 + elog "!! It is important that you migrate to this new snort.conf file !!"
278 + elog
279 + elog "This version of the ebuild includes an updated init.d file and"
280 + elog "conf.d file that rely on options found in the latest Snort"
281 + elog "config file provided by the VRT."
282 +
283 + if use debug; then
284 + elog "You have the 'debug' USE flag enabled. If this has been done to"
285 + elog "troubleshoot an issue by producing a core dump or a back trace,"
286 + elog "then you need to also ensure the FEATURES variable in make.conf"
287 + elog "contains the 'nostrip' option."
288 + fi
289 +}