update nagios-plugins to 1.4.16, various fixes/new features

- the new code in check_user wants utmpx so those parts are reverted
to the old popen("/usr/bin/who",...) code for now.
This commit is contained in:
sthen 2012-06-28 23:10:48 +00:00
parent dd8df02b75
commit 14a538eac0
8 changed files with 168 additions and 117 deletions

View File

@ -1,4 +1,4 @@
# $OpenBSD: Makefile,v 1.32 2011/09/16 11:13:39 espie Exp $
# $OpenBSD: Makefile,v 1.33 2012/06/28 23:10:48 sthen Exp $
COMMENT-main= nagios base plugins
COMMENT-fping= fping plugin
@ -10,26 +10,19 @@ COMMENT-pgsql= postgresql plugin
COMMENT-samba= samba plugin
COMMENT-snmp= plugins using snmp
V= 1.4.15
DISTNAME= nagios-plugins-${V}
PKGNAME-main= nagios-plugins-${V}
PKGNAME-fping= nagios-plugins-fping-${V}
PKGNAME-game= nagios-plugins-game-${V}
PKGNAME-ldap= nagios-plugins-ldap-${V}
PKGNAME-mysql= nagios-plugins-mysql-${V}
PKGNAME-ntp= nagios-plugins-ntp-${V}
PKGNAME-pgsql= nagios-plugins-pgsql-${V}
PKGNAME-samba= nagios-plugins-samba-${V}
PKGNAME-snmp= nagios-plugins-snmp-${V}
V= 1.4.16
DISTNAME= nagios-plugins-$V
PKGNAME-main= nagios-plugins-$V
PKGNAME-fping= nagios-plugins-fping-$V
PKGNAME-game= nagios-plugins-game-$V
PKGNAME-ldap= nagios-plugins-ldap-$V
PKGNAME-mysql= nagios-plugins-mysql-$V
PKGNAME-ntp= nagios-plugins-ntp-$V
PKGNAME-pgsql= nagios-plugins-pgsql-$V
PKGNAME-samba= nagios-plugins-samba-$V
PKGNAME-snmp= nagios-plugins-snmp-$V
CATEGORIES= net
REVISION-main= 1
REVISION-ldap = 0
REVISION-mysql = 0
REVISION-pgsql = 0
REVISION-samba = 0
REVISION-snmp = 0
HOMEPAGE= http://nagiosplug.sourceforge.net/
MAINTAINER= Stuart Henderson <sthen@openbsd.org>
@ -50,8 +43,8 @@ BUILD_DEPENDS= games/qstat \
FAKE_FLAGS= setuid_root_mode=0555
USE_LIBTOOL= Yes
CONFIGURE_STYLE=gnu
CONFIGURE_STYLE= autoconf
AUTOCONF_VERSION= 2.67
CONFIGURE_ENV= PATH_TO_FPING=${LOCALBASE}/sbin/fping \
PATH_TO_NTPDATE=${LOCALBASE}/sbin/ntpdate \
PATH_TO_NTPDC=${LOCALBASE}/sbin/ntpdc \
@ -98,7 +91,7 @@ RUN_DEPENDS-fping= net/fping
RUN_DEPENDS-game= games/qstat
WANTLIB-ldap+= ${WANTLIB} asn1 com_err crypto gssapi krb5
WANTLIB-ldap+= lber ldap sasl2 ssl
WANTLIB-ldap+= lber-2.4 ldap-2.4 sasl2 ssl
LIB_DEPENDS-ldap= databases/openldap \
${LIB_DEPENDS}
@ -109,7 +102,7 @@ LIB_DEPENDS-mysql= databases/mysql \
WANTLIB-ntp= ${WANTLIB} m
RUN_DEPENDS-ntp= net/ntp
WANTLIB-pgsql= ${WANTLIB} crypto pq
WANTLIB-pgsql= ${WANTLIB} com_err crypto pq ssl
LIB_DEPENDS-pgsql= databases/postgresql \
${LIB_DEPENDS}

View File

