summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobin H. Johnson <robbat2@gentoo.org>2015-08-08 13:49:04 -0700
committerRobin H. Johnson <robbat2@gentoo.org>2015-08-08 17:38:18 -0700
commit56bd759df1d0c750a065b8c845e93d5dfa6b549d (patch)
tree3f91093cdb475e565ae857f1c5a7fd339e2d781e /net-analyzer/nagios-core
downloadgentoo-56bd759df1d0c750a065b8c845e93d5dfa6b549d.tar.gz
gentoo-56bd759df1d0c750a065b8c845e93d5dfa6b549d.tar.bz2
gentoo-56bd759df1d0c750a065b8c845e93d5dfa6b549d.zip
proj/gentoo: Initial commit
This commit represents a new era for Gentoo: Storing the gentoo-x86 tree in Git, as converted from CVS. This commit is the start of the NEW history. Any historical data is intended to be grafted onto this point. Creation process: 1. Take final CVS checkout snapshot 2. Remove ALL ChangeLog* files 3. Transform all Manifests to thin 4. Remove empty Manifests 5. Convert all stale $Header$/$Id$ CVS keywords to non-expanded Git $Id$ 5.1. Do not touch files with -kb/-ko keyword flags. Signed-off-by: Robin H. Johnson <robbat2@gentoo.org> X-Thanks: Alec Warner <antarus@gentoo.org> - did the GSoC 2006 migration tests X-Thanks: Robin H. Johnson <robbat2@gentoo.org> - infra guy, herding this project X-Thanks: Nguyen Thai Ngoc Duy <pclouds@gentoo.org> - Former Gentoo developer, wrote Git features for the migration X-Thanks: Brian Harring <ferringb@gentoo.org> - wrote much python to improve cvs2svn X-Thanks: Rich Freeman <rich0@gentoo.org> - validation scripts X-Thanks: Patrick Lauer <patrick@gentoo.org> - Gentoo dev, running new 2014 work in migration X-Thanks: Michał Górny <mgorny@gentoo.org> - scripts, QA, nagging X-Thanks: All of other Gentoo developers - many ideas and lots of paint on the bikeshed
Diffstat (limited to 'net-analyzer/nagios-core')
-rw-r--r--net-analyzer/nagios-core/Manifest3
-rw-r--r--net-analyzer/nagios-core/files/99_nagios3.conf15
-rw-r--r--net-analyzer/nagios-core/files/99_nagios4.conf16
-rw-r--r--net-analyzer/nagios-core/files/conf.d10
-rw-r--r--net-analyzer/nagios-core/files/fix-bogus-perf-data-warnings.patch32
-rw-r--r--net-analyzer/nagios-core/files/lighttpd_nagios3-r1.conf24
-rw-r--r--net-analyzer/nagios-core/files/lighttpd_nagios4.conf15
-rw-r--r--net-analyzer/nagios-core/files/nagios57
-rw-r--r--net-analyzer/nagios-core/files/nagios-3.3.1-htmlmakefile.patch14
-rw-r--r--net-analyzer/nagios-core/files/nagios-core-3.5.1-process_cgivars.patch175
-rw-r--r--net-analyzer/nagios-core/files/nagios353
-rw-r--r--net-analyzer/nagios-core/files/nagios452
-rw-r--r--net-analyzer/nagios-core/files/statuswml-bug275288.patch51
-rw-r--r--net-analyzer/nagios-core/files/use-INSTALL-to-install-themes.patch59
-rw-r--r--net-analyzer/nagios-core/files/use-MAKE-instead-of-bare-make.patch37
-rw-r--r--net-analyzer/nagios-core/metadata.xml41
-rw-r--r--net-analyzer/nagios-core/nagios-core-3.5.1.ebuild217
-rw-r--r--net-analyzer/nagios-core/nagios-core-4.0.8-r1.ebuild270
-rw-r--r--net-analyzer/nagios-core/nagios-core-4.0.8-r2.ebuild282
19 files changed, 1423 insertions, 0 deletions
diff --git a/net-analyzer/nagios-core/Manifest b/net-analyzer/nagios-core/Manifest
new file mode 100644
index 000000000000..7e3a9fdf9482
--- /dev/null
+++ b/net-analyzer/nagios-core/Manifest
@@ -0,0 +1,3 @@
+DIST nagios-3.5.1.tar.gz 1763584 SHA256 ca9dd68234fa090b3c35ecc8767b2c9eb743977eaf32612fa9b8341cc00a0f99 SHA512 48e2ecb91002b08203937b12a438c87c62cd3c5c401a0ed9e861cd6d79074c7017ed373e9379f013d87dea1fd7cb8e3d85112d55c87ac91aed96b256868c112d WHIRLPOOL 2c02584702c64dbb0e353e34b758fab079eee0dc7a401e7b5947a21733758d3596401e5519e2dd7f05c89ee4835c21965d2718157fd9d6d3d20af9c853d688ca
+DIST nagios-4.0.8.tar.gz 1805059 SHA256 8b268d250c97851775abe162f46f64724f95f367d752ae4630280cc5d368ca4b SHA512 d72fdbcc0beb2de72e5aa788b4ccc83aa30c7f4a4460edaa831f012db04647e4836b876bb7dc235e2a1b525827e9a2a0f4d348919f69fbfbfdaa4d13e968e18c WHIRLPOOL bdd9c63e0e495073b7b046952baa50b9e448fa56cda167806546a3b58fdd8fad328c9285ebb6d07da81786676d805671cad7295be389c4b8a4f3971264c97f74
+DIST nagios-core-gentoo-icons-20141125.tar 40960 SHA256 68b715f636eb291343cab3259862bbed8b6b898520b58df522438524de3d8761 SHA512 bf109879cddd6136b76baba55d0b60b2596e37431dcf5ce0905d34a9fa292ebf7e4bde82d9a084362c486e8fac344c76d88f9298b1b85541ed70ffd608493766 WHIRLPOOL 7ec3a944b2a659b456d3168818ca5b1af3a427436e6af2f3e5d6cba6fc7b1c7bad6f552301f064df31988865b3b32fd117d9e6f61c630d6d817a51cbbbcb331d
diff --git a/net-analyzer/nagios-core/files/99_nagios3.conf b/net-analyzer/nagios-core/files/99_nagios3.conf
new file mode 100644
index 000000000000..074f9ce5e4a9
--- /dev/null
+++ b/net-analyzer/nagios-core/files/99_nagios3.conf
@@ -0,0 +1,15 @@
+<IfDefine NAGIOS>
+ ScriptAlias /nagios/cgi-bin/ /usr/lib/nagios/cgi-bin/
+ <Directory "/usr/lib/nagios/cgi-bin/">
+ AllowOverride AuthConfig
+ Options ExecCGI
+ Order allow,deny
+ Allow from all
+ </Directory>
+ Alias /nagios /usr/share/nagios/htdocs
+ <Directory "/usr/share/nagios/htdocs">
+ AllowOverride AuthConfig
+ Order allow,deny
+ Allow from all
+ </Directory>
+</IfDefine>
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 000000000000..b04c2980ebab
--- /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/conf.d b/net-analyzer/nagios-core/files/conf.d
new file mode 100644
index 000000000000..4fd852e5fb80
--- /dev/null
+++ b/net-analyzer/nagios-core/files/conf.d
@@ -0,0 +1,10 @@
+# Copyright 1999-2004 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+# Distributed monitoring users will want to configure here the ip/hostname of the central server.
+# It will be used by submit_check_result_via_nsca.
+NAGIOS_NSCA_HOST="localhost"
+
+
+
diff --git a/net-analyzer/nagios-core/files/fix-bogus-perf-data-warnings.patch b/net-analyzer/nagios-core/files/fix-bogus-perf-data-warnings.patch
new file mode 100644
index 000000000000..8f589e8013b7
--- /dev/null
+++ b/net-analyzer/nagios-core/files/fix-bogus-perf-data-warnings.patch
@@ -0,0 +1,32 @@
+Patch submitted upstream at,
+
+ http://tracker.nagios.org/view.php?id=534
+
+by user ovidiu_stanila. Confirmed to work by at least one other user,
+travissidelinger. Applied to fix Gentoo bug #530640.
+
+diff --git a/base/workers.c b/base/workers.c
+index 881e434..d1e1f8d 100644
+--- a/base/workers.c
++++ b/base/workers.c
+@@ -285,6 +285,8 @@ static void destroy_job(struct wproc_job *job)
+ case WPJOB_SVC_EVTHANDLER:
+ case WPJOB_GLOBAL_HOST_EVTHANDLER:
+ case WPJOB_HOST_EVTHANDLER:
++ case WPJOB_HOST_PERFDATA:
++ case WPJOB_SVC_PERFDATA:
+ /* these require nothing special */
+ break;
+ case WPJOB_CALLBACK:
+@@ -763,6 +765,11 @@ static int handle_worker_result(int sd, int events, void *arg)
+ run_job_callback(job, &wpres, 0);
+ break;
+
++ case WPJOB_HOST_PERFDATA:
++ case WPJOB_SVC_PERFDATA:
++ /* these require nothing special */
++ break;
++
+ default:
+ logit(NSLOG_RUNTIME_WARNING, TRUE, "Worker %d: Unknown jobtype: %d\n", wp->pid, job->type);
+ break;
diff --git a/net-analyzer/nagios-core/files/lighttpd_nagios3-r1.conf b/net-analyzer/nagios-core/files/lighttpd_nagios3-r1.conf
new file mode 100644
index 000000000000..6e2577029aca
--- /dev/null
+++ b/net-analyzer/nagios-core/files/lighttpd_nagios3-r1.conf
@@ -0,0 +1,24 @@
+server.modules += ("mod_cgi")
+server.modules += ("mod_auth")
+server.modules += ("mod_alias")
+
+auth.require += ( "/nagios" =>
+ (
+ "method" => "digest",
+ "realm" => "nagios",
+ "require" => "valid-user"
+ )
+)
+
+$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/files/lighttpd_nagios4.conf b/net-analyzer/nagios-core/files/lighttpd_nagios4.conf
new file mode 100644
index 000000000000..a073f177f238
--- /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/files/nagios b/net-analyzer/nagios-core/files/nagios
new file mode 100644
index 000000000000..057112257619
--- /dev/null
+++ b/net-analyzer/nagios-core/files/nagios
@@ -0,0 +1,57 @@
+#!/sbin/runscript
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+opts="${opts} reload checkconfig"
+
+depend() {
+ need net
+ use dns logger firewall
+ after mysql postgresql
+}
+
+reload()
+{
+ checkconfig || return 1
+ ebegin "Reloading configuration"
+ killall -HUP nagios &>/dev/null
+ eend $?
+}
+
+checkconfig() {
+ # Silent Check
+ /usr/nagios/bin/nagios -v /etc/nagios/nagios.cfg &>/dev/null && return 0
+
+ # Now we know there's problem - run again and display errors
+ /usr/nagios/bin/nagios -v /etc/nagios/nagios.cfg
+ eend $? "Configuration Error. Please fix your configfile"
+}
+
+start() {
+ checkconfig || return 1
+ ebegin "Starting nagios"
+ touch /var/nagios/nagios.log /var/nagios/status.sav
+ chown nagios:nagios /var/nagios/nagios.log /var/nagios/status.sav
+ rm -f /var/nagios/rw/nagios.cmd
+ start-stop-daemon --quiet --start --startas /usr/nagios/bin/nagios \
+ -e HOME="/var/nagios/home" --pidfile /var/nagios/nagios.lock \
+ -- -d /etc/nagios/nagios.cfg
+ eend $?
+}
+
+stop() {
+ ebegin "Stopping nagios"
+ start-stop-daemon --quiet --stop --pidfile /var/nagios/nagios.lock
+ rm -f /var/nagios/status.log /var/nagios/nagios.tmp /var/nagios/nagios.lock /var/nagios/rw/nagios.cmd
+ eend $?
+}
+
+svc_restart() {
+ checkconfig || return 1
+ ebegin "Restarting nagios"
+ svc_stop
+ svc_start
+ eend $?
+}
+
diff --git a/net-analyzer/nagios-core/files/nagios-3.3.1-htmlmakefile.patch b/net-analyzer/nagios-core/files/nagios-3.3.1-htmlmakefile.patch
new file mode 100644
index 000000000000..c033c9843c10
--- /dev/null
+++ b/net-analyzer/nagios-core/files/nagios-3.3.1-htmlmakefile.patch
@@ -0,0 +1,14 @@
+--- html/Makefile.in.orig 2011-07-27 16:06:58.000000000 +0200
++++ html/Makefile.in 2011-07-27 16:07:10.000000000 +0200
+@@ -75,9 +75,9 @@
+ do $(INSTALL) -m 664 $(INSTALL_OPTS) $$file $(DESTDIR)$(HTMLDIR)/images/logos; done
+ for file in includes/*.*; \
+ do $(INSTALL) -m 664 $(INSTALL_OPTS) $$file $(DESTDIR)$(HTMLDIR)/includes; done
+- for file in includes/rss/*; \
++ for file in includes/rss/*.*; \
+ do $(INSTALL) -m 664 $(INSTALL_OPTS) $$file $(DESTDIR)$(HTMLDIR)/includes/rss; done
+- for file in includes/rss/extlib/*; \
++ for file in includes/rss/extlib/*.*; \
+ do $(INSTALL) -m 664 $(INSTALL_OPTS) $$file $(DESTDIR)$(HTMLDIR)/includes/rss/extlib; done
+
+ install-unstripped:
diff --git a/net-analyzer/nagios-core/files/nagios-core-3.5.1-process_cgivars.patch b/net-analyzer/nagios-core/files/nagios-core-3.5.1-process_cgivars.patch
new file mode 100644
index 000000000000..9d9536747794
--- /dev/null
+++ b/net-analyzer/nagios-core/files/nagios-core-3.5.1-process_cgivars.patch
@@ -0,0 +1,175 @@
+commit d97e03f32741a7d851826b03ed73ff4c9612a866
+Author: Eric Stanley <estanley@nagios.com>
+Date: Fri Dec 20 13:14:30 2013 -0600
+
+ CGIs: Fixed minor vulnerability where a custom query could crash the CGI.
+
+ Most CGIs previously incremented the input variable counter twice when
+ it encountered a long key value. This could cause the CGI to read past
+ the end of the list of CGI variables. This commit removes the second
+ increment, removing the possibility of reading past the end of the list
+ of CGI variables.
+
+diff --git a/cgi/avail.c b/cgi/avail.c
+index 76afd86..64eaadc 100644
+--- a/cgi/avail.c
++++ b/cgi/avail.c
+@@ -1096,7 +1096,6 @@ int process_cgivars(void) {
+
+ /* do some basic length checking on the variable identifier to prevent buffer overflows */
+ if(strlen(variables[x]) >= MAX_INPUT_BUFFER - 1) {
+- x++;
+ continue;
+ }
+
+diff --git a/cgi/cmd.c b/cgi/cmd.c
+index fa6cf5a..50504eb 100644
+--- a/cgi/cmd.c
++++ b/cgi/cmd.c
+@@ -311,7 +311,6 @@ int process_cgivars(void) {
+
+ /* do some basic length checking on the variable identifier to prevent buffer overflows */
+ if(strlen(variables[x]) >= MAX_INPUT_BUFFER - 1) {
+- x++;
+ continue;
+ }
+
+diff --git a/cgi/config.c b/cgi/config.c
+index f061b0f..3360e70 100644
+--- a/cgi/config.c
++++ b/cgi/config.c
+@@ -344,7 +344,6 @@ int process_cgivars(void) {
+
+ /* do some basic length checking on the variable identifier to prevent buffer overflows */
+ if(strlen(variables[x]) >= MAX_INPUT_BUFFER - 1) {
+- x++;
+ continue;
+ }
+
+diff --git a/cgi/extinfo.c b/cgi/extinfo.c
+index 62a1b18..5113df4 100644
+--- a/cgi/extinfo.c
++++ b/cgi/extinfo.c
+@@ -591,7 +591,6 @@ int process_cgivars(void) {
+
+ /* do some basic length checking on the variable identifier to prevent buffer overflows */
+ if(strlen(variables[x]) >= MAX_INPUT_BUFFER - 1) {
+- x++;
+ continue;
+ }
+
+diff --git a/cgi/histogram.c b/cgi/histogram.c
+index 4616541..f6934d0 100644
+--- a/cgi/histogram.c
++++ b/cgi/histogram.c
+@@ -1060,7 +1060,6 @@ int process_cgivars(void) {
+
+ /* do some basic length checking on the variable identifier to prevent buffer overflows */
+ if(strlen(variables[x]) >= MAX_INPUT_BUFFER - 1) {
+- x++;
+ continue;
+ }
+
+diff --git a/cgi/notifications.c b/cgi/notifications.c
+index 8ba11c1..461ae84 100644
+--- a/cgi/notifications.c
++++ b/cgi/notifications.c
+@@ -327,7 +327,6 @@ int process_cgivars(void) {
+
+ /* do some basic length checking on the variable identifier to prevent buffer overflows */
+ if(strlen(variables[x]) >= MAX_INPUT_BUFFER - 1) {
+- x++;
+ continue;
+ }
+
+diff --git a/cgi/outages.c b/cgi/outages.c
+index 426ede6..cb58dee 100644
+--- a/cgi/outages.c
++++ b/cgi/outages.c
+@@ -225,7 +225,6 @@ int process_cgivars(void) {
+
+ /* do some basic length checking on the variable identifier to prevent buffer overflows */
+ if(strlen(variables[x]) >= MAX_INPUT_BUFFER - 1) {
+- x++;
+ continue;
+ }
+
+diff --git a/cgi/status.c b/cgi/status.c
+index 3253340..4ec1c92 100644
+--- a/cgi/status.c
++++ b/cgi/status.c
+@@ -567,7 +567,6 @@ int process_cgivars(void) {
+
+ /* do some basic length checking on the variable identifier to prevent buffer overflows */
+ if(strlen(variables[x]) >= MAX_INPUT_BUFFER - 1) {
+- x++;
+ continue;
+ }
+
+diff --git a/cgi/statusmap.c b/cgi/statusmap.c
+index ea48368..2580ae5 100644
+--- a/cgi/statusmap.c
++++ b/cgi/statusmap.c
+@@ -400,7 +400,6 @@ int process_cgivars(void) {
+
+ /* do some basic length checking on the variable identifier to prevent buffer overflows */
+ if(strlen(variables[x]) >= MAX_INPUT_BUFFER - 1) {
+- x++;
+ continue;
+ }
+
+diff --git a/cgi/statuswml.c b/cgi/statuswml.c
+index bd8cea2..d25abef 100644
+--- a/cgi/statuswml.c
++++ b/cgi/statuswml.c
+@@ -226,8 +226,13 @@ int process_cgivars(void) {
+
+ for(x = 0; variables[x] != NULL; x++) {
+
++ /* do some basic length checking on the variable identifier to prevent buffer overflows */
++ if(strlen(variables[x]) >= MAX_INPUT_BUFFER - 1) {
++ continue;
++ }
++
+ /* we found the hostgroup argument */
+- if(!strcmp(variables[x], "hostgroup")) {
++ else if(!strcmp(variables[x], "hostgroup")) {
+ display_type = DISPLAY_HOSTGROUP;
+ x++;
+ if(variables[x] == NULL) {
+diff --git a/cgi/summary.c b/cgi/summary.c
+index 126ce5e..749a02c 100644
+--- a/cgi/summary.c
++++ b/cgi/summary.c
+@@ -725,7 +725,6 @@ int process_cgivars(void) {
+
+ /* do some basic length checking on the variable identifier to prevent buffer overflows */
+ if(strlen(variables[x]) >= MAX_INPUT_BUFFER - 1) {
+- x++;
+ continue;
+ }
+
+diff --git a/cgi/trends.c b/cgi/trends.c
+index b35c18e..895db01 100644
+--- a/cgi/trends.c
++++ b/cgi/trends.c
+@@ -1263,7 +1263,6 @@ int process_cgivars(void) {
+
+ /* do some basic length checking on the variable identifier to prevent buffer overflows */
+ if(strlen(variables[x]) >= MAX_INPUT_BUFFER - 1) {
+- x++;
+ continue;
+ }
+
+diff --git a/contrib/daemonchk.c b/contrib/daemonchk.c
+index 78716e5..9bb6c4b 100644
+--- a/contrib/daemonchk.c
++++ b/contrib/daemonchk.c
+@@ -174,7 +174,6 @@ static int process_cgivars(void) {
+
+ /* do some basic length checking on the variable identifier to prevent buffer overflows */
+ if(strlen(variables[x]) >= MAX_INPUT_BUFFER - 1) {
+- x++;
+ continue;
+ }
+ }
diff --git a/net-analyzer/nagios-core/files/nagios3 b/net-analyzer/nagios-core/files/nagios3
new file mode 100644
index 000000000000..04714cc0f9fa
--- /dev/null
+++ b/net-analyzer/nagios-core/files/nagios3
@@ -0,0 +1,53 @@
+#!/sbin/runscript
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+extra_commands="checkconfig"
+extra_started_commands="reload"
+
+nagios_config="/etc/nagios/nagios.cfg"
+nagios_cmdfile="/var/nagios/rw/nagios.cmd"
+
+command="/usr/sbin/nagios"
+command_args="-d ${nagios_config}"
+pidfile="/var/nagios/nagios.lock"
+start_stop_daemon_args="-e HOME=/var/nagios/home"
+
+depend() {
+ need net
+ use dns logger firewall
+ after mysql postgresql
+}
+
+reload()
+{
+ checkconfig || return 1
+ ebegin "Reloading configuration"
+ start-stop-daemon --signal HUP --pidfile ${pidfile}
+ eend $?
+}
+
+checkconfig() {
+ ebegin "Verifying config files"
+
+ # Silent Check
+ /usr/sbin/nagios -v ${nagios_config} &>/dev/null && return 0
+
+ # Now we know there's problem - run again and display errors
+ /usr/sbin/nagios -v ${nagios_config}
+ eend $? "Configuration Error. Please fix your configfile"
+}
+
+start_pre() {
+ checkconfig || return 1
+
+ touch /var/nagios/nagios.log /var/nagios/status.sav
+ chown nagios:nagios /var/nagios/nagios.log /var/nagios/status.sav
+ rm -f ${nagios_cmdfile}
+}
+
+stop_post() {
+ rm -f /var/nagios/status.log /var/nagios/nagios.tmp ${pidfile} \
+ ${nagios_cmdfile}
+}
diff --git a/net-analyzer/nagios-core/files/nagios4 b/net-analyzer/nagios-core/files/nagios4
new file mode 100644
index 000000000000..5bc359c6d25a
--- /dev/null
+++ b/net-analyzer/nagios-core/files/nagios4
@@ -0,0 +1,52 @@
+#!/sbin/runscript
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+extra_commands="checkconfig"
+extra_started_commands="reload"
+
+nagios_config="/etc/nagios/nagios.cfg"
+nagios_cmdfile="/var/nagios/rw/nagios.cmd"
+
+command="/usr/sbin/nagios"
+command_args="-d ${nagios_config}"
+pidfile="/var/nagios/nagios.lock"
+start_stop_daemon_args="-e HOME=/var/nagios/home"
+
+depend(){
+ need net
+ use dns logger firewall
+ after mysql postgresql
+}
+
+reload(){
+ checkconfig || return 1
+ ebegin "Reloading configuration"
+ start-stop-daemon --signal HUP --pidfile ${pidfile}
+ eend $?
+}
+
+checkconfig(){
+ ebegin "Verifying config files"
+
+ # Silent Check
+ /usr/sbin/nagios -v ${nagios_config} > /dev/null 2>&1 && return 0
+
+ # Now we know there's problem - run again and display errors
+ /usr/sbin/nagios -v ${nagios_config}
+ eend $? "Configuration Error. Please fix your config file."
+}
+
+start_pre() {
+ checkconfig || return 1
+
+ touch /var/nagios/nagios.log /var/nagios/status.sav
+ chown nagios:nagios /var/nagios/nagios.log /var/nagios/status.sav
+ rm -f ${nagios_cmdfile}
+}
+
+stop_post() {
+ rm -f /var/nagios/status.log /var/nagios/nagios.tmp ${pidfile} \
+ ${nagios_cmdfile}
+}
diff --git a/net-analyzer/nagios-core/files/statuswml-bug275288.patch b/net-analyzer/nagios-core/files/statuswml-bug275288.patch
new file mode 100644
index 000000000000..8b9a0200e148
--- /dev/null
+++ b/net-analyzer/nagios-core/files/statuswml-bug275288.patch
@@ -0,0 +1,51 @@
+--- cgi/statuswml.c 2008/11/30 18:13:11 1.27
++++ cgi/statuswml.c 2009/06/19 04:30:26 1.28
+@@ -67,6 +67,8 @@
+ void document_header(void);
+ void document_footer(void);
+ int process_cgivars(void);
++int validate_arguments(void);
++int is_valid_hostip(char *hostip);
+
+ int display_type=DISPLAY_INDEX;
+ int hostgroup_style=DISPLAY_HOSTGROUP_SUMMARY;
+@@ -108,6 +110,13 @@
+
+ document_header();
+
++ /* validate arguments in URL */
++ result=validate_arguments();
++ if(result==ERROR){
++ document_footer();
++ return ERROR;
++ }
++
+ /* read the CGI configuration file */
+ result=read_cgi_config_file(get_cgi_config_location());
+ if(result==ERROR){
+@@ -334,7 +343,25 @@
+ return error;
+ }
+
++int validate_arguments(void){
++ int result=OK;
++ if((strcmp(ping_address,"")) && !is_valid_hostip(ping_address)) {
++ printf("<p>Invalid host name/ip</p>\n");
++ result=ERROR;
++ }
++ if(strcmp(traceroute_address,"") && !is_valid_hostip(traceroute_address)){
++ printf("<p>Invalid host name/ip</p>\n");
++ result=ERROR;
++ }
++ return result;
++ }
+
++int is_valid_hostip(char *hostip) {
++ char *valid_domain_chars="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789.-";
++ if(strcmp(hostip,"") && strlen(hostip)==strspn(hostip,valid_domain_chars) && hostip[0] != '-' && hostip[strlen(hostip)-1] != '-')
++ return TRUE;
++ return FALSE;
++ }
+
+ /* main intro screen */
+ void display_index(void){
diff --git a/net-analyzer/nagios-core/files/use-INSTALL-to-install-themes.patch b/net-analyzer/nagios-core/files/use-INSTALL-to-install-themes.patch
new file mode 100644
index 000000000000..a852430e74b6
--- /dev/null
+++ b/net-analyzer/nagios-core/files/use-INSTALL-to-install-themes.patch
@@ -0,0 +1,59 @@
+From 26bef86bad804836babd9d99accfc247eb744132 Mon Sep 17 00:00:00 2001
+From: Michael Orlitzky <michael@orlitzky.com>
+Date: Wed, 12 Nov 2014 08:35:28 -0500
+Subject: [PATCH 1/1] Use $(INSTALL) to install themes.
+
+Most of the images installed under the htdocs folder are installed
+mode 644 with owner:group nagios:nagios. This is due to the use of
+$(INSTALL) in html/Makefile. However, the theme images and stylesheets
+are currently installed with a simple "cp -r", which leads to
+inconsistencies like the following:
+
+ $ cd /usr/share/nagios/htdocs/images
+ $ ls action*.gif
+ -rw-rw-r-- 1 nagios nagios 1.3K 2014-11-12 08:22 action.gif
+ -rw-r--r-- 1 root root 1.3K 2014-11-12 08:22 action-graph.gif
+ -rw-r--r-- 1 root root 171 2014-11-12 08:22 action-nagios.gif
+ -rw-r--r-- 1 root root 162 2014-11-12 08:22 action-orig.gif
+
+By using $(INSTALL) in the install-exfoliation and install-classicui
+targets, we enforce some consistency.
+---
+ Makefile.in | 14 ++++++++++----
+ 1 file changed, 10 insertions(+), 4 deletions(-)
+
+diff --git a/Makefile.in b/Makefile.in
+index 1341160..67e1502 100644
+--- a/Makefile.in
++++ b/Makefile.in
+@@ -300,8 +300,11 @@ install-webconf:
+ @echo ""
+
+ install-exfoliation:
+- cp -rf contrib/exfoliation/stylesheets/* $(DESTDIR)$(HTMLDIR)/stylesheets
+- cp -rf contrib/exfoliation/images/* $(DESTDIR)$(HTMLDIR)/images
++ for file in contrib/exfoliation/stylesheets/*.*; \
++ do $(INSTALL) -m 664 $(INSTALL_OPTS) $$file $(DESTDIR)$(HTMLDIR)/stylesheets; done
++
++ for file in contrib/exfoliation/images/*.*; \
++ do $(INSTALL) -m 664 $(INSTALL_OPTS) $$file $(DESTDIR)$(HTMLDIR)/images; done
+
+ @echo ""
+ @echo "*** Exfoliation theme installed ***"
+@@ -309,8 +312,11 @@ install-exfoliation:
+ @echo ""
+
+ install-classicui:
+- cp -rf html/stylesheets/* $(DESTDIR)$(HTMLDIR)/stylesheets
+- cp -rf html/images/* $(DESTDIR)$(HTMLDIR)/images
++ for file in html/stylesheets/*.*; \
++ do $(INSTALL) -m 664 $(INSTALL_OPTS) $$file $(DESTDIR)$(HTMLDIR)/stylesheets; done
++
++ for file in html/images/*.*; \
++ do $(INSTALL) -m 664 $(INSTALL_OPTS) $$file $(DESTDIR)$(HTMLDIR)/images; done
+
+ @echo ""
+ @echo "*** Classic theme installed ***"
+--
+2.0.4
+
diff --git a/net-analyzer/nagios-core/files/use-MAKE-instead-of-bare-make.patch b/net-analyzer/nagios-core/files/use-MAKE-instead-of-bare-make.patch
new file mode 100644
index 000000000000..e53ba78b6e38
--- /dev/null
+++ b/net-analyzer/nagios-core/files/use-MAKE-instead-of-bare-make.patch
@@ -0,0 +1,37 @@
+From e043015081c9dc6869b282da76ae0de5ac9840a2 Mon Sep 17 00:00:00 2001
+From: Michael Orlitzky <michael@orlitzky.com>
+Date: Wed, 5 Nov 2014 13:46:04 -0500
+Subject: [PATCH 1/1] Use $(MAKE) instead of bare "make" in subtarget of
+ install-html.
+
+When running make as a subprocess of itself, it's best to invoke it as
+$(MAKE). The rest of Makefile.in does this correctly, but there was
+one instance where it was forgotten. For posterity, this can lead to
+warnings like,
+
+ make[1]: warning: jobserver unavailable: using -j1.
+ Add '+' to parent make rule.
+
+More info is available at,
+
+ https://www.gnu.org/software/make/manual/html_node/Error-Messages.html
+---
+ Makefile.in | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/Makefile.in b/Makefile.in
+index f487c47..1341160 100644
+--- a/Makefile.in
++++ b/Makefile.in
+@@ -222,7 +222,7 @@ test-perl: cgis
+
+ install-html:
+ cd $(SRC_HTM) && $(MAKE) install
+- make install-exfoliation
++ $(MAKE) install-exfoliation
+
+ install-base:
+ cd $(SRC_BASE) && $(MAKE) install
+--
+2.0.4
+
diff --git a/net-analyzer/nagios-core/metadata.xml b/net-analyzer/nagios-core/metadata.xml
new file mode 100644
index 000000000000..78b30f7c65e8
--- /dev/null
+++ b/net-analyzer/nagios-core/metadata.xml
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <maintainer>
+ <email>andrew@ahamilto.net</email>
+ <name>Andrew Hamilton</name>
+ <description>Maintainer. Assign bugs to him.</description>
+ </maintainer>
+ <maintainer>
+ <email>creffett@gentoo.org</email>
+ <name>Chris Reffett</name>
+ <description>Proxy maintainer. CC him on bugs.</description>
+ </maintainer>
+ <maintainer>
+ <email>mjo@gentoo.org</email>
+ <name>Michael Orlitzky</name>
+ </maintainer>
+ <herd>proxy-maintainers</herd>
+ <herd>sysadmin</herd>
+ <longdescription>
+ Nagios is a host and service monitor designed to inform you of
+ network problems before your clients, end-users or managers do. It
+ has been designed to run under the Linux operating system, but
+ works fine under most *NIX variants as well. The monitoring daemon
+ runs intermittent checks on hosts and services you specify using
+ external "plugins" which return status information to Nagios. When
+ problems are encountered, the daemon can send notifications out to
+ administrative contacts in a variety of different ways (email,
+ instant message, SMS, etc.). Current status information,
+ historical logs, and reports can all be accessed via a web
+ browser.
+ </longdescription>
+ <use>
+ <flag name="classicui">use the classic web theme</flag>
+ <flag name="lighttpd">install <pkg>www-servers/lighttpd</pkg> config</flag>
+ <flag name="web">enable web interface</flag>
+ </use>
+ <upstream>
+ <remote-id type="sourceforge">nagios</remote-id>
+ </upstream>
+</pkgmetadata>
diff --git a/net-analyzer/nagios-core/nagios-core-3.5.1.ebuild b/net-analyzer/nagios-core/nagios-core-3.5.1.ebuild
new file mode 100644
index 000000000000..adbc7e8efeff
--- /dev/null
+++ b/net-analyzer/nagios-core/nagios-core-3.5.1.ebuild
@@ -0,0 +1,217 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+inherit depend.apache eutils multilib toolchain-funcs user
+
+MY_P=${PN/-core}-${PV}
+DESCRIPTION="Nagios Core - Check daemon, CGIs, docs"
+HOMEPAGE="http://www.nagios.org/"
+SRC_URI="mirror://sourceforge/nagios/${MY_P}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="alpha amd64 ~arm ~arm64 hppa ppc ppc64 sparc x86"
+IUSE="debug lighttpd perl +web vim-syntax"
+DEPEND="virtual/mailx
+ web? (
+ >=media-libs/gd-1.8.3-r5[jpeg,png]
+ lighttpd? ( www-servers/lighttpd dev-lang/php[cgi] )
+ apache2? ( || ( dev-lang/php[apache2] dev-lang/php[cgi] ) )
+ )
+ perl? ( >=dev-lang/perl-5.6.1-r7 )"
+RDEPEND="${DEPEND}
+ !net-analyzer/nagios-imagepack
+ vim-syntax? ( app-vim/nagios-syntax )"
+
+want_apache2
+
+S="${WORKDIR}/${PN/-core}"
+
+pkg_setup() {
+ depend.apache_pkg_setup
+
+ enewgroup nagios
+ enewuser nagios -1 /bin/bash /var/nagios/home nagios
+}
+
+src_prepare() {
+ epatch "${FILESDIR}/${PN}-3.5.1-process_cgivars.patch"
+ local strip="$(echo '$(MAKE) strip-post-install')"
+ sed -i -e "s:${strip}::" {cgi,base}/Makefile.in || die "sed failed in Makefile.in"
+}
+
+src_configure() {
+ local myconf
+
+ if use perl ; then
+ myconf="${myconf} --enable-embedded-perl --with-perlcache"
+ fi
+
+ if use debug; then
+ myconf="${myconf} --enable-DEBUG0"
+ myconf="${myconf} --enable-DEBUG1"
+ myconf="${myconf} --enable-DEBUG2"
+ myconf="${myconf} --enable-DEBUG3"
+ myconf="${myconf} --enable-DEBUG4"
+ myconf="${myconf} --enable-DEBUG5"
+ 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/nagios \
+ --sysconfdir=/etc/nagios \
+ --libexecdir=/usr/$(get_libdir)/nagios/plugins
+}
+
+src_compile() {
+ emake CC=$(tc-getCC) nagios
+
+ if use web ; then
+ # Only compile the CGI's if "web" useflag is set.
+ emake CC=$(tc-getCC) DESTDIR="${D}" cgis
+ fi
+}
+
+src_install() {
+ dodoc Changelog INSTALLING LEGAL README UPGRADING
+
+ if ! use web ; then
+ sed -i -e 's/cd $(SRC_CGI) && $(MAKE) $@/# line removed due missing web use flag/' \
+ -e 's/cd $(SRC_HTM) && $(MAKE) $@/# line removed due missing web use flag/' \
+ -e 's/$(MAKE) install-exfoliation/# line removed due missing web use flag/' \
+ Makefile
+ fi
+
+ sed -i -e 's/^contactgroups$//g' Makefile
+
+ emake DESTDIR="${D}" install
+ emake DESTDIR="${D}" install-config
+ emake DESTDIR="${D}" install-commandmode
+ if use web; then
+ emake DESTDIR="${D}" install-classicui
+ fi
+
+ newinitd "${FILESDIR}"/nagios3 nagios
+ newconfd "${FILESDIR}"/conf.d nagios
+
+ # Apache Module
+ if use web ; then
+ if use apache2 ; then
+ insinto "${APACHE_MODULES_CONFDIR}"
+ doins "${FILESDIR}"/99_nagios3.conf
+ elif use lighttpd ; then
+ insinto /etc/lighttpd
+ newins "${FILESDIR}/lighttpd_nagios3-r1.conf" nagios.conf
+ else
+ ewarn "${CATEGORY}/${PF} only supports Apache-2.x or Lighttpd webserver"
+ ewarn "out-of-the-box. Since you are not using one of them, you"
+ ewarn "have to configure your webserver accordingly yourself."
+ fi
+
+ fi
+
+ for dir in etc/nagios var/nagios ; do
+ chown -R nagios:nagios "${D}/${dir}" || die "Failed chown of ${D}/${dir}"
+ done
+
+ dosbin p1.pl
+
+ chown -R root:root "${D}"/usr/$(get_libdir)/nagios
+ find "${D}"/usr/$(get_libdir)/nagios -type d -print0 | xargs -0 chmod 755
+ find "${D}"/usr/$(get_libdir)/nagios/cgi-bin -type f -print0 | xargs -0 chmod 755
+
+ keepdir /etc/nagios
+ keepdir /var/nagios
+ keepdir /var/nagios/archives
+ keepdir /var/nagios/rw
+ keepdir /var/nagios/spool/checkresults
+
+ if use !apache2 && use !lighttpd; then
+ chown -R nagios:nagios "${D}"/var/nagios/rw || die "Failed chown of ${D}/var/nagios/rw"
+ else
+ if use apache2 ; then
+ chown -R nagios:apache "${D}"/var/nagios/rw || die "Failed chown of ${D}/var/nagios/rw"
+ elif use lighttpd ; then
+ chown -R nagios:lighttpd "${D}"/var/nagios/rw || die "Failed chown of ${D}/var/nagios/rw"
+ fi
+ fi
+
+ chmod ug+s "${D}"/var/nagios/rw || die "Failed Chmod of ${D}/var/nagios/rw"
+ chmod 0750 "${D}"/etc/nagios || die "Failed chmod of ${D}/etc/nagios"
+}
+
+pkg_postinst() {
+ elog "If you want nagios to start at boot time"
+ elog "remember to execute:"
+ elog " rc-update add nagios default"
+ elog
+
+ if use web ; then
+ elog "This does not include cgis that are perl-dependent"
+ elog "Currently traceroute.cgi is perl-dependent"
+ elog "To have ministatus.cgi requires copying of ministatus.c"
+ elog "to cgi directory for compiling."
+
+ elog "Note that the user your webserver is running at needs"
+ elog "read-access to /etc/nagios."
+ elog
+
+ if use apache2 || use lighttpd ; then
+ elog "There are several possible solutions to accomplish this,"
+ elog "choose the one you are most comfortable with:"
+ elog
+ if use apache2 ; then
+ elog " usermod -G nagios apache"
+ elog "or"
+ elog " chown nagios:apache /etc/nagios"
+ elog
+ elog "Also edit /etc/conf.d/apache2 and add \"-D NAGIOS\""
+ elif use lighttpd ; then
+ elog " usermod -G nagios lighttpd "
+ elog "or"
+ elog " chown nagios:lighttpd /etc/nagios"
+ fi
+ elog
+ elog "That will make nagios's web front end visable via"
+ elog "http://localhost/nagios/"
+ elog
+ else
+ elog "IMPORTANT: Do not forget to add the user your webserver"
+ elog "is running as to the nagios group!"
+ fi
+
+ else
+ elog "Please note that you have installed Nagios without web interface."
+ elog "Please don't file any bugs about having no web interface when you do this."
+ elog "Thank you!"
+ 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
+}
+
+pkg_postinst() {
+ einfo "Fixing permissions"
+ chown nagios:nagios "${ROOT}"var/nagios
+}
diff --git a/net-analyzer/nagios-core/nagios-core-4.0.8-r1.ebuild b/net-analyzer/nagios-core/nagios-core-4.0.8-r1.ebuild
new file mode 100644
index 000000000000..716d575c5335
--- /dev/null
+++ b/net-analyzer/nagios-core/nagios-core-4.0.8-r1.ebuild
@@ -0,0 +1,270 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+inherit depend.apache eutils multilib toolchain-funcs user
+
+MY_P=${PN/-core}-${PV}
+DESCRIPTION="Nagios Core - Check daemon, CGIs, docs"
+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? ( http://dev.gentoo.org/~mjo/distfiles/${GENTOO_ICONS}.tar )"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ppc ~ppc64 ~sparc ~x86"
+IUSE="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.)
+#
+DEPEND="sys-devel/libtool
+ virtual/mailx
+ perl? ( dev-lang/perl )
+ web? (
+ media-libs/gd[jpeg,png]
+ lighttpd? ( www-servers/lighttpd[php] )
+ apache2? (
+ || (
+ >=www-servers/apache-2.4[apache2_modules_alias,apache2_modules_cgi]
+ >=www-servers/apache-2.4[apache2_modules_alias,apache2_modules_cgid]
+ >=www-servers/apache-2.4[apache2_modules_alias,apache2_modules_fcgid]
+ )
+
+ || ( dev-lang/php[apache2] dev-lang/php[cgi] dev-lang/php[fpm] )
+ )
+ )"
+RDEPEND="${DEPEND}
+ !net-analyzer/nagios-imagepack
+ vim-syntax? ( app-vim/nagios-syntax )"
+
+want_apache2
+
+S="${WORKDIR}/${MY_P}"
+
+pkg_setup() {
+ depend.apache_pkg_setup
+
+ enewgroup nagios
+ enewuser nagios -1 /bin/bash /var/nagios/home nagios
+}
+
+src_prepare(){
+ # Upstream bug, fixes a QA warning:
+ #
+ # http://tracker.nagios.org/view.php?id=650
+ #
+ epatch "${FILESDIR}"/use-MAKE-instead-of-bare-make.patch
+
+ # Upstream bug:
+ #
+ # http://tracker.nagios.org/view.php?id=651
+ #
+ # Gentoo bug #388321.
+ #
+ epatch "${FILESDIR}"/use-INSTALL-to-install-themes.patch
+
+ # Upstream bug:
+ #
+ # http://tracker.nagios.org/view.php?id=534
+ #
+ # Gentoo bug #530640.
+ epatch "${FILESDIR}"/fix-bogus-perf-data-warnings.patch
+}
+
+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/nagios \
+ --sysconfdir=/etc/nagios \
+ --libexecdir=/usr/$(get_libdir)/nagios/plugins
+}
+
+src_compile() {
+ emake CC=$(tc-getCC) nagios
+
+ if use web; then
+ # Only compile the CGIs when USE=web is set.
+ emake CC=$(tc-getCC) DESTDIR="${D}" cgis
+ fi
+}
+
+src_install() {
+ dodoc Changelog INSTALLING LEGAL README.asciidoc 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 "${FILESDIR}"/nagios4 nagios
+ newconfd "${FILESDIR}"/conf.d nagios
+
+ if use web ; then
+ if use apache2 ; then
+ # Install the Nagios configuration file for Apache.
+ insinto "${APACHE_MODULES_CONFDIR}"
+ 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/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/nagios
+ keepdir /var/nagios/archives
+ keepdir /var/nagios/rw
+ keepdir /var/nagios/spool/checkresults
+
+ if use !apache2 && use !lighttpd; then
+ chown -R nagios:nagios "${D}"/var/nagios/rw \
+ || die "failed chown of ${D}/var/nagios/rw"
+ else
+ if use apache2 ; then
+ chown -R nagios:apache "${D}"/var/nagios/rw \
+ || die "failed chown of ${D}/var/nagios/rw"
+ elif use lighttpd ; then
+ chown -R nagios:lighttpd "${D}"/var/nagios/rw \
+ || die "failed chown of ${D}/var/nagios/rw"
+ fi
+ fi
+
+ chmod ug+s "${D}"/var/nagios/rw || die "failed chmod of ${D}/var/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 PHP5\""
+ 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
+}
diff --git a/net-analyzer/nagios-core/nagios-core-4.0.8-r2.ebuild b/net-analyzer/nagios-core/nagios-core-4.0.8-r2.ebuild
new file mode 100644
index 000000000000..117a8833169a
--- /dev/null
+++ b/net-analyzer/nagios-core/nagios-core-4.0.8-r2.ebuild
@@ -0,0 +1,282 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+inherit depend.apache eutils multilib toolchain-funcs user
+
+MY_P=${PN/-core}-${PV}
+DESCRIPTION="Nagios Core - Check daemon, CGIs, docs"
+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? ( http://dev.gentoo.org/~mjo/distfiles/${GENTOO_ICONS}.tar )"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ppc ~ppc64 ~sparc ~x86"
+IUSE="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 )"
+
+# A list of modules used in our Apache config file.
+APACHE_MODS="apache2_modules_alias," # "Alias" directive
+APACHE_MODS+="apache2_modules_authz_core" # "Require" directive
+
+# Note, we require one of the apache2 CGI modules:
+#
+# * mod_cgi
+# * mod_cgid
+# * mod_fcgid
+# * mod_proxy_fcgi
+#
+# We just don't care /which/ one. And of course PHP supports both CGI
+# (USE=cgi) and FastCGI (USE=fpm) as well as mod_php (USE=apache2).
+#
+# Note: trying to move the base apache dep into DEPEND and build upon it
+# caused problems.
+#
+# The first group corresponds to PHP running under Apache's mod_php.
+PHP_MOD="( >=www-servers/apache-2.4[${APACHE_MODS}]
+ dev-lang/php[apache2] )"
+
+# The second is for PHP running through CGI with mod_cgi or mod_cgid.
+PHP_CGI="( || ( >=www-servers/apache-2.4[${APACHE_MODS},apache2_modules_cgi]
+ >=www-servers/apache-2.4[${APACHE_MODS},apache2_modules_cgid] )
+ dev-lang/php[cgi] )"
+
+# This one's for running PHP through CGI with mod_fcgid.
+PHP_FCGID="( >=www-servers/apache-2.4[${APACHE_MODS}]
+ www-apache/mod_fcgid
+ dev-lang/php[cgi] )"
+
+# And the last one is for running PHP through mod_proxy_fcgi.
+PHP_FPM="( >=www-servers/apache-2.4[${APACHE_MODS},apache2_modules_proxy_fcgi]
+ dev-lang/php[fpm] )"
+
+DEPEND="dev-libs/libltdl
+ virtual/mailx
+ perl? ( dev-lang/perl )
+ web? ( media-libs/gd[jpeg,png]
+ lighttpd? ( www-servers/lighttpd[php] )
+ apache2? ( || ( ${PHP_MOD} ${PHP_CGI} ${PHP_FCGID} ${PHP_FPM} ) ) )"
+
+RDEPEND="${DEPEND}
+ !net-analyzer/nagios-imagepack
+ vim-syntax? ( app-vim/nagios-syntax )"
+
+want_apache2
+
+S="${WORKDIR}/${MY_P}"
+
+pkg_setup() {
+ depend.apache_pkg_setup
+
+ enewgroup nagios
+ enewuser nagios -1 /bin/bash /var/nagios/home nagios
+}
+
+src_prepare(){
+ # Upstream bug, fixes a QA warning:
+ #
+ # http://tracker.nagios.org/view.php?id=650
+ #
+ epatch "${FILESDIR}"/use-MAKE-instead-of-bare-make.patch
+
+ # Upstream bug:
+ #
+ # http://tracker.nagios.org/view.php?id=651
+ #
+ # Gentoo bug #388321.
+ #
+ epatch "${FILESDIR}"/use-INSTALL-to-install-themes.patch
+
+ # Upstream bug:
+ #
+ # http://tracker.nagios.org/view.php?id=534
+ #
+ # Gentoo bug #530640.
+ epatch "${FILESDIR}"/fix-bogus-perf-data-warnings.patch
+}
+
+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/nagios \
+ --sysconfdir=/etc/nagios \
+ --libexecdir=/usr/$(get_libdir)/nagios/plugins
+}
+
+src_compile() {
+ emake CC=$(tc-getCC) nagios
+
+ if use web; then
+ # Only compile the CGIs when USE=web is set.
+ emake CC=$(tc-getCC) DESTDIR="${D}" cgis
+ fi
+}
+
+src_install() {
+ dodoc Changelog INSTALLING LEGAL README.asciidoc 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 "${FILESDIR}"/nagios4 nagios
+ newconfd "${FILESDIR}"/conf.d nagios
+
+ if use web ; then
+ if use apache2 ; then
+ # Install the Nagios configuration file for Apache.
+ insinto "${APACHE_MODULES_CONFDIR}"
+ 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/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/nagios
+ keepdir /var/nagios/archives
+ keepdir /var/nagios/rw
+ keepdir /var/nagios/spool/checkresults
+
+ if use !apache2 && use !lighttpd; then
+ chown -R nagios:nagios "${D}"/var/nagios/rw \
+ || die "failed chown of ${D}/var/nagios/rw"
+ else
+ if use apache2 ; then
+ chown -R nagios:apache "${D}"/var/nagios/rw \
+ || die "failed chown of ${D}/var/nagios/rw"
+ elif use lighttpd ; then
+ chown -R nagios:lighttpd "${D}"/var/nagios/rw \
+ || die "failed chown of ${D}/var/nagios/rw"
+ fi
+ fi
+
+ chmod ug+s "${D}"/var/nagios/rw || die "failed chmod of ${D}/var/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 PHP5\""
+ 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
+}