Commit fbc4fe0f authored by Andy Postnikov's avatar Andy Postnikov Committed by Natanael Copa

main/nrpe: upgrade to 3.2.1 and modernize

parent 49eccf14
# Maintainer: Jeff Bilyk <jbilyk@gmail.com>
pkgname=nrpe
pkgver=2.15
pkgrel=9
pkgver=3.2.1
pkgrel=0
pkgusers="nagios"
pkggroups="nagios"
pkgdesc="NRPE allows you to remotely execute Nagios plugins on other Linux/Unix machines."
url="http://www.nagios.org/download/addons"
arch="all"
license="GPL"
makedepends="openssl-dev perl"
makedepends="openssl-dev autoconf"
install="nrpe.pre-install"
subpackages="$pkgname-plugin"
source="https://downloads.sourceforge.net/nagios/$pkgname-$pkgver.tar.gz
stay-in-foreground.patch
sample-config.patch
nrpe.initd
nrpe.confd"
builddir="$srcdir/$pkgname-$pkgver"
prepare() {
default_prepare
update_config_sub
}
options="!check" # needs services to run
build() {
cd "$builddir"
......@@ -34,14 +29,17 @@ build() {
--mandir=/usr/share/man \
--infodir=/usr/share/info \
--libexecdir=/usr/lib/nagios/plugins \
--localstatedir=/var \
--with-need-dh=no \
--with-init-type=openrc \
--enable-command-args
make
make all
}
package() {
cd "$builddir"
make DESTDIR="$pkgdir" install install-daemon-config
make DESTDIR="$pkgdir" install install-daemon install-config
# Remove plugin since its in separate package.
rm -rf "$pkgdir"/usr/lib
......@@ -56,8 +54,7 @@ plugin() {
make DESTDIR="$subpkgdir" install-plugin
}
sha512sums="03ce9774b5112d03235dc9da075770d89d1bcc5ffa5faf221ff7ea8ec5c92ded1e1ae9222581a87cf53736d190ac047e1acce7edc2f31f26c432d786cdef0e73 nrpe-2.15.tar.gz
53e4060a81768058d03262ebb1f2e72b1faebc59d42b5a1deea64b917cc4d4f1ab308f122f84fe31af174198f8cfc7c13858ab91aaeb88c7b55a2d3981d22fda stay-in-foreground.patch
4ac80b51fbde6e2a54764e5ecc83e0cbec43534cb5f29e8efc7f4b0442afe72200d5d92f1e2785c021c20a111464af6897d5e89ba467b06d3f08a324a302669d sample-config.patch
sha512sums="ec6ff42a00bd97ed80010a82e26dc35fd419f2feda65820cda0108068173c1ae44eee698833a50fd2079429a6f5eb1321c4f06b09c6708bc5fbe48f176389856 nrpe-3.2.1.tar.gz
f5cdf863257d75ff311767ef51679fbe437b4846a259e07e245f51c0c5abb50fb65e234cd146a73365d3c3bbd2d3c663baf9bb8827a44dc0d1f2647451729e03 sample-config.patch
b2f23bab97384ef8f1760c79d0cbadb4e81d4bb8134887a38662033a7f0c30480222b9ecb78c3ae276bd8b35470b3db316143f591baa2c535f5fb26c34ad2824 nrpe.initd
05a0f1f5f75345370cae3262f9988d537e24dfcbb6c14a1ff3486193625481045d0844c035f7be491e74ca9ad45ed0fae7b7005616936cc274cd7e8a851c8628 nrpe.confd"
--- a/sample-config/nrpe.cfg.in
+++ b/sample-config/nrpe.cfg.in
@@ -18,15 +18,6 @@
@@ -35,15 +35,6 @@
......@@ -9,16 +9,16 @@
-# number. The file is only written if the NRPE daemon is started by the root
-# user and is running in standalone mode.
-
-pid_file=/var/run/nrpe.pid
-pid_file=@piddir@/nrpe.pid
-
-
-
# PORT NUMBER
# Port number we should wait for connections on.
# NOTE: This must be a non-priviledged port (i.e. > 1024).
@@ -50,8 +41,10 @@
# NOTE: This must be a non-privileged port (i.e. > 1024).
@@ -75,8 +66,10 @@
# You can either supply a username or a UID.
#
#
# NOTE: This option is ignored if NRPE is running under either inetd or xinetd
+# NOTE: OpenRC starts NRPE already as @nrpe_user@ user. You can change the user
+# in /etc/conf.d/nrpe.
......@@ -28,9 +28,9 @@
@@ -60,8 +53,10 @@
@@ -85,8 +78,10 @@
# You can either supply a group name or a GID.
#
#
# NOTE: This option is ignored if NRPE is running under either inetd or xinetd
+# NOTE: OpenRC starts NRPE already as @nrpe_group@ group. You can change the
+# group in /etc/conf.d/nrpe.
......
From: Jakub Jirutka <jakub@jirutka.cz>
Date: Mon, 28 Aug 2017 21:13:00 +0200
Subject: [PATCH] Add option "stay in foreground"
This patch is based on https://support.nagios.com/forum/viewtopic.php?f=34&t=17597.
--- a/src/nrpe.c
+++ b/src/nrpe.c
@@ -98,6 +98,7 @@
int use_inetd=TRUE;
int debug=FALSE;
int use_src=FALSE; /* Define parameter for SRC option */
+int stay_in_foreground=FALSE;
void complete_SSL_shutdown( SSL *);
@@ -171,6 +172,7 @@
printf(" -d = Run as a standalone daemon\n");
/* Updates help section to indicate how to start under SRC on AIX */
printf(" -d -s = Run as a subsystem under AIX\n");
+ printf(" -f = Run and stay in foreground\n");
printf("\n");
printf("Notes:\n");
printf("This program is designed to process requests from the check_nrpe\n");
@@ -292,6 +294,22 @@
handle_connection(0);
}
+ /* if we're running in the foreground... */
+ else if (stay_in_foreground==TRUE){
+
+ /* drop privileges */
+ drop_privileges(nrpe_user,nrpe_group);
+
+ /* make sure we're not root */
+ check_privileges();
+
+ /* log info to syslog facility */
+ syslog(LOG_NOTICE,"Starting up NRPE");
+
+ /* wait for connections */
+ wait_for_connections();
+ }
+
/* if we're running under SRC...
we don't fork but does drop-privileges*/
else if (use_src==TRUE){
@@ -2088,6 +2103,7 @@
{"4", no_argument, 0, '4'},
{"6", no_argument, 0, '4'},
{"daemon", no_argument, 0, 'd'},
+ {"foreground", no_argument, 0, 'f'},
{"no-ssl", no_argument, 0, 'n'},
{"help", no_argument, 0, 'h'},
{"license", no_argument, 0, 'l'},
@@ -2099,7 +2115,7 @@
if(argc<2)
return ERROR;
- snprintf(optchars,MAX_INPUT_BUFFER,"c:hVldi46n");
+ snprintf(optchars,MAX_INPUT_BUFFER,"c:hVldi46nf");
while(1){
#ifdef HAVE_GETOPT_LONG
@@ -2130,6 +2146,11 @@
case 'd':
use_inetd=FALSE;
have_mode=TRUE;
+ break;
+ case 'f':
+ stay_in_foreground=TRUE;
+ use_inetd=FALSE;
+ have_mode=TRUE;
break;
case 'i':
use_inetd=TRUE;
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment