Skip to content

Commit

Permalink
Change nagios_user/group to nrpe_user/group in some places and
Browse files Browse the repository at this point in the history
misc. cleanup.
  • Loading branch information
John C. Frickson committed May 6, 2016
1 parent 1714667 commit fb0bc74
Show file tree
Hide file tree
Showing 12 changed files with 69 additions and 53 deletions.
37 changes: 19 additions & 18 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -4942,9 +4942,6 @@ ac_config_headers="$ac_config_headers include/config.h"
ac_config_files="$ac_config_files Makefile src/Makefile package/solaris/Makefile nrpe.spec uninstall sample-config/nrpe.cfg startup/bsd-init startup/debian-init startup/default-init startup/default-inetd startup/default-service startup/default-socket startup/default-socket-svc startup/default-xinetd startup/mac-org.nagios.PKG_NAME.plist startup/openrc-conf startup/openrc-init startup/solaris-PKG_NAME.xml startup/upstart-init"
#sample-config/debian-nrpe-inetd
#sample-config/openrc-nrpe-inetd
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
Expand Down Expand Up @@ -6776,6 +6773,17 @@ _ACEOF
fi
ac_fn_c_check_func "$LINENO" "seteuid" "ac_cv_func_seteuid"
if test "x$ac_cv_func_seteuid" = xyes; then :
$as_echo "#define SETEUID(id) seteuid(id)" >>confdefs.h
else
$as_echo "#define SETEUID(id) setresuid((uid_t) -1, id, (uid_t) -1)" >>confdefs.h
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for va_copy" >&5
$as_echo_n "checking for va_copy... " >&6; }
if ${ac_cv_HAVE_VA_COPY+:} false; then :
Expand Down Expand Up @@ -6873,17 +6881,6 @@ else
fi
ac_fn_c_check_func "$LINENO" "seteuid" "ac_cv_func_seteuid"
if test "x$ac_cv_func_seteuid" = xyes; then :
$as_echo "#define SETEUID(id) seteuid(id)" >>confdefs.h
else
$as_echo "#define SETEUID(id) setresuid((uid_t) -1, id, (uid_t) -1)" >>confdefs.h
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C99 vsnprintf" >&5
$as_echo_n "checking for C99 vsnprintf... " >&6; }
if ${ac_cv_HAVE_C99_VSNPRINTF+:} false; then :
Expand Down Expand Up @@ -7321,7 +7318,8 @@ $as_echo_n "checking for SSL headers... " >&6; }
if test x_$found_ssl != x_yes; then
as_fn_error $? "Cannot find ssl headers" "$LINENO" 5
else
printf "SSL headers found in $ssldir\n";
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: found in $ssldir" >&5
$as_echo "found in $ssldir" >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for SSL libraries" >&5
$as_echo_n "checking for SSL libraries... " >&6; }
Expand Down Expand Up @@ -7356,7 +7354,8 @@ $as_echo_n "checking for SSL libraries... " >&6; }
if test x_$found_ssl != x_yes; then
as_fn_error $? "Cannot find ssl libraries" "$LINENO" 5
else
printf "SSL libraries found in $ssllibdir\n";
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: found in $ssllibdir" >&5
$as_echo "found in $ssllibdir" >&6; }
LDFLAGS="$LDFLAGS -L$ssllibdir";
LIBS="$LIBS -lssl -lcrypto";
Expand Down Expand Up @@ -7442,9 +7441,11 @@ _ACEOF
done
if test x_$found_kerberos != x_yes; then
printf "could not find include files\n";
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: could not find include files" >&5
$as_echo "$as_me: WARNING: could not find include files" >&2;}
else
printf "found Kerberos include files in $kerbdir\n";
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: found Kerberos include files in $kerbdir" >&5
$as_echo "found Kerberos include files in $kerbdir" >&6; }
fi
Expand Down
23 changes: 11 additions & 12 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,6 @@ AC_CONFIG_FILES([Makefile
startup/upstart-init
])

#sample-config/debian-nrpe-inetd
#sample-config/openrc-nrpe-inetd

dnl Checks for programs.
AC_PROG_CC
AC_PROG_MAKE_SET
Expand Down Expand Up @@ -189,8 +186,15 @@ if test "$ac_cv_type_int32_t" = no ; then
fi
fi