@ -1,5 +1,5 @@
MD5 (nagios-plugins-1.4.15.tar.gz) = VqvWreiqhgs4xMpKasWrDQ==
RMD160 (nagios-plugins-1.4.15.tar.gz) = wngKNSPPTqrtNKlMB/X2vW+x9zY=
SHA1 (nagios-plugins-1.4.15.tar.gz) = H6qzCcBtN+VZSQ/YUuyw3IqKthA=
SHA256 (nagios-plugins-1.4.15.tar.gz) = URNuUhDjZk4TUVUN46/0p2bZ2f6pok0J43s0KO+W+ls=
SIZE (nagios-plugins-1.4.15.tar.gz) = 2095419
MD5 (nagios-plugins-1.4.16.tar.gz) = hi9eRPtbxlzn5dhtZU1NoA==
RMD160 (nagios-plugins-1.4.16.tar.gz) = B3nei7JbdB0A9JQby8vIptFPDSI=
SHA1 (nagios-plugins-1.4.16.tar.gz) = UttIsVVyuYxvzYquwu9NKq12QNM=
SHA256 (nagios-plugins-1.4.16.tar.gz) = sMrwfgCE6bfxD91xy9Prq82FrXjfZNo2C1EjOw5zsr0=
SIZE (nagios-plugins-1.4.16.tar.gz) = 2087089

View File

@ -1,79 +0,0 @@
$OpenBSD: patch-configure,v 1.12 2010/08/28 09:19:48 sthen Exp $
--- configure.orig Tue Jul 27 21:48:13 2010
+++ configure Thu Aug 26 15:17:44 2010
@@ -14015,13 +14015,13 @@ if test "${with_pgsql+set}" = set; then
fi
-{ echo "$as_me:$LINENO: checking for main in -lcrypt" >&5
-echo $ECHO_N "checking for main in -lcrypt... $ECHO_C" >&6; }
+{ echo "$as_me:$LINENO: checking for main in -lcrypto" >&5
+echo $ECHO_N "checking for main in -lcrypto... $ECHO_C" >&6; }
if test "${ac_cv_lib_crypt_main+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
ac_check_lib_save_LIBS=$LIBS
-LIBS="-lcrypt $LIBS"
+LIBS="-lcrypto $LIBS"
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
@@ -14075,7 +14075,7 @@ if test $ac_cv_lib_crypt_main = yes; then
#define HAVE_LIBCRYPT 1
_ACEOF
- LIBS="-lcrypt $LIBS"
+ LIBS="-lcrypto $LIBS"
fi
@@ -14091,7 +14091,7 @@ if test "${ac_cv_lib_pq_PQsetdbLogin+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
ac_check_lib_save_LIBS=$LIBS
-LIBS="-lpq -lcrypt $LIBS"
+LIBS="-lpq -lcrypto $LIBS"
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
@@ -14577,16 +14577,16 @@ fi
done
if [ -n "$PGSQL" -a "$ac_cv_header_libpq_fe_h" = "yes" ]; then
- PGLIBS="-L$PGSQL/lib -lpq -lcrypt"
+ PGLIBS="-L$PGSQL/lib -lpq -lcrypto"
PGINCLUDE="-I$PGSQL/include"
elif test "$ac_cv_header_pgsql_libpq_fe_h" = "yes"; then
- PGLIBS="-lpq -lcrypt"
- PGINCLUDE="-I/usr/include/pgsql"
+ PGLIBS="-L$PGSQL/lib -lpq -lcrypto"
+ PGINCLUDE="-I$PGSQL/include/pgsql"
elif test "$ac_cv_header_postgresql_libpq_fe_h" = "yes"; then
- PGLIBS="-L$PGSQL/lib -lpq -lcrypt"
- PGINCLUDE="-I/usr/include/postgresql"
+ PGLIBS="-L$PGSQL/lib -lpq -lcrypto"
+ PGINCLUDE="-I$PGSQL/include/postgresql"
elif test "$ac_cv_header_libpq_fe_h" = "yes"; then
- PGLIBS="-L$PGSQL/lib -lpq -lcrypt"
+ PGLIBS="-L$PGSQL/lib -lpq -lcrypto"
PGINCLUDE="-I$PGSQL/include"
fi
if test -z "$PGINCLUDE"; then
@@ -15721,7 +15721,7 @@ done
if test "$FOUNDINCLUDE" = "no"; then
_SAVEDCPPFLAGS="$CPPFLAGS"
- CPPFLAGS="$_SAVEDCPPFLAGS -I/usr/kerberos/include"
+ CPPFLAGS="$_SAVEDCPPFLAGS -I/usr/include/kerberosV"
unset ac_cv_header_krb5_h
for ac_header in krb5.h
@@ -15858,7 +15858,7 @@ if test `eval echo '${'$as_ac_Header'}'` = yes; then
cat >>confdefs.h <<_ACEOF
#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
_ACEOF
- KRB5INCLUDE="-I/usr/kerberos/include"
+ KRBINCLUDE="-I/usr/include/kerberosV"
FOUNDINCLUDE=yes
else
FOUNDINCLUDE=no

