Separation of root setuid plugins into plugins-root/

git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1233 f882894a-f735-0410-b71e-b25c423dba1c
This commit is contained in:
Ton Voon 2005-09-21 10:06:37 +00:00
parent 635ac19a4e
commit fb1936ca4f
10 changed files with 2560 additions and 10 deletions

View file

@ -25,5 +25,5 @@ Use of duplication of macros in m4/np_curl.m4
Coreutils team
Copyright (C) 91, 1995-2004 Free Software Foundation, Inc.
http://www.gnu.org/software/coreutils/
Use of macros and lib files in m4/np_coreutils.m4 and lib/
Use of macros and lib files in m4/np_coreutils.m4 and lib/. Setuid installs in plugins-root

View file

@ -1,5 +1,11 @@
This file documents the major additions and syntax changes between releases.
1.4.3
Setuid plugins (check_dhcp, check_icmp) separated into plugins-root/. Run make install as root to install
1.4.2
Fix for Redhat ES4 for check_dns and check_dig
1.4
IPv6 support in check_ping, check_by_ssh, check_http, check_ldap, check_smtp, check_tcp
Internationalisation support

View file

@ -1,6 +1,6 @@
## Process this file with automake to produce Makefile.in
SUBDIRS = intl lib plugins plugins-scripts m4 po
SUBDIRS = intl lib plugins plugins-scripts plugins-root m4 po
EXTRA_DIST = config.rpath \
ABOUT-NLS ACKNOWLEDGEMENTS AUTHORS BUGS CHANGES CODING FAQ LEGAL \
@ -16,6 +16,9 @@ DEFS = -DLOCALEDIR=\"$(localedir)\"
dist-hook:
make THANKS nagios-plugins.spec pkg/fedora/nagios-plugins.spec
install-root:
cd plugins-root && $(MAKE) $@
test:
cd plugins; $(MAKE) test
cd plugins-scripts; $(MAKE) test

7
README
View file

@ -85,8 +85,13 @@ Nagios Plugins Quick-and-Dirty Installation Instructions
'libexec/' subdirectory in the base directory you specified with
the --prefix argument to the configure script.
4) There are some plugins that require setuid. If you run make install as
a non root user, they will not be installed. To install, switch to root and
run:
4) Verify that your host configuration file (hosts.cfg) for Nagios contains
make install-root
5) Verify that your host configuration file (hosts.cfg) for Nagios contains
the correct paths to the new plugins.

View file

@ -1546,6 +1546,7 @@ AC_OUTPUT(
lib/Makefile
m4/Makefile
plugins/Makefile
plugins-root/Makefile
plugins-scripts/Makefile
plugins-scripts/subst
plugins-scripts/utils.pm

5
plugins-root/.cvsignore Normal file
View file

@ -0,0 +1,5 @@
.deps
Makefile.in
Makefile
check_dhcp
check_icmp

74
plugins-root/Makefile.am Normal file
View file

@ -0,0 +1,74 @@
## 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

1261
plugins-root/check_dhcp.c Normal file

File diff suppressed because it is too large Load diff

1199
plugins-root/check_icmp.c Normal file

File diff suppressed because it is too large Load diff

View file

@ -10,11 +10,11 @@ DEFS = -DLOCALEDIR=\"$(localedir)\" @DEFS@
LIBS = @LIBINTL@ @LIBS@ @SSLINCLUDE@
MATHLIBS = @MATHLIBS@
libexec_PROGRAMS = check_dhcp check_disk check_dummy check_http check_load \
libexec_PROGRAMS = check_disk check_dummy check_http check_load \
check_mrtg check_mrtgtraf check_nwstat check_overcr check_ping \
check_real check_smtp check_ssh check_tcp check_time \
check_udp check_ups check_users negate urlize \
check_icmp @EXTRAS@
check_udp check_ups check_users negate \
urlize @EXTRAS@
check_tcp_programs = check_ftp check_imap check_nntp check_pop \
check_udp2 @check_tcp_ssl@
@ -45,7 +45,6 @@ AM_INSTALL_PROGRAM_FLAGS = @INSTALL_OPTS@
##############################################################################
# the actual targets
check_dhcp_LDADD = $(NETLIBS)
check_dig_LDADD = $(NETLIBS) popen.o
check_disk_LDADD = $(BASEOBJS) popen.o
check_dns_LDADD = $(NETLIBS) popen.o
@ -54,7 +53,6 @@ check_fping_LDADD = $(NETLIBS) popen.o
check_game_LDADD = $(BASEOBJS) popen.o
check_http_LDADD = $(NETLIBS) $(SSLLIBS)
check_hpjd_LDADD = $(NETLIBS) popen.o
check_icmp_LDADD = $(SOCKETLIBS)
check_ldap_LDADD = $(NETLIBS) $(LDAPLIBS)
check_load_LDADD = $(BASEOBJS) popen.o
check_mrtg_LDADD = $(BASEOBJS)
@ -83,7 +81,6 @@ check_ide_smart_LDADD = $(BASEOBJS)
negate_LDADD = $(BASEOBJS) popen.o
urlize_LDADD = $(BASEOBJS) popen.o
check_dhcp_DEPENDENCIES = check_dhcp.c $(NETOBJS) $(DEPLIBS)
check_dig_DEPENDENCIES = check_dig.c $(NETOBJS) popen.o $(DEPLIBS)
check_disk_DEPENDENCIES = check_disk.c $(BASEOBJS) popen.o $(DEPLIBS)
check_dns_DEPENDENCIES = check_dns.c $(NETOBJS) popen.o $(DEPLIBS)
@ -92,7 +89,6 @@ check_fping_DEPENDENCIES = check_fping.c $(NETOBJS) popen.o $(DEPLIBS)
check_game_DEPENDENCIES = check_game.c $(DEPLIBS)
check_http_DEPENDENCIES = check_http.c $(NETOBJS) $(DEPLIBS)
check_hpjd_DEPENDENCIES = check_hpjd.c $(NETOBJS) popen.o $(DEPLIBS)
check_icmp_DEPENDENCIES = check_icmp.c
check_ide_smart_DEPENDENCIES = check_ide_smart.c $(BASEOBJS) $(DEPLIBS)
check_ldap_DEPENDENCIES = check_ldap.c $(NETOBJS) $(DEPLIBS)
check_load_DEPENDENCIES = check_load.c $(BASEOBJS) popen.o $(DEPLIBS)