Gentoo Archives: gentoo-commits

From: Michael Orlitzky <mjo@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: net-analyzer/nagios-core/
Date: Mon, 26 Sep 2016 13:25:49
Message-Id: 1474896246.fd0af54b57b1e8ed789373779ff560e87356dc24.mjo@gentoo
1 commit: fd0af54b57b1e8ed789373779ff560e87356dc24
2 Author: Michael Orlitzky <mjo <AT> gentoo <DOT> org>
3 AuthorDate: Mon Sep 26 13:22:03 2016 +0000
4 Commit: Michael Orlitzky <mjo <AT> gentoo <DOT> org>
5 CommitDate: Mon Sep 26 13:24:06 2016 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=fd0af54b
7
8 net-analyzer/nagios-core: new version v4.2.1 with security fixes.
9
10 This new version adds fixes for CVE-2008-4796 and CVE-2013-4214.
11 The ebuild itself was updated to EAPI=6. That required dropping the
12 depend.apache eclass, but that eclass was only used to define the
13 $APACHE2_MODULES_CONFDIR variable, and it was easily inlined. The
14 eutils and multilib eclasses were also dropped; the former because our
15 patches are now obsolete, and the latter because get_libdir() is in
16 EAPI=6.
17
18 Gentoo-Bug: 595194
19
20 Package-Manager: portage-2.2.28
21
22 net-analyzer/nagios-core/Manifest | 1 +
23 net-analyzer/nagios-core/nagios-core-4.2.1.ebuild | 248 ++++++++++++++++++++++
24 2 files changed, 249 insertions(+)
25
26 diff --git a/net-analyzer/nagios-core/Manifest b/net-analyzer/nagios-core/Manifest
27 index 9927c29..05969ae 100644
28 --- a/net-analyzer/nagios-core/Manifest
29 +++ b/net-analyzer/nagios-core/Manifest
30 @@ -1,4 +1,5 @@
31 DIST nagios-3.5.1.tar.gz 1763584 SHA256 ca9dd68234fa090b3c35ecc8767b2c9eb743977eaf32612fa9b8341cc00a0f99 SHA512 48e2ecb91002b08203937b12a438c87c62cd3c5c401a0ed9e861cd6d79074c7017ed373e9379f013d87dea1fd7cb8e3d85112d55c87ac91aed96b256868c112d WHIRLPOOL 2c02584702c64dbb0e353e34b758fab079eee0dc7a401e7b5947a21733758d3596401e5519e2dd7f05c89ee4835c21965d2718157fd9d6d3d20af9c853d688ca
32 DIST nagios-4.0.8.tar.gz 1805059 SHA256 8b268d250c97851775abe162f46f64724f95f367d752ae4630280cc5d368ca4b SHA512 d72fdbcc0beb2de72e5aa788b4ccc83aa30c7f4a4460edaa831f012db04647e4836b876bb7dc235e2a1b525827e9a2a0f4d348919f69fbfbfdaa4d13e968e18c WHIRLPOOL bdd9c63e0e495073b7b046952baa50b9e448fa56cda167806546a3b58fdd8fad328c9285ebb6d07da81786676d805671cad7295be389c4b8a4f3971264c97f74
33 DIST nagios-4.1.1.tar.gz 11142182 SHA256 58218e5e66c8078fc578a60db33b5c3da10fc6a793e97d2b00780517e3efa0a7 SHA512 09e7c335666efd7180dcc8766abfdc6482f9ef4dceb4bee076b99652c04cb2e04555a1afeec2e6ef8c5556f7ae8fb684e17db0aa5e869915e4684af2c2183565 WHIRLPOOL 4b03cb5193284a32a6b0dc979849b7ab31f903f628b449953807b18401307cd7290b91296407d5ce21ebdcd8d7f4d8ed047ea99e0c307327f41fe6b3a69a5b46
34 +DIST nagios-4.2.1.tar.gz 11155576 SHA256 cb62c5c16964cfc143b126a576a7f8130e634cb9dda4dd3bd3632598d7855a87 SHA512 9d68c18fe272e9b6fc131c686ee031c115ee2916af1c112f73744bc73202d0d6799aa30828db701e78b1c62013b9f871083c004c8317942df239afe6c6a72a36 WHIRLPOOL 389293718261097af480325075aa03e2348f109261ff63c6df66a3104ebd36b1161250150e8518b51ed29892e8b14892a7ba54ba41a6ddbdf51d626d5fccbeef
35 DIST nagios-core-gentoo-icons-20141125.tar 40960 SHA256 68b715f636eb291343cab3259862bbed8b6b898520b58df522438524de3d8761 SHA512 bf109879cddd6136b76baba55d0b60b2596e37431dcf5ce0905d34a9fa292ebf7e4bde82d9a084362c486e8fac344c76d88f9298b1b85541ed70ffd608493766 WHIRLPOOL 7ec3a944b2a659b456d3168818ca5b1af3a427436e6af2f3e5d6cba6fc7b1c7bad6f552301f064df31988865b3b32fd117d9e6f61c630d6d817a51cbbbcb331d
36
37 diff --git a/net-analyzer/nagios-core/nagios-core-4.2.1.ebuild b/net-analyzer/nagios-core/nagios-core-4.2.1.ebuild
38 new file mode 100644
39 index 00000000..f3d1d3e
40 --- /dev/null
41 +++ b/net-analyzer/nagios-core/nagios-core-4.2.1.ebuild
42 @@ -0,0 +1,248 @@
43 +# Copyright 1999-2016 Gentoo Foundation
44 +# Distributed under the terms of the GNU General Public License v2
45 +# $Id$
46 +
47 +EAPI=6
48 +
49 +inherit toolchain-funcs user
50 +
51 +MY_P=${PN/-core}-${PV}
52 +DESCRIPTION="Nagios core - monitoring daemon, web GUI, and documentation"
53 +HOMEPAGE="http://www.nagios.org/"
54 +
55 +# The name of the directory into which our Gentoo icons will be
56 +# extracted, and also the basename of the archive containing it.
57 +GENTOO_ICONS="${PN}-gentoo-icons-20141125"
58 +SRC_URI="mirror://sourceforge/nagios/${MY_P}.tar.gz
59 + web? ( https://dev.gentoo.org/~mjo/distfiles/${GENTOO_ICONS}.tar )"
60 +
61 +LICENSE="GPL-2"
62 +SLOT="0"
63 +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ppc ~ppc64 ~sparc ~x86"
64 +IUSE="apache2 classicui lighttpd perl +web vim-syntax"
65 +
66 +# In pkg_postinst(), we change the group of the Nagios configuration
67 +# directory to that of the web server user. It can't belong to both
68 +# apache/lighttpd groups at the same time, so we block this combination
69 +# for our own sanity.
70 +#
71 +# This could be made to work, but we would need a better way to allow
72 +# the web user read-only access to Nagios's configuration directory.
73 +#
74 +REQUIRED_USE="apache2? ( !lighttpd )"
75 +
76 +# sys-devel/libtool dependency is bug #401237.
77 +#
78 +# Note, we require one of the apache2 CGI modules:
79 +#
80 +# * mod_cgi
81 +# * mod_cgid
82 +# * mod_fcgid
83 +#
84 +# We just don't care /which/ one. And of course PHP supports both CGI
85 +# (USE=cgi) and FastCGI (USE=fpm). We're pretty lenient with the
86 +# dependencies, and expect the user not to do anything /too/
87 +# stupid. (For example, installing Apache with only FastCGI support, and
88 +# PHP with only CGI support.)
89 +#
90 +# Another annoyance is that the upstream Makefile uses app-arch/unzip to
91 +# extract a snapshot of AngularJS, but that's only needed when USE=web.
92 +#
93 +MOD_ALIAS=apache2_modules_alias
94 +DEPEND="sys-devel/libtool
95 + virtual/mailx
96 + perl? ( dev-lang/perl )
97 + web? (
98 + app-arch/unzip
99 + media-libs/gd[jpeg,png]
100 + lighttpd? ( www-servers/lighttpd[php] )
101 + apache2? (
102 + || (
103 + >=www-servers/apache-2.4[${MOD_ALIAS},apache2_modules_cgi]
104 + >=www-servers/apache-2.4[${MOD_ALIAS},apache2_modules_cgid]
105 + >=www-servers/apache-2.4[${MOD_ALIAS},apache2_modules_fcgid] )
106 + || (
107 + dev-lang/php:*[apache2]
108 + dev-lang/php:*[cgi]
109 + dev-lang/php:*[fpm] )
110 + )
111 + )"
112 +RDEPEND="${DEPEND}
113 + vim-syntax? ( app-vim/nagios-syntax )"
114 +
115 +S="${WORKDIR}/${MY_P}"
116 +
117 +pkg_setup() {
118 + enewgroup nagios
119 + enewuser nagios -1 /bin/bash /var/nagios/home nagios
120 +}
121 +
122 +src_configure() {
123 + local myconf
124 +
125 + if use perl; then
126 + myconf="${myconf} --enable-embedded-perl --with-perlcache"
127 + fi
128 +
129 + if use !apache2 && use !lighttpd ; then
130 + myconf="${myconf} --with-command-group=nagios"
131 + else
132 + if use apache2 ; then
133 + myconf="${myconf} --with-command-group=apache"
134 + myconf="${myconf} --with-httpd-conf=/etc/apache2/conf.d"
135 + elif use lighttpd ; then
136 + myconf="${myconf} --with-command-group=lighttpd"
137 + fi
138 + fi
139 +
140 + econf ${myconf} \
141 + --prefix=/usr \
142 + --bindir=/usr/sbin \
143 + --sbindir=/usr/$(get_libdir)/nagios/cgi-bin \
144 + --datadir=/usr/share/nagios/htdocs \
145 + --localstatedir=/var/nagios \
146 + --sysconfdir=/etc/nagios \
147 + --libexecdir=/usr/$(get_libdir)/nagios/plugins
148 +}
149 +
150 +src_compile() {
151 + emake CC=$(tc-getCC) nagios
152 +
153 + if use web; then
154 + # Only compile the CGIs/HTML when USE=web is set.
155 + emake CC=$(tc-getCC) DESTDIR="${D}" cgis html
156 + fi
157 +}
158 +
159 +src_install() {
160 + dodoc Changelog INSTALLING LEGAL README.asciidoc UPGRADING
161 +
162 + emake DESTDIR="${D}" install-base
163 + emake DESTDIR="${D}" install-basic
164 + emake DESTDIR="${D}" install-config
165 + emake DESTDIR="${D}" install-commandmode
166 +
167 + if use web; then
168 + emake DESTDIR="${D}" install-cgis
169 +
170 + # install-html installs the new exfoliation theme
171 + emake DESTDIR="${D}" install-html
172 +
173 + if use classicui; then
174 + # This overwrites the already-installed exfoliation theme
175 + emake DESTDIR="${D}" install-classicui
176 + fi
177 +
178 + # Install cute Gentoo icons (bug #388323), setting their
179 + # owner, group, and mode to match those of the rest of Nagios's
180 + # images.
181 + insopts --group=nagios --owner=nagios --mode=0664
182 + insinto /usr/share/nagios/htdocs/images/logos
183 + doins "${WORKDIR}/${GENTOO_ICONS}"/*.*
184 + insopts --mode=0644 # Back to the default...
185 + fi
186 +
187 + newinitd "${FILESDIR}"/nagios4 nagios
188 + newconfd "${FILESDIR}"/conf.d nagios
189 +
190 + if use web ; then
191 + if use apache2 ; then
192 + # Install the Nagios configuration file for Apache.
193 + insinto "/etc/apache2/modules.d"
194 + doins "${FILESDIR}"/99_nagios4.conf
195 + elif use lighttpd ; then
196 + # Install the Nagios configuration file for Lighttpd.
197 + insinto /etc/lighttpd
198 + newins "${FILESDIR}/lighttpd_nagios4.conf" nagios.conf
199 + else
200 + ewarn "${CATEGORY}/${PF} only supports apache or lighttpd"
201 + ewarn "out of the box. Since you are not using one of them, you"
202 + ewarn "will have to configure your webserver yourself."
203 + fi
204 + fi
205 +
206 + for dir in etc/nagios var/nagios ; do
207 + chown -R nagios:nagios "${D}/${dir}" \
208 + || die "failed chown of ${D}/${dir}"
209 + done
210 +
211 + chown -R root:root "${D}/usr/$(get_libdir)/nagios" \
212 + || die "failed chown of ${D}/usr/$(get_libdir)/nagios"
213 +
214 + # The following two find...exec statements will die properly as long
215 + # as chmod is only called once (that is, as long as the argument
216 + # list is small enough).
217 + find "${D}/usr/$(get_libdir)/nagios" -type d \
218 + -exec chmod 755 '{}' + || die 'failed to make nagios dirs traversable'
219 +
220 + if use web; then
221 + find "${D}/usr/$(get_libdir)/nagios/cgi-bin" -type f \
222 + -exec chmod 755 '{}' + || die 'failed to make cgi-bins executable'
223 + fi
224 +
225 + keepdir /etc/nagios
226 + keepdir /var/nagios
227 + keepdir /var/nagios/archives
228 + keepdir /var/nagios/rw
229 + keepdir /var/nagios/spool/checkresults
230 +
231 + if use !apache2 && use !lighttpd; then
232 + chown -R nagios:nagios "${D}"/var/nagios/rw \
233 + || die "failed chown of ${D}/var/nagios/rw"
234 + else
235 + if use apache2 ; then
236 + chown -R nagios:apache "${D}"/var/nagios/rw \
237 + || die "failed chown of ${D}/var/nagios/rw"
238 + elif use lighttpd ; then
239 + chown -R nagios:lighttpd "${D}"/var/nagios/rw \
240 + || die "failed chown of ${D}/var/nagios/rw"
241 + fi
242 + fi
243 +
244 + chmod ug+s "${D}"/var/nagios/rw || die "failed chmod of ${D}/var/nagios/rw"
245 + chmod 0750 "${D}"/etc/nagios || die "failed chmod of ${D}/etc/nagios"
246 +}
247 +
248 +pkg_postinst() {
249 +
250 + if use web; then
251 + elog "Note that your web server user requires read-only access to"
252 + elog "${ROOT}etc/nagios."
253 +
254 + if use apache2 || use lighttpd ; then
255 + elog
256 + elog "To that end, we have changed the group of ${ROOT}etc/nagios"
257 + elog "to that of your web server user."
258 + elog
259 + if use apache2; then
260 + chown nagios:apache "${ROOT}etc/nagios" \
261 + || die "failed to change group of ${ROOT}etc/nagios"
262 +
263 + elog "To enable the Nagios web front-end, please edit"
264 + elog "${ROOT}etc/conf.d/apache2 and add \"-D NAGIOS -D PHP5\""
265 + elog "to APACHE2_OPTS. Then Nagios will be available at,"
266 + elog
267 + elif use lighttpd; then
268 + chown nagios:lighttpd "${ROOT}etc/nagios" \
269 + || die "failed to change group of ${ROOT}etc/nagios"
270 + elog "To enable the Nagios web front-end, please add"
271 + elog "'include \"nagios.conf\"' to the lighttpd configuration"
272 + elog "file at ${ROOT}etc/lighttpd/lighttpd.conf. Then Nagios"
273 + elog "will be available at,"
274 + elog
275 + fi
276 +
277 + elog " http://localhost/nagios/"
278 + else
279 + elog "Since you're not using either Apache or Lighttpd, you"
280 + elog "will have to grant the necessary permissions yourself."
281 + fi
282 + fi
283 +
284 + elog
285 + elog "If your kernel has /proc protection, nagios"
286 + elog "will not be happy as it relies on accessing the proc"
287 + elog "filesystem. You can fix this by adding nagios into"
288 + elog "the group wheel, but this is not recomended."
289 + elog
290 +}