View File

@ -0,0 +1,44 @@
$OpenBSD: patch-configure_in,v 1.1 2012/06/28 23:10:48 sthen Exp $
--- configure.in.orig Wed Jun 27 18:32:47 2012
+++ configure.in Thu Jun 28 23:04:19 2012
@@ -211,13 +211,13 @@ AC_ARG_WITH(pgsql,
ACX_HELP_STRING([--with-pgsql=DIR],
[sets path to pgsql installation]),
PGSQL=$withval,)
-AC_CHECK_LIB(crypt,main)
-if test "$ac_cv_lib_crypt_main" = "yes" -a "x$PGSQL" != "xno"; then
+AC_CHECK_LIB(crypto,main)
+if test "$ac_cv_lib_crypto_main" = "yes" -a "x$PGSQL" != "xno"; then
if test -n "$PGSQL"; then
LDFLAGS="$LDFLAGS -L$PGSQL/lib"
CPPFLAGS="$CPPFLAGS -I$PGSQL/include"
fi
- AC_CHECK_LIB(pq,PQsetdbLogin,,,-lcrypt)
+ AC_CHECK_LIB(pq,PQsetdbLogin,,,-lcrypto)
if test "$ac_cv_lib_pq_PQsetdbLogin" = "yes"; then
AC_CHECK_HEADERS(pgsql/libpq-fe.h)
AC_CHECK_HEADERS(postgresql/libpq-fe.h)
@@ -229,8 +229,8 @@ if test "$ac_cv_lib_crypt_main" = "yes" -a "x$PGSQL" !
PGLIBS="-lpq -lcrypt"
PGINCLUDE="-I/usr/include/pgsql"
elif test "$ac_cv_header_postgresql_libpq_fe_h" = "yes"; then
- PGLIBS="-L$PGSQL/lib -lpq -lcrypt"
- PGINCLUDE="-I/usr/include/postgresql"
+ PGLIBS="-L$PGSQL/lib -lpq -lcrypto"
+ PGINCLUDE="-I$PGSQL/include/postgresql"
elif test "$ac_cv_header_libpq_fe_h" = "yes"; then
PGLIBS="-L$PGSQL/lib -lpq -lcrypt"
PGINCLUDE="-I$PGSQL/include"
@@ -356,10 +356,10 @@ dnl Checks for Kerberos. Must come before openssl chec
AC_CHECK_HEADERS(krb5.h,FOUNDINCLUDE=yes,FOUNDINCLUDE=no)
if test "$FOUNDINCLUDE" = "no"; then
_SAVEDCPPFLAGS="$CPPFLAGS"
- CPPFLAGS="$_SAVEDCPPFLAGS -I/usr/kerberos/include"
+ CPPFLAGS="$_SAVEDCPPFLAGS -I/usr/include/kerberosV"
unset ac_cv_header_krb5_h
AC_CHECK_HEADERS(krb5.h,
- KRB5INCLUDE="-I/usr/kerberos/include"
+ KRB5INCLUDE="-I/usr/include/kerberosV"
FOUNDINCLUDE=yes,
FOUNDINCLUDE=no)
fi

View File

@ -0,0 +1,15 @@
$OpenBSD: patch-plugins_Makefile_in,v 1.3 2012/06/28 23:10:48 sthen Exp $
we have no utmpx, so for now return to ugly 1.4.15 code to parse who(1) output
--- plugins/Makefile.in.orig Thu Jun 28 22:50:07 2012
+++ plugins/Makefile.in Thu Jun 28 22:50:16 2012
@@ -1166,7 +1166,7 @@ check_tcp_LDADD = $(SSLOBJS) $(NETLIBS) $(SSLLIBS)
check_time_LDADD = $(NETLIBS)
check_ntp_time_LDADD = $(NETLIBS) $(MATHLIBS)
check_ups_LDADD = $(NETLIBS)
-check_users_LDADD = $(BASEOBJS)
+check_users_LDADD = $(BASEOBJS) popen.o
check_by_ssh_LDADD = $(NETLIBS)
check_ide_smart_LDADD = $(BASEOBJS)
negate_LDADD = $(BASEOBJS)

View File

