commit 3588be36d03d433be9c05168b395566e34f3781b
Author: Xavier Bachelot <xavier(a)bachelot.org>
Date: Mon Mar 5 12:31:15 2018 +0100
Initial import
.gitignore | 1 +
nrdp-config.inc.php | 76 ++++++++++++++++++++++++++++++
nrdp-httpd.conf | 16 +++++++
nrdp.spec | 132 ++++++++++++++++++++++++++++++++++++++++++++++++++++
sources | 1 +
5 files changed, 226 insertions(+)
---
diff --git a/.gitignore b/.gitignore
index e69de29..e943d1a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -0,0 +1 @@
+/nrdp-1.5.1.tar.gz
diff --git a/nrdp-config.inc.php b/nrdp-config.inc.php
new file mode 100644
index 0000000..7095255
--- /dev/null
+++ b/nrdp-config.inc.php
@@ -0,0 +1,76 @@
+<?php
+//
+// NRDP Config File
+//
+// Copyright (c) 2010-2017 - Nagios Enterprises, LLC.
+// License: Nagios Open Software License <
http://www.nagios.com/legal/licenses>
+//
+
+// An array of one or more tokens that are valid for this NRDP install
+// a client request must contain a valid token in order for the NRDP to response or honor
the request
+// NOTE: Tokens are just alphanumeric strings - make them hard to guess!
+$cfg['authorized_tokens'] = array(
+ //"mysecrettoken", // <-- not a good token
+ //"90dfs7jwn3", // <-- a better token (don't use this exact one,
make your own)
+);
+
+// By default, all authorized tokens are allowed to submit any
+// external command (unless it's disable below)
+// This is a deny mapping in the form of COMMAND => TOKEN or TOKENS
+// You can specify a whole command, or use * as a wildcard
+// Or you can specify 'all' to stop any token from using any external command
+// the tokens specified can either be a string with 1 token, or an array of 1 or more
tokens
+$cfg['external_commands_deny_tokens'] = array(
+// "ACKNOWLEDGE_HOST_PROBLEM" => array("mysecrettoken",
"myothertoken"),
+// "ACKNOWLEDGE_SVC_PROBLEM" => "mysecrettoken",
+// "all" => array("mysecrettoken", "myothertoken"),
+// "ACKNOWLEDGE_*" => "mysecrettoken",
+// "*_HOST_*" => array("mysecrettoken",
"myothertoken"),
+);
+
+
+// Do we require that HTTPS be used to access NRDP?
+// set this value to 'false' to disable HTTPS requirement
+$cfg["require_https"] = false;
+
+// Do we require that basic authentication be used to access NRDP?
+// set this value to 'false' to disable basic auth requirement
+$cfg["require_basic_auth"] = false;
+
+// What basic authentication users are allowed to access NRDP?
+// comment this variable out to allow all authenticated users access to the NRDP
+$cfg["valid_basic_auth_users"] = array(
+ "nrdpuser"
+);
+
+// The name of the system group that has write permissions to the external command file
+// this group is also used to set file permissions when writing bulk commands or passive
check results
+// NOTE: both the Apache and Nagios users must be a member of this group
+$cfg["nagios_command_group"] = "nagios";
+
+// Full path to Nagios external command file
+$cfg["command_file"] = "/var/spool/nagios/cmd/nagios.cmd";
+
+// Full path to check results spool directory
+$cfg["check_results_dir"] = "/var/log/nagios/spool/checkresults";
+
+// Should we allow external commands? Set to true or false (Boolean, not a string)
+$cfg["disable_external_commands"] = false;
+
+// Allows Nagios XI to send old check results directly into NDO if configured
+$cfg["allow_old_results"] = false;
+
+// Enable debug logging
+$cfg["debug"] = false;
+
+// Where should the logs go?
+$cfg["debug_log"] = "/usr/local/nrdp/server/debug.log";
+
+
+///////// DONT MODIFY ANYTHING BELOW THIS LINE /////////
+
+$cfg['product_name'] = 'nrdp';
+$cfg['product_version'] = '1.5.0'
+
+
+?>
diff --git a/nrdp-httpd.conf b/nrdp-httpd.conf
new file mode 100644
index 0000000..00b08b2
--- /dev/null
+++ b/nrdp-httpd.conf
@@ -0,0 +1,16 @@
+Alias /nrdp "/usr/share/nrdp/"
+<Directory "/usr/share/nrdp">
+ # ACL for Apache 2.4
+ <IfModule mod_authz_core.c>
+ Require local
+ </IfModule>
+
+ # ACL for Apache 2.2
+ <IfModule !mod_authz_core.c>
+ Order Deny,Allow
+ Deny from all
+ Allow from 127.0.0.1
+ Allow from ::1
+ </IfModule>
+</Directory>
+
diff --git a/nrdp.spec b/nrdp.spec
new file mode 100644
index 0000000..e080d72
--- /dev/null
+++ b/nrdp.spec
@@ -0,0 +1,132 @@
+# TODO: unbundle JS from server/includes
+# - jquery 3.2.1
+# - bootstrap 4.0.0-beta2
+
+Name: nrdp
+Version: 1.5.1
+Release: 4%{?dist}
+Summary: Nagios Remote Data Processor
+
+# NRDP php client is BSD
+# Bundled jquery and boostrap are MIT
+# Everything else is Nagios Open Software License (which is non-free)
+License: Nagios Open Software License and BSD and MIT
+URL:
https://github.com/NagiosEnterprises/nrdp
+Source0:
https://github.com/NagiosEnterprises/%{name}/archive/%{version}/%{name}-%...
+Source1: %{name}-httpd.conf
+Source2: %{name}-config.inc.php
+
+BuildArch: noarch
+
+Requires: nagios
+# For clarity since Nagios should pull them
+Requires: httpd
+Requires: mod_php
+
+Provides: bundled(js-jquery) = 3.2.1
+Provides: bundled(js-bootstrap) = 4.0.0
+
+
+%description
+Nagios Remote Data Processor (NDRP) is a flexible data transport
+mechanism and processor for Nagios. It is designed with a simple
+and powerful architecture that allows for it to be easily extended
+and customized to fit individual users needs. It uses standard ports
+protocols (HTTP(S) and XML) and can be implemented as a replacement for NSCA.
+
+
+%package client-shell
+Summary: Send NRDP shell script for Nagios
+%description client-shell
+A shell script to send NRDP data to a Nagios server.
+
+%package client-php
+Summary: Send NRDP php script for Nagios
+%description client-php
+A php script to send NRDP data to a Nagios server.
+
+%package client-python
+Summary: Send NRDP python script for Nagios
+%description client-python
+A python script to send NRDP data to a Nagios server.
+
+
+%prep
+%setup -q
+# Fix perms
+chmod a-x server/includes/bootstrap.bundle.min.js
+chmod a-x server/includes/bootstrap.min.css
+chmod a-x server/includes/jquery-3.2.1.min.js
+# Fix shebang
+sed -i -e '1d;2i#!/usr/bin/python' clients/send_nrdp.py
+# Fix EOL
+sed -i "s|\r||g" clients/send_nrdp.php
+
+
+%build
+# Nothing here
+
+
+%install
+# Server
+mkdir -p %{buildroot}%{_datadir}/%{name}/
+rm -f server/config.inc.php
+cp -pr server/* %{buildroot}%{_datadir}/%{name}/
+ln -s %{_sysconfdir}/%{name}/config.inc.php \
+ ${RPM_BUILD_ROOT}%{_datadir}/%{name}/config.inc.php
+# Server conf file
+mkdir -p %{buildroot}%{_sysconfdir}/%{name}/
+install -m 0644 -D -p %{SOURCE2} %{buildroot}%{_sysconfdir}/%{name}/config.inc.php
+# httpd conf
+mkdir -p %{buildroot}%{_sysconfdir}/httpd/conf.d/
+install -m 0644 -D -p %{SOURCE1} \
+ %{buildroot}%{_sysconfdir}/httpd/conf.d/nrdp.conf
+# Client scripts
+mkdir -p %{buildroot}%{_bindir}/
+install -m 0755 -D -p clients/* %{buildroot}%{_bindir}/
+
+
+%files
+%license LICENSE.rst
+%doc CHANGES.rst README.rst
+%{_datadir}/%{name}/
+%dir %{_sysconfdir}/%{name}/
+%config(noreplace) %{_sysconfdir}/%{name}/config.inc.php
+%config(noreplace) %{_sysconfdir}/httpd/conf.d/nrdp.conf
+
+%files client-shell
+%license LICENSE.rst
+%{_bindir}/send_nrdp.sh
+
+%files client-php
+%license LICENSE.rst
+%{_bindir}/send_nrdp.php
+
+%files client-python
+%license LICENSE.rst
+%{_bindir}/send_nrdp.py
+
+
+%changelog
+* Mon Feb 26 2018 Xavier Bachelot <xavier(a)bachelot.org> 1.5.1-4
+- Clarify license.
+- Own %%{_sysconfdir}/%%{name}.
+- Requires mod_php rather than php.
+
+* Fri Feb 23 2018 Athmane Madjoudj <athmane(a)fedoraproject.org> - 1.5.1-3
+- Revamp requirements
+
+* Fri Feb 23 2018 Xavier Bachelot <xavier(a)bachelot.org> 1.5.1-2
+- More clean up.
+
+* Fri Feb 23 2018 Xavier Bachelot <xavier(a)bachelot.org> 1.5.1-1
+- Update to 1.5.1.
+- Clean up spec.
+
+* Sat Nov 21 2015 Athmane Madjoudj <athmane(a)fedoraproject.org>
0.20150122gitbd1b5d0-2
+- Use better version (pre-release)
+- Include license file in the clients sub-pkg
+- Add a license workaround
+
+* Fri Nov 20 2015 Athmane Madjoudj <athmane(a)fedoraproject.org> 0.bd1b5d0git-1
+- Initial spec file.
diff --git a/sources b/sources
index e69de29..c8b9a41 100644
--- a/sources
+++ b/sources
@@ -0,0 +1 @@
+766b741b5d005e0546cdf6145b90273f nrdp-1.5.1.tar.gz