[Nagiosplug-checkins] nagiosplug/plugins-root Makefile.am,NONE,1.1 check_dhcp.c,NONE,1.1 check_icmp.c,NONE,1.1 .cvsignore,NONE,1.1

Ton Voon tonvoon at users.sourceforge.net
Wed Sep 21 03:09:31 CEST 2005


Update of /cvsroot/nagiosplug/nagiosplug/plugins-root
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8469/plugins-root

Added Files:
	Makefile.am check_dhcp.c check_icmp.c .cvsignore 
Log Message:
Separation of root setuid plugins into plugins-root/


--- NEW FILE: .cvsignore ---
.deps
Makefile.in
Makefile
check_dhcp
check_icmp

--- NEW FILE: check_dhcp.c ---
/******************************************************************************
*
* CHECK_DHCP.C
*
* Program: DHCP plugin for Nagios
* License: GPL
* Copyright (c) 2001-2004 Ethan Galstad (nagios at nagios.org)
*
* License Information:
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
* GNU General Public License for more details.
[...1222 lines suppressed...]
 -i, --interface=STRING\n\
   Interface to to use for listening (i.e. eth0)\n\
 -v, --verbose\n\
   Print extra information (command-line use only)\n\
 -h, --help\n\
   Print detailed help screen\n\
 -V, --version\n\
   Print version information\n"));
}


void print_usage(void)
{
	printf("\
Usage: %s [-s serverip] [-r requestedip] [-t timeout] [-i interface]\n\
                  [-v]",progname);
}




--- NEW FILE: check_icmp.c ---
/*
 * $Id: check_icmp.c,v 1.1 2005/09/21 10:06:37 tonvoon Exp $
 *
 * Author: Andreas Ericsson <ae at op5.se>
 *
 * License: GNU GPL 2.0 or any later version.
 *
 * Relevant RFC's: 792 (ICMP), 791 (IP)
 *
 * This program was modeled somewhat after the check_icmp program,
 * which was in turn a hack of fping (www.fping.org) but has been
 * completely rewritten since to generate higher precision rta values,
 * and support several different modes as well as setting ttl to control.
 * redundant routes. The only remainders of fping is currently a few
 * function names.
 *
 */

#include <sys/time.h>
[...1160 lines suppressed...]
		   ttl, timeout);

	puts("\nThe -H switch is optional. Naming a host (or several) to check is not.\n\n"
		 "Threshold format for -w and -c is 200.25,60% for 200.25 msec RTA and 60%\n"
		 "packet loss.  The default values should work well for most users.\n"
		 "You can specify different RTA factors using the standardized abbreviations\n"
		 "us (microseconds), ms (milliseconds, default) or just plain s for seconds.\n\n"
		 "Threshold format for -d is warn,crit.  12,14 means WARNING if >= 12 hops\n"
		 "are spent and CRITICAL if >= 14 hops are spent.\n"
		 "NOTE: Some systems decrease TTL when forming ICMP_ECHOREPLY, others do not.\n\n"
		 "The -v switch can be specified several times for increased verbosity.\n\n"
		 "Long options are currently unsupported.\n\n"
		 "Options marked with * require an argument\n");

	puts("The latest version of this plugin can be found at http://oss.op5.se/nagios\n"
		 "or https://devel.op5.se/oss until the day it is included in the official\n"
		 "plugin distribution.\n");

	exit(3);
}

--- NEW FILE: Makefile.am ---
## Process this file with automake to produce Makefile.in

VPATH = $(top_srcdir) $(top_srcdir)/lib $(top_srcdir)/plugins $(top_srcdir)/plugins/t 

INCLUDES = -I.. -I$(top_srcdir)/lib -I$(top_srcdir)/intl -I$(top_srcdir)/plugins

datadir = @datadir@
localedir = $(datadir)/locale
DEFS = -DLOCALEDIR=\"$(localedir)\" @DEFS@
LIBS = @LIBINTL@ @LIBS@ @SSLINCLUDE@

EXTRA_PROGRAMS = check_dhcp check_icmp

BASEOBJS = ../plugins/utils.o ../lib/libnagiosplug.a ../lib/libcoreutils.a
NETOBJS = ../plugins/netutils.o $(BASEOBJS) $(EXTRA_NETOBJS)
NETLIBS = $(NETOBJS) $(SOCKETLIBS)

TESTS_ENVIRONMENT = perl -I $(top_builddir) -I $(top_srcdir)

TESTS = @PLUGIN_TEST@

test:
	perl -I $(top_builddir) -I $(top_srcdir) ../test.pl

all-local: $(EXTRA_PROGRAMS)

setuid_root_mode = 4550

group = nagios

# /* Author Coreutils team - see ACKNOWLEDGEMENTS */

INSTALL_SUID = \
	for f in $(EXTRA_PROGRAMS) ; do \
	p=$$f; \
	echo " $(INSTALL_PROGRAM) $$p $(DESTDIR)$(libexecdir)/$$p"; \
	$(INSTALL_PROGRAM) $$p $(DESTDIR)$(libexecdir)/$$p; \
	echo " chown root $(DESTDIR)$(libexecdir)/$$p"; \
	chown root $(DESTDIR)$(libexecdir)/$$p; \
	echo " chmod $(setuid_root_mode) $(DESTDIR)$(libexecdir)/$$p"; \
	chmod $(setuid_root_mode) $(DESTDIR)$(libexecdir)/$$p; \
	done

install-root: $(EXTRA_PROGRAMS)
	@$(INSTALL_SUID)

install-exec-local: $(EXTRA_PROGRAMS)
	@TMPFILE=$(DESTDIR)$(libexecdir)/.setuid-$$$$; \
	rm -f $$TMPFILE; \
	echo > $$TMPFILE; \
	## See if we can create a setuid root executable in $(libexecdir).
	## If not, then don't even try to install setuid plugins.
	can_create_suid_root_executable=no; \
	chown root $$TMPFILE > /dev/null 2>&1 \
	  && chmod $(setuid_root_mode) $$TMPFILE > /dev/null 2>&1 \
	  && can_create_suid_root_executable=yes; \
	rm -f $$TMPFILE; \
	if test $$can_create_suid_root_executable = yes; then \
	  $(INSTALL_SUID); \
	else \
	  echo "WARNING: insufficient access; not installing setuid plugins"; \
	  echo "NOTE: to install setuid plugins, run 'make install-root' as root"; \
	fi

# /* Author Coreutils team sub-citation */

##############################################################################
# the actual targets
check_dhcp_LDADD = $(NETLIBS)
check_icmp_LDADD = $(SOCKETLIBS)

check_dhcp_DEPENDENCIES = check_dhcp.c $(NETOBJS) $(DEPLIBS) 
check_icmp_DEPENDENCIES = check_icmp.c






More information about the Commits mailing list