@ -0,0 +1,75 @@
$OpenBSD: patch-plugins_check_users_c,v 1.1 2012/06/28 23:10:48 sthen Exp $
we have no utmpx, so for now return to ugly 1.4.15 code to parse who(1) output
--- plugins/check_users.c.orig Wed Jun 27 18:32:47 2012
+++ plugins/check_users.c Thu Jun 28 22:49:10 2012
@@ -35,8 +35,8 @@ const char *copyright = "2000-2007";
const char *email = "nagiosplug-devel@lists.sourceforge.net";
#include "common.h"
+#include "popen.h"
#include "utils.h"
-#include <utmpx.h>
#define possibly_set(a,b) ((a) == 0 ? (b) : 0)
@@ -52,8 +52,8 @@ main (int argc, char **argv)
{
int users = -1;
int result = STATE_UNKNOWN;
+ char input_buffer[MAX_INPUT_BUFFER];
char *perf;
- struct utmpx *putmpx;
setlocale (LC_ALL, "");
bindtextdomain (PACKAGE, LOCALEDIR);
@@ -67,18 +67,41 @@ main (int argc, char **argv)
if (process_arguments (argc, argv) == ERROR)
usage4 (_("Could not parse arguments"));
- users = 0;
+ /* run the command */
+ child_process = spopen (WHO_COMMAND);
+ if (child_process == NULL) {
+ printf (_("Could not open pipe: %s\n"), WHO_COMMAND);
+ return STATE_UNKNOWN;
+}
- /* get currently logged users from utmpx */
- setutxent ();
+ child_stderr = fdopen (child_stderr_array[fileno (child_process)], "r");
+ if (child_stderr == NULL)
+ printf (_("Could not open stderr for %s\n"), WHO_COMMAND);
- while ((putmpx = getutxent ()) != NULL)
- if (putmpx->ut_type == USER_PROCESS)
+ users = 0;
+
+ while (fgets (input_buffer, MAX_INPUT_BUFFER - 1, child_process)) {
+ /* increment 'users' on all lines except total user count */
+ if (input_buffer[0] != '#') {
users++;
+ continue;
+ }
- endutxent ();
+ /* get total logged in users */
+ if (sscanf (input_buffer, _("# users=%d"), &users) == 1)
+ break;
+ }
- /* check the user count against warning and critical thresholds */
+ /* check STDERR */
+ if (fgets (input_buffer, MAX_INPUT_BUFFER - 1, child_stderr))
+ result = possibly_set (result, STATE_UNKNOWN);
+ (void) fclose (child_stderr);
+
+ /* close the pipe */
+ if (spclose (child_process))
+ result = possibly_set (result, STATE_UNKNOWN);
+
+ /* else check the user count against warning and critical thresholds */
if (users > cusers)
result = STATE_CRITICAL;
else if (users > wusers)

View File

@ -1,4 +1,4 @@
@comment $OpenBSD: PLIST-main,v 1.5 2010/11/15 09:56:53 sthen Exp $
@comment $OpenBSD: PLIST-main,v 1.6 2012/06/28 23:10:48 sthen Exp $
@pkgpath net/nagios/plugins
@comment lib/charset.alias
libexec/nagios/
@ -15,7 +15,9 @@ libexec/nagios/check_file_age
libexec/nagios/check_flexlm
libexec/nagios/check_ftp
@bin libexec/nagios/check_http
@mode 4555
@bin libexec/nagios/check_icmp
@mode
libexec/nagios/check_imap
libexec/nagios/check_ircd
libexec/nagios/check_jabber

View File

@ -1,18 +1,19 @@
$OpenBSD: README-main,v 1.2 2011/06/02 13:41:40 ajacoutot Exp $
$OpenBSD: README-main,v 1.3 2012/06/28 23:10:48 sthen Exp $
+-----------------------------------------------------------------------
| Running ${FULLPKGNAME} on OpenBSD
+-----------------------------------------------------------------------
The check_icmp and check_dhcp Nagios plugins need elevated privileges to
run properly. As the code quality of these plugins is not really good,
they are not installed suid root by default.
The check_dhcp and check_icmp plugins need elevated privileges to
run properly. As check_icmp drops privileges early, it is installed
suid root. check_dhcp normally runs entirely as root; as the code
quality of this plugin is not really good, it is not installed
suid root by default.
If you have to use these plugins (note that check_fping could be used
in place of check_icmp), instead of running the whole plugin as root,
it is possible to run them with systrace's privilege elevation feature.
This way the plugin runs as _nagios, but the individual system calls
requiring privileges are run as root.
Instead of running the whole plugin as root, it is possible to run
it with systrace's privilege elevation feature. This way the plugin
runs as _nagios, but the individual system calls requiring privileges
are run as root.
1) Create a preliminary systrace policy for the plugin.