Gentoo Archives: gentoo-commits

From: Matt Thode <prometheanfire@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: net-analyzer/icinga/files/, net-analyzer/icinga/
Date: Wed, 04 Nov 2015 23:11:34
Message-Id: 1446678656.a80a930bddca672f6fa5a51beacc9abd9c1fb6a2.prometheanfire@gentoo
1 commit: a80a930bddca672f6fa5a51beacc9abd9c1fb6a2
2 Author: Matthew Thode <prometheanfire <AT> gentoo <DOT> org>
3 AuthorDate: Wed Nov 4 23:10:56 2015 +0000
4 Commit: Matt Thode <prometheanfire <AT> gentoo <DOT> org>
5 CommitDate: Wed Nov 4 23:10:56 2015 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a80a930b
7
8 net-analyzer/icinga: actually fixing CVE-2015-8010 bug 564242
9
10 Package-Manager: portage-2.2.20.1
11
12 .../icinga/files/CVE-2015-8010_1.13.3.patch | 0
13 net-analyzer/icinga/icinga-1.13.3-r1.ebuild | 268 +++++++++++++++++++++
14 2 files changed, 268 insertions(+)
15
16 diff --git a/net-analyzer/icinga/files/CVE-2015-8010_1.13.3.patch b/net-analyzer/icinga/files/CVE-2015-8010_1.13.3.patch
17 new file mode 100644
18 index 0000000..e69de29
19
20 diff --git a/net-analyzer/icinga/icinga-1.13.3-r1.ebuild b/net-analyzer/icinga/icinga-1.13.3-r1.ebuild
21 new file mode 100644
22 index 0000000..9560c51
23 --- /dev/null
24 +++ b/net-analyzer/icinga/icinga-1.13.3-r1.ebuild
25 @@ -0,0 +1,268 @@
26 +# Copyright 1999-2015 Gentoo Foundation
27 +# Distributed under the terms of the GNU General Public License v2
28 +# $Id$
29 +
30 +EAPI=5
31 +
32 +inherit depend.apache eutils multilib pax-utils toolchain-funcs user versionator
33 +
34 +DESCRIPTION="Nagios Fork - Check daemon, CGIs, docs, IDOutils"
35 +HOMEPAGE="http://www.icinga.org/"
36 +#MY_PV=$(delete_version_separator 3)
37 +#SRC_URI="mirror://sourceforge/${PN}/${PN}-${MY_PV}.tar.gz"
38 +#S=${WORKDIR}/${PN}-${MY_PV}
39 +#SRC_URI="mirror://sourceforge/${PN}/${P}.tar.gz"
40 +SRC_URI="https://github.com/${PN}/${PN}-core/releases/download/v${PV}/${P}.tar.gz"
41 +
42 +LICENSE="GPL-2"
43 +SLOT="0"
44 +KEYWORDS="~amd64 ~hppa ~x86"
45 +IUSE="+apache2 contrib eventhandler +idoutils lighttpd +mysql perl +plugins postgres ssl +vim-syntax +web"
46 +DEPEND="idoutils? ( dev-db/libdbi-drivers[mysql?,postgres?] )
47 + perl? ( dev-lang/perl )
48 + virtual/mailx
49 + web? (
50 + media-libs/gd[jpeg,png]
51 + lighttpd? ( www-servers/lighttpd )
52 + )
53 + !net-analyzer/nagios-core"
54 +RDEPEND="${DEPEND}
55 + plugins? ( || (
56 + net-analyzer/monitoring-plugins
57 + net-analyzer/nagios-plugins
58 + ) )"
59 +RESTRICT="test"
60 +
61 +want_apache2
62 +
63 +pkg_setup() {
64 + depend.apache_pkg_setup
65 + enewgroup icinga
66 + enewgroup nagios
67 + enewuser icinga -1 -1 /var/lib/icinga "icinga,nagios"
68 +}
69 +
70 +src_prepare() {
71 + epatch "${FILESDIR}/fix-prestripped-binaries-1.7.0.patch"
72 + epatch "${FILESDIR}/CVE-2015-8010_1.13.3.patch"
73 +}
74 +
75 +src_configure() {
76 + local myconf
77 +
78 + myconf="$(use_enable perl embedded-perl)
79 + $(use_with perl perlcache)
80 + $(use_enable idoutils)
81 + $(use_enable ssl)
82 + --with-cgiurl=/icinga/cgi-bin
83 + --with-log-dir=/var/log/icinga
84 + --libdir=/usr/$(get_libdir)
85 + --bindir=/usr/sbin
86 + --sbindir=/usr/$(get_libdir)/icinga/cgi-bin
87 + --datarootdir=/usr/share/icinga/htdocs
88 + --localstatedir=/var/lib/icinga
89 + --sysconfdir=/etc/icinga
90 + --with-lockfile=/var/run/icinga/icinga.lock
91 + --with-temp-dir=/tmp/icinga
92 + --with-temp-file=/tmp/icinga/icinga.tmp"
93 +
94 + if use idoutils ; then
95 + myconf+=" --with-ido2db-lockfile=/var/run/icinga/ido2db.lock
96 + --with-icinga-chkfile=/var/lib/icinga/icinga.chk
97 + --with-ido-sockfile=/var/lib/icinga/ido.sock
98 + --with-idomod-tmpfile=/tmp/icinga/idomod.tmp"
99 + fi
100 +
101 + if use eventhandler ; then
102 + myconfig+=" --with-eventhandler-dir=/etc/icinga/eventhandlers"
103 + fi
104 +
105 + if use plugins ; then
106 + myconf+=" --with-plugin-dir=/usr/$(get_libdir)/nagios/plugins"
107 + else
108 + myconf+=" --with-plugin-dir=/usr/$(get_libdir)/nagios/plugins"
109 + fi
110 +
111 + if use !apache2 && use !lighttpd ; then
112 + myconf+=" --with-command-group=icinga"
113 + else
114 + if use apache2 ; then
115 + myconf+=" --with-httpd-conf=/etc/apache2/conf.d"
116 + myconf+=" --with-command-group=apache"
117 + elif use lighttpd ; then
118 + myconf+=" --with-command-group=lighttpd"
119 + fi
120 + fi
121 +
122 + econf ${myconf}
123 +}
124 +
125 +src_compile() {
126 + tc-export CC
127 +
128 + emake icinga || die "make failed"
129 +
130 + if use web ; then
131 + emake DESTDIR="${D}" cgis || die
132 + fi
133 +
134 + if use contrib ; then
135 + emake DESTDIR="${D}" -C contrib || die
136 + fi
137 +
138 + if use idoutils ; then
139 + emake DESTDIR="${D}" idoutils || die
140 + fi
141 +}
142 +
143 +src_install() {
144 + dodoc Changelog README UPGRADING || die
145 +
146 + if ! use web ; then
147 + sed -i -e '/cd $(SRC_\(CGI\|HTM\))/d' Makefile || die
148 + fi
149 +
150 + emake DESTDIR="${D}" install{,-config,-commandmode} || die
151 +
152 + if use idoutils ; then
153 + emake DESTDIR="${D}" install-idoutils || die
154 + fi
155 +
156 + if use contrib ; then
157 + emake DESTDIR="${D}" -C contrib install || die
158 + fi
159 +
160 + if use eventhandler ; then
161 + emake DESTDIR="${D}" install-eventhandlers || die
162 + fi
163 +
164 + newinitd "${FILESDIR}"/icinga-init.d icinga || die
165 + newconfd "${FILESDIR}"/icinga-conf.d icinga || die
166 + if use idoutils ; then
167 + newinitd "${FILESDIR}"/ido2db-init.d ido2db || die
168 + newconfd "${FILESDIR}"/ido2db-conf.d ido2db || die
169 + insinto /usr/share/icinga/contrib/db
170 + doins -r module/idoutils/db/* || die
171 + fi
172 + # Apache Module
173 + if use web ; then
174 + if use apache2 ; then
175 + insinto "${APACHE_MODULES_CONFDIR}"
176 + newins "${FILESDIR}"/icinga-apache.conf 99_icinga.conf || die
177 + elif use lighttpd ; then
178 + insinto /etc/lighttpd
179 + newins "${FILESDIR}"/icinga-lighty.conf lighttpd_icinga.conf || die
180 + else
181 + ewarn "${CATEGORY}/${PF} only supports Apache-2.x or Lighttpd webserver"
182 + ewarn "out-of-the-box. Since you are not using one of them, you"
183 + ewarn "have to configure your webserver accordingly yourself."
184 + fi
185 + fowners -R root:root /usr/$(get_libdir)/icinga || die
186 + cd "${D}" || die
187 + find usr/$(get_libdir)/icinga -type d -exec fperms 755 {} +
188 + find usr/$(get_libdir)/icinga/cgi-bin -type f -exec fperms 755 {} +
189 + fi
190 +
191 + if use eventhandler ; then
192 + dodir /etc/icinga/eventhandlers || die
193 + fowners icinga:icinga /etc/icinga/eventhandlers || die
194 + fi
195 +
196 + keepdir /etc/icinga
197 + keepdir /var/lib/icinga
198 + keepdir /var/lib/icinga/archives
199 + keepdir /var/lib/icinga/rw
200 + keepdir /var/lib/icinga/spool/checkresults
201 +
202 + if use apache2 ; then
203 + webserver=apache
204 + elif use lighttpd ; then
205 + webserver=lighttpd
206 + else
207 + webserver=icinga
208 + fi
209 +
210 + fowners icinga:icinga /var/lib/icinga || die "Failed chown of /var/lib/icinga"
211 + fowners -R icinga:${webserver} /var/lib/icinga/rw || die "Failed chown of /var/lib/icinga/rw"
212 +
213 + fperms 6755 /var/lib/icinga/rw || die "Failed Chmod of ${D}/var/lib/icinga/rw"
214 + fperms 0750 /etc/icinga || die "Failed chmod of ${D}/etc/icinga"
215 +
216 + # paxmarks
217 + if use idoutils ; then
218 + pax-mark m usr/sbin/ido2db
219 + fi
220 +}
221 +
222 +pkg_postinst() {
223 + if use web ; then
224 + elog "This does not include cgis that are perl-dependent"
225 + elog "Currently traceroute.cgi is perl-dependent"
226 + elog "Note that the user your webserver is running as needs"
227 + elog "read-access to /etc/icinga."
228 + elog
229 + if use apache2 || use lighttpd ; then
230 + elog "There are several possible solutions to accomplish this,"
231 + elog "choose the one you are most comfortable with:"
232 + elog
233 + if use apache2 ; then
234 + elog " usermod -G icinga apache"
235 + elog "or"
236 + elog " chown icinga:apache /etc/icinga"
237 + elog
238 + elog "Also edit /etc/conf.d/apache2 and add a line like"
239 + elog "APACHE2_OPTS=\"\$APACHE2_OPTS -D ICINGA\""
240 + elog
241 + elog "Icinga web service needs user authentication. If you"
242 + elog "use the base configuration, you need a password file"
243 + elog "with a password for user \"icingaadmin\""
244 + elog "You can create this file by executing:"
245 + elog "htpasswd -c /etc/icinga/htpasswd.users icingaadmin"
246 + elog
247 + elog "you may want to also add apache to the icinga group"
248 + elog "to allow it access to the AuthUserFile"
249 + elog
250 + elif use lighttpd ; then
251 + elog " usermod -G icinga lighttpd "
252 + elog "or"
253 + elog " chown icinga:lighttpd /etc/icinga"
254 + elog "Also edit /etc/lighttpd/lighttpd.conf and add 'include \"lighttpd_icinga.conf\"'"
255 + fi
256 + elog
257 + elog "That will make icinga's web front end visable via"
258 + elog "http://localhost/icinga/"
259 + elog
260 + else
261 + elog "IMPORTANT: Do not forget to add the user your webserver"
262 + elog "is running as to the icinga group!"
263 + fi
264 + else
265 + ewarn "Please note that you have installed Icinga without web interface."
266 + ewarn "Please don't file any bugs about having no web interface when you do this."
267 + ewarn "Thank you!"
268 + fi
269 + elog
270 + elog "If you want icinga to start at boot time"
271 + elog "remember to execute:"
272 + elog " rc-update add icinga default"
273 + elog
274 + elog "If your kernel has /proc protection, icinga"
275 + elog "will not be happy as it relies on accessing the proc"
276 + elog "filesystem. You can fix this by adding icinga into"
277 + elog "the group wheel, but this is not recomended."
278 + elog
279 + if [ -d "${ROOT}"/var/icinga ] ; then
280 + ewarn
281 + ewarn "/var/icinga was moved to /var/lib/icinga"
282 + ewarn "please move the files if this was an upgrade"
283 + if use idoutils ; then
284 + ewarn "and edit /etc/ido2db.cfg to change the location of the files"
285 + ewarn "it accesses"
286 + ewarn "update your db with the scripts under the directory"
287 + ewarn "/usr/share/icinga/contrib/db/"
288 + fi
289 + ewarn
290 + ewarn "The \"mv /var/icinga /var/lib/\" command works well to move the files"
291 + ewarn "remove /var/icinga afterwards to make this warning disappear"
292 + fi
293 +}