dnl Check for struct sockaddr_storate
AC_CHECK_TYPES([struct sockaddr_storage],[],[],[#include <sys/socket.h>])

dnl Should we use seteuid() or setresuid()?
AC_CHECK_FUNC(seteuid,
AC_DEFINE(SETEUID(id),[seteuid(id)]),
AC_DEFINE(SETEUID(id),[setresuid((uid_t) -1, id, (uid_t) -1)])
)

dnl Check for asprintf() and friends...
AC_CACHE_CHECK([for va_copy],ac_cv_HAVE_VA_COPY,[
AC_TRY_LINK([#include <stdarg.h>
Expand All @@ -215,11 +219,6 @@ AC_CHECK_FUNC(snprintf,,SNPRINTF_O=./snprintf.o)
AC_CHECK_FUNC(asprintf,,SNPRINTF_O=./snprintf.o)
AC_CHECK_FUNC(vasprintf,,SNPRINTF_O=./snprintf.o)

AC_CHECK_FUNC(seteuid,
AC_DEFINE(SETEUID(id),[seteuid(id)]),
AC_DEFINE(SETEUID(id),[setresuid((uid_t) -1, id, (uid_t) -1)])
)

AC_CACHE_CHECK([for C99 vsnprintf],ac_cv_HAVE_C99_VSNPRINTF,[
AC_TRY_RUN([
#include <sys/types.h>
Expand Down Expand Up @@ -388,7 +387,7 @@ if test x$check_for_ssl = xyes; then
if test x_$found_ssl != x_yes; then
AC_MSG_ERROR(Cannot find ssl headers)
else
printf "SSL headers found in $ssldir\n";
AC_MSG_RESULT(found in $ssldir)

dnl Now try and find SSL libraries
AC_MSG_CHECKING(for SSL libraries)
Expand Down Expand Up @@ -423,7 +422,7 @@ if test x$check_for_ssl = xyes; then
if test x_$found_ssl != x_yes; then
AC_MSG_ERROR(Cannot find ssl libraries)
else
printf "SSL libraries found in $ssllibdir\n";
AC_MSG_RESULT(found in $ssllibdir)

LDFLAGS="$LDFLAGS -L$ssllibdir";
LIBS="$LIBS -lssl -lcrypto";
Expand Down Expand Up @@ -462,9 +461,9 @@ if test x$check_for_ssl = xyes; then
done

if test x_$found_kerberos != x_yes; then
printf "could not find include files\n";
AC_MSG_WARN(could not find include files)
else
printf "found Kerberos include files in $kerbdir\n";
AC_MSG_RESULT(found Kerberos include files in $kerbdir)
fi


Expand Down
2 changes: 1 addition & 1 deletion nrpe.spec.in
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ if [ $? -ne 0 ] ; then
fi
%endif

# Create `nagios' user on the system if necessary
# Create `nrpe' user on the system if necessary
%if %{isaix}
lsuser %{nsusr} > /dev/null 2> /dev/null
if [ $? -eq 2 ] ; then
Expand Down
4 changes: 2 additions & 2 deletions src/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,11 @@ install-plugin: install-uninstall

install-daemon: install-uninstall
$(INSTALL) -m 755 nrpe $(SBINDIR)
@if ! test -d "$PIDDIR" ; then \
@if ! test -d "$(PIDDIR)" ; then \
echo $(INSTALL) -m 755 $(NRPE_INSTALL_OPTS) -d $(PIDDIR); \
$(INSTALL) -m 755 $(NRPE_INSTALL_OPTS) -d $(PIDDIR); \
fi
@if test "$TMPFILESDIR" != "N/A" ; then \
@if test "$(TMPFILESDIR)" != "N/A" ; then \
echo $(INSTALL) -m 644 startup/$(SRC_TMPFILE) $(TMPFILESDIR)/nrpe; \
$(INSTALL) -m 644 startup/$(SRC_TMPFILE) $(TMPFILESDIR)/nrpe; \
fi
Expand Down
6 changes: 3 additions & 3 deletions startup/default-inetd.in
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Enable the following entry to enable the nrpe daemon
#nrpe stream tcp nowait @nagios_user@ @sbindir@/nrpe -c @pkgsysconfdir@/nrpe.cfg --inetd
# Enable the following entry to enable the nrpe daemon if you have tcpwrappers
#nrpe stream tcp nowait @nagios_user@ /usr/sbin/tcpd @sbindir@/nrpe -c @pkgsysconfdir@/nrpe.cfg --inetd
#nrpe stream tcp nowait @nrpe_user@ @sbindir@/nrpe -c @pkgsysconfdir@/nrpe.cfg --inetd
# Enable the following entry if the nrpe daemon didn't link with libwrap
#nrpe stream tcp nowait @nrpe_user@ /usr/sbin/tcpd @sbindir@/nrpe -c @pkgsysconfdir@/nrpe.cfg --inetd
4 changes: 2 additions & 2 deletions startup/default-service.in
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ RuntimeDirectoryMode=0755
ExecStart=@sbindir@/nrpe -c @pkgsysconfdir@/nrpe.cfg -f
ExecStopPost=/bin/rm -f @piddir@/nrpe.pid
TimeoutStopSec=60
User=@nagios_user@
Group=@nagios_group@
User=@nrpe_user@
Group=@nrpe_group@
PrivateTmp=true
OOMScoreAdjust=-500
4 changes: 2 additions & 2 deletions startup/default-socket-svc.in
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ After=var-run.mount nss-lookup.target network.target local-fs.target time-sync.t
Restart=on-failure
ExecStart=@sbindir@/nrpe -c @pkgsysconfdir@/nrpe.cfg -f
KillMode=process
User=@nagios_user@
Group=@nagios_group@
User=@nrpe_user@
Group=@nrpe_group@
PrivateTmp=true
OOMScoreAdjust=-500

Expand Down
4 changes: 2 additions & 2 deletions startup/default-xinetd.in
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ service nrpe
socket_type = stream
port = @NRPE_PORT@
wait = no
user = nagios
group = nagios
user = @nrpe_user@
group = @nrpe_group@
server = @sbindir@/nrpe
server_args = -c @pkgsysconfdir@/nrpe.cfg --inetd
only_from = 127.0.0.1
Expand Down
4 changes: 2 additions & 2 deletions startup/mac-org.nagios.PKG_NAME.plist.in
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
<key>Label</key>
<string>org.nagios.nrpe</string>
<key>UserName</key>
<string>nagios</string>
<string>@nrpe_user@</string>
<key>GroupName</key>
<string>nagios</string>
<string>@nrpe_group@</string>
<key>Program</key>
<string>@sbindir@/nrpe</string>
<key>ProgramArguments</key>
Expand Down
4 changes: 2 additions & 2 deletions startup/solaris-PKG_NAME.xml.in
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,9 @@
</dependent>

<method_context>
<method_credential user='@nagios_user@' group='@nagios_group@'/>
<method_credential user='@nrpe_user@' group='@nrpe_group@'/>
<method_environment>
<envvar name='BASEDIR' value='/export/home/@nagios_user@'/>
<envvar name='BASEDIR' value='/export/home/@nrpe_user@'/>
</method_environment>
</method_context>

Expand Down
2 changes: 1 addition & 1 deletion startup/tmpfile.conf.in
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
#Type Path Mode UID GID Age Argument
D @piddir@ 0755 @nagios_user@ @nagios_group@ - -
D @piddir@ 0755 @nrpe_user@ @nrpe_group@ - -
28 changes: 22 additions & 6 deletions uninstall.in
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ progs=0
config=0
start=0
force="-f"
redir="2>/dev/null"
redir=1

# Set file and path names
NAME=@PKG_NAME@
Expand Down Expand Up @@ -49,7 +49,7 @@ get_opts () {
progs) progs=1 ;;
config) config=1 ;;
startup) start=1 ;;
-v) verb=1; force=""; redir="" ;;
-v) verb=1; force=""; redir=0 ;;
all) progs=1; config=1; start=1 ;;
*) echo "Invalid argument: $arg"; usage ;;
esac
Expand Down Expand Up @@ -114,9 +114,17 @@ rm_progs () {
prt_msg 2 0 1 "Delete $PLUGINSDIR/check_nrpe" && {
rm $force "$PLUGINSDIR/check_nrpe"
prt_msg 2 1 0 "Remove directory $PLUGINSDIR"
rmdir "$PLUGINSDIR" $redir
if test $redir -eq 1; then
rmdir "$PLUGINSDIR" 2>/dev/null
else
rmdir "$PLUGINSDIR"
fi
prt_msg 2 1 0 "Remove directory $LIBEXECDIR"
rmdir "$LIBEXECDIR" $redir
if test $redir -eq 1; then
rmdir "$LIBEXECDIR" 2>/dev/null
else
rmdir "$LIBEXECDIR"
fi
}
fi

Expand All @@ -130,7 +138,11 @@ rm_progs () {
if test -d "$PIDDIR" ; then
num=0
prt_msg 2 0 1 "Remove directory $PIDDIR" && {
rmdir "$PIDDIR" $redir
if test $redir -eq 1; then
rmdir "$PIDDIR" 2>/dev/null
else
rmdir "$PIDDIR"
fi
}
fi

Expand Down Expand Up @@ -242,7 +254,11 @@ rm_config () {
prt_msg 2 0 1 "Delete $CFGDIR/$NAME.cfg" || return
rm $force "$CFGDIR/$NAME.cfg"
prt_msg 2 1 0 "Removing directory $CFGDIR"
rm $force "$CFGDIR"
if test $redir -eq 1; then
rmdir "$CFGDIR" 2>/dev/null
else
rmdir "$CFGDIR"
fi
fi

if test $num -eq 0; then
Expand Down

0 comments on commit fb0bc74

Please sign in to comment.