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