diff options
author | Stuart Shelton <stuart@shelton.me> | 2017-08-19 13:41:49 +0100 |
---|---|---|
committer | Stuart Shelton <stuart@shelton.me> | 2017-08-19 16:11:19 +0100 |
commit | 223be1a4712a05dedd40c1993114a47af89a28c6 (patch) | |
tree | 8f90eabe972f2400fdec877e8c9d6701af5f2ff3 /net-analyzer | |
parent | Add dev-libs/popt-1.16-r2, update README.md (diff) | |
download | srcshelton-223be1a4712a05dedd40c1993114a47af89a28c6.tar.gz srcshelton-223be1a4712a05dedd40c1993114a47af89a28c6.tar.bz2 srcshelton-223be1a4712a05dedd40c1993114a47af89a28c6.zip |
Add net-analyzer/nagios-core-4.3.3, update README.md
Diffstat (limited to 'net-analyzer')
-rw-r--r-- | net-analyzer/nagios-core/Manifest | 5 | ||||
-rw-r--r-- | net-analyzer/nagios-core/files/99_nagios4.conf | 16 | ||||
-rw-r--r-- | net-analyzer/nagios-core/files/lighttpd_nagios4.conf | 15 | ||||
-rw-r--r-- | net-analyzer/nagios-core/nagios-core-4.3.3.ebuild | 247 |
4 files changed, 283 insertions, 0 deletions
diff --git a/net-analyzer/nagios-core/Manifest b/net-analyzer/nagios-core/Manifest new file mode 100644 index 00000000..9ca12d7c --- /dev/null +++ b/net-analyzer/nagios-core/Manifest @@ -0,0 +1,5 @@ +AUX 99_nagios4.conf 368 SHA256 cae38c4b5f298c72807e14b66e8cb69bbcbca56edb127c37acf719d26f016fe8 SHA512 f0b239f23d74afa89483806f27fb9259054e46bc5742de8a414c9a9a9852a4fbdc14db45aeb148a15288196c8f7d51bdd485b005e20d012892e9e7321b50e161 WHIRLPOOL 62994852b142363847273b3d101d36929df5727f8d65ac4984a712ffbf5698e4dfc8806a170c832249cf4e9374c85c424e4cd9eb327866011e874cac52dec744 +AUX lighttpd_nagios4.conf 325 SHA256 0326b4d25315e3c446cb98f10e0cc47eadfacae2916c59d5aa2829643f3805ae SHA512 a2f854713512ee8ee5c451235beb6ffccf2e04617a98619c6de807a5abca0a424e0581c34b4d255dcbc108e677e18bed25dd33e3d38df8fe10d7d8d4fab015c9 WHIRLPOOL 3aff58f01e9ce76b471c757b983eb6c1f3bb1a9d870b5d7f32ba1419082c23403ad01f7ffe87e1bc8ea81eb392a88e37f7be0fd229333a535f062e321d3948b5 +DIST nagios-4.3.3.tar.gz 11101531 SHA256 1fc4c72f76c720884dd3b538dc423b44f3bdde24e014f4212e58046a1fc114b6 SHA512 588292a95342cb2d95d7b58f70442b82b99a23dd9fdc1390e9ae0743626a047e5127d77b1d7e6a1d8edd6f34a425e581bcd42459b673a0ddea14125bde4b7d9e WHIRLPOOL 1452256a79190eae90076a9b50fdac3876557a6382d15d38a0c7930ec6d286c58e44220fee3243c9bcb1ae0ef337ddadd19e3552f02049959e69eaffd9fcd4a8 +DIST nagios-core-gentoo-icons-20141125.tar 40960 SHA256 68b715f636eb291343cab3259862bbed8b6b898520b58df522438524de3d8761 SHA512 bf109879cddd6136b76baba55d0b60b2596e37431dcf5ce0905d34a9fa292ebf7e4bde82d9a084362c486e8fac344c76d88f9298b1b85541ed70ffd608493766 WHIRLPOOL 7ec3a944b2a659b456d3168818ca5b1af3a427436e6af2f3e5d6cba6fc7b1c7bad6f552301f064df31988865b3b32fd117d9e6f61c630d6d817a51cbbbcb331d +EBUILD nagios-core-4.3.3.ebuild 7574 SHA256 3bbddc45f7b9279739ad4bba48395610a601f32a6807c197c45d5757d30d5d46 SHA512 bd6da7d748ee8784acfd38906f80e5340a9b0f82fdad73aa594933480c72177ee673d6690c56e85c73404e5dcf7dcf7f8b4c0e3f810a710377c0be1550f05134 WHIRLPOOL 4e8505647308e5a0d5955ae95fe8fe5afa49263d7e19ccc999c3c89d7ee19a99f7364f15c5754704dfdd25e5c9e99f0d64ebc3d15f52b114d4e61821ca8623f4 diff --git a/net-analyzer/nagios-core/files/99_nagios4.conf b/net-analyzer/nagios-core/files/99_nagios4.conf new file mode 100644 index 00000000..b04c2980 --- /dev/null +++ b/net-analyzer/nagios-core/files/99_nagios4.conf @@ -0,0 +1,16 @@ +<IfDefine NAGIOS> + + ScriptAlias /nagios/cgi-bin/ /usr/lib/nagios/cgi-bin/ + <Directory "/usr/lib/nagios/cgi-bin/"> + AllowOverride AuthConfig + Options ExecCGI + Require all granted + </Directory> + + Alias /nagios /usr/share/nagios/htdocs + <Directory "/usr/share/nagios/htdocs"> + AllowOverride AuthConfig + Require all granted + </Directory> + +</IfDefine> diff --git a/net-analyzer/nagios-core/files/lighttpd_nagios4.conf b/net-analyzer/nagios-core/files/lighttpd_nagios4.conf new file mode 100644 index 00000000..a073f177 --- /dev/null +++ b/net-analyzer/nagios-core/files/lighttpd_nagios4.conf @@ -0,0 +1,15 @@ +server.modules += ("mod_cgi") +server.modules += ("mod_alias") + +$HTTP["url"] =~ "^/nagios/cgi-bin/" { + dir-listing.activate = "disable" + cgi.assign = ( + ".pl" => "/usr/bin/perl", + ".cgi" => "" + ) +} + +alias.url += ( + "/nagios/cgi-bin" => "/usr/lib/nagios/cgi-bin", + "/nagios" => "/usr/share/nagios/htdocs" +) diff --git a/net-analyzer/nagios-core/nagios-core-4.3.3.ebuild b/net-analyzer/nagios-core/nagios-core-4.3.3.ebuild new file mode 100644 index 00000000..f716eec9 --- /dev/null +++ b/net-analyzer/nagios-core/nagios-core-4.3.3.ebuild @@ -0,0 +1,247 @@ +# Copyright 1999-2017 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +EAPI=6 + +inherit toolchain-funcs user + +MY_P=${PN/-core}-${PV} +DESCRIPTION="Nagios core - monitoring daemon, web GUI, and documentation" +HOMEPAGE="http://www.nagios.org/" + +# The name of the directory into which our Gentoo icons will be +# extracted, and also the basename of the archive containing it. +GENTOO_ICONS="${PN}-gentoo-icons-20141125" +SRC_URI="mirror://sourceforge/nagios/${MY_P}.tar.gz + web? ( https://dev.gentoo.org/~mjo/distfiles/${GENTOO_ICONS}.tar )" + +LICENSE="GPL-2" +SLOT="0" +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ppc ~ppc64 ~sparc ~x86" +IUSE="apache2 classicui lighttpd perl +web vim-syntax" + +# In pkg_postinst(), we change the group of the Nagios configuration +# directory to that of the web server user. It can't belong to both +# apache/lighttpd groups at the same time, so we block this combination +# for our own sanity. +# +# This could be made to work, but we would need a better way to allow +# the web user read-only access to Nagios's configuration directory. +# +REQUIRED_USE="apache2? ( !lighttpd )" + +# sys-devel/libtool dependency is bug #401237. +# +# Note, we require one of the apache2 CGI modules: +# +# * mod_cgi +# * mod_cgid +# * mod_fcgid +# +# We just don't care /which/ one. And of course PHP supports both CGI +# (USE=cgi) and FastCGI (USE=fpm). We're pretty lenient with the +# dependencies, and expect the user not to do anything /too/ +# stupid. (For example, installing Apache with only FastCGI support, and +# PHP with only CGI support.) +# +# Another annoyance is that the upstream Makefile uses app-arch/unzip to +# extract a snapshot of AngularJS, but that's only needed when USE=web. +# +MOD_ALIAS=apache2_modules_alias +DEPEND="sys-devel/libtool + virtual/mailx + perl? ( dev-lang/perl:= ) + web? ( + app-arch/unzip + media-libs/gd[jpeg,png] + lighttpd? ( www-servers/lighttpd[php] ) + apache2? ( + || ( + >=www-servers/apache-2.4[${MOD_ALIAS},apache2_modules_cgi] + >=www-servers/apache-2.4[${MOD_ALIAS},apache2_modules_cgid] + >=www-servers/apache-2.4[${MOD_ALIAS},apache2_modules_fcgid] ) + || ( + dev-lang/php:*[apache2] + dev-lang/php:*[cgi] + dev-lang/php:*[fpm] ) + ) + )" +RDEPEND="${DEPEND} + vim-syntax? ( app-vim/nagios-syntax )" + +S="${WORKDIR}/${MY_P}" + +pkg_setup() { + enewgroup nagios + enewuser nagios -1 /bin/bash /var/lib/nagios/home nagios +} + +src_configure() { + local myconf + + if use perl; then + myconf="${myconf} --enable-embedded-perl --with-perlcache" + fi + + if use !apache2 && use !lighttpd ; then + myconf="${myconf} --with-command-group=nagios" + else + if use apache2 ; then + myconf="${myconf} --with-command-group=apache" + myconf="${myconf} --with-httpd-conf=/etc/apache2/conf.d" + elif use lighttpd ; then + myconf="${myconf} --with-command-group=lighttpd" + fi + fi + + econf ${myconf} \ + --prefix=/usr \ + --bindir=/usr/sbin \ + --sbindir=/usr/$(get_libdir)/nagios/cgi-bin \ + --datadir=/usr/share/nagios/htdocs \ + --localstatedir=/var/lib/nagios \ + --with-lockfile=/var/run/nagios.lock \ + --sysconfdir=/etc/nagios \ + --libexecdir=/usr/$(get_libdir)/nagios/plugins +} + +src_compile() { + emake CC=$(tc-getCC) nagios + + if use web; then + # Only compile the CGIs/HTML when USE=web is set. + emake CC=$(tc-getCC) DESTDIR="${D}" cgis html + fi +} + +src_install() { + dodoc Changelog CONTRIBUTING.md README.asciidoc THANKS UPGRADING + + emake DESTDIR="${D}" install-base + emake DESTDIR="${D}" install-basic + emake DESTDIR="${D}" install-config + emake DESTDIR="${D}" install-commandmode + + if use web; then + emake DESTDIR="${D}" install-cgis + + # install-html installs the new exfoliation theme + emake DESTDIR="${D}" install-html + + if use classicui; then + # This overwrites the already-installed exfoliation theme + emake DESTDIR="${D}" install-classicui + fi + + # Install cute Gentoo icons (bug #388323), setting their + # owner, group, and mode to match those of the rest of Nagios's + # images. + insopts --group=nagios --owner=nagios --mode=0664 + insinto /usr/share/nagios/htdocs/images/logos + doins "${WORKDIR}/${GENTOO_ICONS}"/*.* + insopts --mode=0644 # Back to the default... + fi + + newinitd openrc-init nagios + + if use web ; then + if use apache2 ; then + # Install the Nagios configuration file for Apache. + insinto "/etc/apache2/modules.d" + doins "${FILESDIR}"/99_nagios4.conf + elif use lighttpd ; then + # Install the Nagios configuration file for Lighttpd. + insinto /etc/lighttpd + newins "${FILESDIR}/lighttpd_nagios4.conf" nagios.conf + else + ewarn "${CATEGORY}/${PF} only supports apache or lighttpd" + ewarn "out of the box. Since you are not using one of them, you" + ewarn "will have to configure your webserver yourself." + fi + fi + + for dir in etc/nagios var/lib/nagios ; do + chown -R nagios:nagios "${D}/${dir}" \ + || die "failed chown of ${D}/${dir}" + done + + chown -R root:root "${D}/usr/$(get_libdir)/nagios" \ + || die "failed chown of ${D}/usr/$(get_libdir)/nagios" + + # The following two find...exec statements will die properly as long + # as chmod is only called once (that is, as long as the argument + # list is small enough). + find "${D}/usr/$(get_libdir)/nagios" -type d \ + -exec chmod 755 '{}' + || die 'failed to make nagios dirs traversable' + + if use web; then + find "${D}/usr/$(get_libdir)/nagios/cgi-bin" -type f \ + -exec chmod 755 '{}' + || die 'failed to make cgi-bins executable' + fi + + keepdir /etc/nagios + keepdir /var/lib/nagios + keepdir /var/lib/nagios/archives + keepdir /var/lib/nagios/rw + keepdir /var/lib/nagios/spool/checkresults + + if use !apache2 && use !lighttpd; then + chown -R nagios:nagios "${D}"/var/lib/nagios/rw \ + || die "failed chown of ${D}/var/lib/nagios/rw" + else + if use apache2 ; then + chown -R nagios:apache "${D}"/var/lib/nagios/rw \ + || die "failed chown of ${D}/var/lib/nagios/rw" + elif use lighttpd ; then + chown -R nagios:lighttpd "${D}"/var/lib/nagios/rw \ + || die "failed chown of ${D}/var/lib/nagios/rw" + fi + fi + + chmod ug+s "${D}"/var/lib/nagios/rw || die "failed chmod of ${D}/var/lib/nagios/rw" + chmod 0750 "${D}"/etc/nagios || die "failed chmod of ${D}/etc/nagios" +} + +pkg_postinst() { + + if use web; then + elog "Note that your web server user requires read-only access to" + elog "${ROOT}etc/nagios." + + if use apache2 || use lighttpd ; then + elog + elog "To that end, we have changed the group of ${ROOT}etc/nagios" + elog "to that of your web server user." + elog + if use apache2; then + chown nagios:apache "${ROOT}etc/nagios" \ + || die "failed to change group of ${ROOT}etc/nagios" + + elog "To enable the Nagios web front-end, please edit" + elog "${ROOT}etc/conf.d/apache2 and add \"-D NAGIOS -D PHP\"" + elog "to APACHE2_OPTS. Then Nagios will be available at," + elog + elif use lighttpd; then + chown nagios:lighttpd "${ROOT}etc/nagios" \ + || die "failed to change group of ${ROOT}etc/nagios" + elog "To enable the Nagios web front-end, please add" + elog "'include \"nagios.conf\"' to the lighttpd configuration" + elog "file at ${ROOT}etc/lighttpd/lighttpd.conf. Then Nagios" + elog "will be available at," + elog + fi + + elog " http://localhost/nagios/" + else + elog "Since you're not using either Apache or Lighttpd, you" + elog "will have to grant the necessary permissions yourself." + fi + fi + + elog + elog "If your kernel has /proc protection, nagios" + elog "will not be happy as it relies on accessing the proc" + elog "filesystem. You can fix this by adding nagios into" + elog "the group wheel, but this is not recomended." + elog +} |