Skip to content

Commit

Permalink
Changes from Solaris 10 testing and a couple minor fixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
John C. Frickson committed May 17, 2016
1 parent 81cff32 commit 2c4ee42
Show file tree
Hide file tree
Showing 10 changed files with 146 additions and 240 deletions.
120 changes: 86 additions & 34 deletions Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,24 @@ CC=@CC@
CFLAGS=@CFLAGS@ @DEFS@
LDFLAGS=@LDFLAGS@ @LIBS@

INSTALL=@INSTALL@
GREP=@GREP@
EGREP=@EGREP@

prefix=@prefix@
exec_prefix=@exec_prefix@
CFGDIR=@pkgsysconfdir@
BINDIR=@bindir@
SBINDIR=@sbindir@
LIBEXECDIR=@libexecdir@
INSTALL=@INSTALL@
NAGIOS_INSTALL_OPTS=@NAGIOS_INSTALL_OPTS@
NRPE_INSTALL_OPTS=@NRPE_INSTALL_OPTS@
OPSYS=@opsys@
DIST=@dist_type@
USERID=@nrpe_user@
GRPID=@nrpe_group@
NRPE_USER=@nrpe_user@
NRPE_GROUP=@nrpe_group@
NAGIOS_USER=@nagios_user@
NAGIOS_GROUP=@nagios_group@

INIT_TYPE=@init_type@
INIT_DIR=@initdir@
Expand All @@ -48,9 +53,9 @@ default:
echo " install install nrpe and check_nrpe";\
echo " install-plugin install the check_nrpe plugin";\
echo " install-daemon install the nrpe daemon";\
echo " install-group add the $GRPID group id if it does not exist";\
echo " install-user add the $USERID user id if it does not exist";\
echo " install-group-user add the $USERID user and $GRPID group";\
echo " install-group add the groups if they do not exist";\
echo " install-user add the user ids if they do not exist";\
echo " install-group-user add the users and groups if they do not exist";\
echo " install-config install the nrpe configuration file";\
echo " install-inetd install the startup files for inetd, launchd, etc.";\
echo " install-init install the startup files for init, systemd, etc.";\
Expand All @@ -63,8 +68,7 @@ all:
@echo "";\
echo "*** Compile finished ***";\
echo "";\
echo "If the NRPE daemon and client compiled without any errors, you";\
echo "can continue with the installation or upgrade process.";\
echo "You can now continue with the installation or upgrade process.";\
echo "";\
echo "Read the PDF documentation (NRPE.pdf) for information on the next";\
echo "steps you should take to complete the installation or upgrade.";\
Expand All @@ -91,18 +95,22 @@ install-inetd:
exit 1; \
fi
@if test $(INETD_TYPE) = inetd; then \
grep -E -q "^\W*nrpe\s+" $(INETD_DIR)/$(INETD_FILE) || \
$(EGREP) -q "^\W*nrpe\s+" $(INETD_DIR)/$(INETD_FILE) || \
cat startup/$(SRC_INETD) >> $(INETD_DIR)/$(INETD_FILE); \
else \
elifif test $(INETD_TYPE) = systemd; then \
SRC_INETD_FILE=`echo "$(SRC_INETD)" | sed -e 's/socket/socket-svc/'`; \
echo $(INSTALL) -m 644 startup/$$SRC_INETD_FILE $(INETD_DIR)/$(INIT_FILE); \
$(INSTALL) -m 644 startup/$$SRC_INETD_FILE $(INETD_DIR)/$(INIT_FILE); \
elif test $(INETD_TYPE) = smf10 -o $(INETD_TYPE) = smf11; then \
echo svccfg import startup/$(SRC_INETD); \
svccfg import startup/$(SRC_INETD); \
echo svcadm enable nrpe; \
svcadm enable nrpe; \
else\
echo $(INSTALL) -m 644 startup/$(SRC_INETD) $(INETD_DIR)/$(INETD_FILE); \
$(INSTALL) -m 644 startup/$(SRC_INETD) $(INETD_DIR)/$(INETD_FILE); \
if test $(INETD_TYPE) = systemd; then \
SRC_INETD_FILE=`echo "$(SRC_INETD)" | sed -e 's/socket/socket-svc/'`; \
echo $(INSTALL) -m 644 startup/$$SRC_INETD_FILE $(INETD_DIR)/$(INIT_FILE); \
$(INSTALL) -m 644 startup/$$SRC_INETD_FILE $(INETD_DIR)/$(INIT_FILE); \
fi; \
fi
@grep -E -q "^nrpe[\t ]+5666/tcp" /etc/services || \
@$(EGREP) -q "^nrpe[\t ]+5666/tcp" /etc/services || \
echo "***** MAKE SURE 'nrpe 5666/tcp' IS IN YOUR /etc/services FILE"

install-init:
Expand All @@ -118,6 +126,11 @@ install-init:
elif test $(INIT_TYPE) = systemd; then\
echo $(INSTALL) -m 644 startup/$(SRC_INIT) $(INIT_DIR)/$(INIT_FILE); \
$(INSTALL) -m 644 startup/$(SRC_INIT) $(INIT_DIR)/$(INIT_FILE); \
elif test $(INETD_TYPE) = smf10 -o $(INETD_TYPE) = smf11; then \
echo svccfg import startup/$(SRC_INIT); \
svccfg import startup/$(SRC_INIT); \
echo svcadm enable nrpe; \
svcadm enable nrpe; \
else\
echo $(INSTALL) -m 755 startup/$(SRC_INIT) $(INIT_DIR)/$(INIT_FILE); \
$(INSTALL) -m 755 startup/$(SRC_INIT) $(INIT_DIR)/$(INIT_FILE); \
Expand All @@ -128,35 +141,74 @@ install-config:
$(INSTALL) -m 644 $(NRPE_INSTALL_OPTS) sample-config/nrpe.cfg $(CFGDIR)

install-group:
@if test $(OPSYS) = aix; then\
mkgroup $(GRPID);\
elif test $(OPSYS) = hpux -o $(OPSYS) = solaris; then\
groupadd $(GRPID);\
@if test $(DIST) = aix; then\
echo mkgroup $(NAGIOS_GROUP);\
mkgroup $(NAGIOS_GROUP);\
echo mkgroup $(NRPE_GROUP);\
mkgroup $(NRPE_GROUP);\
elif test $(DIST) = hpux -o $(DIST) = solaris; then\
echo groupadd $(NAGIOS_GROUP);\
groupadd $(NAGIOS_GROUP);\
echo groupadd $(NRPE_GROUP);\
groupadd $(NRPE_GROUP);\
elif test $(OPSYS) = osx; then\
newid=`dscl . -list /Groups gid | tr -s ' ' | cut -d' ' -f2 | sort -n | tail -1`;\
newid=`expr 1 + $newid`;\
dscl . -create /Groups/$(GRPID) gid $$newid;\
elif test $(OPSYS) = "bsd" -a $(DIST) = "freebsd"; then\
pw add group $(GRPID);\
newid=`expr 1 + $newid`;\
echo dscl . -create /Groups/$(NAGIOS_GROUP) gid $$newid;\
dscl . -create /Groups/$(NAGIOS_GROUP) gid $$newid;\
newid=`expr 1 + $newid`;\
echo dscl . -create /Groups/$(NRPE_GROUP) gid $$newid;\
dscl . -create /Groups/$(NRPE_GROUP) gid $$newid;\
elif test $(DIST) = "freebsd"; then\
echo pw add group $(NAGIOS_GROUP);\
pw add group $(NAGIOS_GROUP);\
echo pw add group $(NRPE_GROUP);\
pw add group $(NRPE_GROUP);\
else\
groupadd -r $(GRPID);\
echo groupadd -r $(NAGIOS_GROUP);\
groupadd -r $(NAGIOS_GROUP);\
echo groupadd -r $(NRPE_GROUP);\
groupadd -r $(NRPE_GROUP);\
fi

install-user:
@if test $(OPSYS) = aix; then\
useradd -g $(GRPID) $(USERID);\
elif test $(OPSYS) = hpux -o $(OPSYS) = solaris; then\
useradd -g $(GRPID) $(USERID);\
@if test $(DIST) = aix; then\
echo useradd -g $(NAGIOS_GROUP) $(NAGIOS_USER);\
useradd -g $(NAGIOS_GROUP) $(NAGIOS_USER);\
echo useradd -g $(NRPE_GROUP) $(NRPE_USER);\
useradd -g $(NRPE_GROUP) $(NRPE_USER);\
elif test $(DIST) = hpux -o $(DIST) = solaris; then\
echo useradd -g $(NAGIOS_GROUP) $(NAGIOS_USER);\
useradd -g $(NAGIOS_GROUP) $(NAGIOS_USER);\
echo useradd -g $(NRPE_GROUP) $(NRPE_USER);\
useradd -g $(NRPE_GROUP) $(NRPE_USER);\
elif test $(OPSYS) = osx; then\
newid=`dscl . -list /Users UniqueID | tr -s ' ' | cut -d' ' -f2 | sort -n | tail -1`;\
newid=`expr 1 + $newid`;\
dscl . -create /Users/$(USERID);\
dscl . -create /Users/$(USERID) UniqueID $$newid;\
dscl . -append /Groups/$(GRPID) GroupMembership $(USERID);\
elif test $(OPSYS) = "bsd" -a $(DIST) = "freebsd"; then\
pw add user -g $(GRPID) $(USERID);\
echo dscl . -create /Users/$(NAGIOS_USER);\
echo dscl . -create /Users/$(NAGIOS_USER) UniqueID $$newid;\
echo dscl . -append /Groups/$(NAGIOS_GROUP) GroupMembership $(NAGIOS_USER);\
dscl . -create /Users/$(NAGIOS_USER);\
dscl . -create /Users/$(NAGIOS_USER) UniqueID $$newid;\
dscl . -append /Groups/$(NAGIOS_GROUP) GroupMembership $(NAGIOS_USER);\
newid=`expr 1 + $newid`;\
echo dscl . -create /Users/$(NRPE_USER);\
echo dscl . -create /Users/$(NRPE_USER) UniqueID $$newid;\
echo dscl . -append /Groups/$(NRPE_GROUP) GroupMembership $(NRPE_USER);\
dscl . -create /Users/$(NRPE_USER);\
dscl . -create /Users/$(NRPE_USER) UniqueID $$newid;\
dscl . -append /Groups/$(NRPE_GROUP) GroupMembership $(NRPE_USER);\
elif test $(DIST) = "freebsd"; then\
echo pw add user -g $(NAGIOS_GROUP) $(NAGIOS_USER);\
pw add user -g $(NAGIOS_GROUP) $(NAGIOS_USER);\
echo pw add user -g $(NRPE_GROUP) $(NRPE_USER);\
pw add user -g $(NRPE_GROUP) $(NRPE_USER);\
else\
useradd -r -g $(GRPID) $(USERID);\
echo useradd -r -g $(NAGIOS_GROUP) $(NAGIOS_USER);\
useradd -r -g $(NAGIOS_GROUP) $(NAGIOS_USER);\
echo useradd -r -g $(NRPE_GROUP) $(NRPE_USER);\
useradd -r -g $(NRPE_GROUP) $(NRPE_USER);\
fi

install-group-user:
Expand Down
4 changes: 2 additions & 2 deletions build-aux/ax_nagios_get_files
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@ AS_CASE([$init_type],
src_init=openrc-init,

[smf*],
src_init="solaris-PKG_NAME.xml"
src_inetd="solaris-PKG_NAME.xml",
src_init="solaris-init.xml"
src_inetd="solaris-inetd.xml",

[upstart],
if test $dist_type = rh ; then
Expand Down
8 changes: 4 additions & 4 deletions build-aux/ax_nagios_get_paths
Original file line number Diff line number Diff line change
Expand Up @@ -212,14 +212,14 @@ AC_ARG_WITH(pipedir, AC_HELP_STRING([--with-pipedir=DIR],

if test $install_method = "default"; then
if test $opsys = "unix"; then
if test x"$prefix" = "xNONE"; then prefix="/usr/local/$PKG_NAME"; fi
if test x"$prefix" = "xNONE"; then prefix="/usr/local/nagios"; fi
else
if test x"$prefix" = "xNONE"; then prefix=${ac_default_prefix}; fi
fi
datarootdir=${datarootdir="$prefix"}

elif test $install_method = "opt"; then
if test x"$prefix" = "xNONE"; then prefix="/opt/$PKG_NAME"; fi
if test x"$prefix" = "xNONE"; then prefix="/opt/nagios"; fi

else
if test x"$datadir" = x'${datarootdir}'; then AS_UNSET(datadir); fi
Expand Down Expand Up @@ -651,9 +651,9 @@ AS_CASE([$init_type],

[smf*],
if test $init_type = smf10; then
initdir=${initdir="/var/svc/manifest/network"}
initdir=${initdir="/var/svc/manifest/network/nagios"}
else
initdir=${initdir="/lib/svc/manifest/network"}
initdir=${initdir="/lib/svc/manifest/network/nagios"}
fi
initname=${initname="$PKG_NAME.xml"}
initconfdir=unknown
Expand Down
20 changes: 11 additions & 9 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -3284,14 +3284,14 @@ fi
if test $install_method = "default"; then
if test $opsys = "unix"; then
if test x"$prefix" = "xNONE"; then prefix="/usr/local/$PKG_NAME"; fi
if test x"$prefix" = "xNONE"; then prefix="/usr/local/nagios"; fi
else
if test x"$prefix" = "xNONE"; then prefix=${ac_default_prefix}; fi
fi
datarootdir=${datarootdir="$prefix"}
elif test $install_method = "opt"; then
if test x"$prefix" = "xNONE"; then prefix="/opt/$PKG_NAME"; fi
if test x"$prefix" = "xNONE"; then prefix="/opt/nagios"; fi
else
if test x"$datadir" = x'${datarootdir}'; then { datadir=; unset datadir;}; fi
Expand Down Expand Up @@ -3718,9 +3718,9 @@ case $init_type in #(
initconf=${initconf="$initconfdir/$PKG_NAME"} ;; #(
smf*) :
if test $init_type = smf10; then
initdir=${initdir="/var/svc/manifest/network"}
initdir=${initdir="/var/svc/manifest/network/nagios"}
else
initdir=${initdir="/lib/svc/manifest/network"}
initdir=${initdir="/lib/svc/manifest/network/nagios"}
fi
initname=${initname="$PKG_NAME.xml"}
initconfdir=unknown
Expand Down Expand Up @@ -3812,8 +3812,8 @@ case $init_type in #(
openrc) :
src_init=openrc-init ;; #(
smf*) :
src_init="solaris-PKG_NAME.xml"
src_inetd="solaris-PKG_NAME.xml" ;; #(
src_init="solaris-init.xml"
src_inetd="solaris-inetd.xml" ;; #(
upstart) :
if test $dist_type = rh ; then
src_init=rh-upstart-init
Expand Down Expand Up @@ -4945,7 +4945,7 @@ fi
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/newbsd-init startup/openrc-conf startup/openrc-init startup/solaris-PKG_NAME.xml startup/tmpfile.conf startup/upstart-init startup/rh-upstart-init"
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/newbsd-init startup/openrc-conf startup/openrc-init startup/solaris-init.xml startup/solaris-inetd.xml startup/tmpfile.conf startup/upstart-init startup/rh-upstart-init"
ac_ext=c
Expand Down Expand Up @@ -7291,7 +7291,8 @@ $as_echo_n "checking for SSL headers... " >&6; }
found_ssl=no
for dir in $ssl_inc_dir $ssl_dir /usr/local/openssl /usr/local/opt/openssl \
/usr/local/ssl /usr/lib/ssl /usr/ssl /usr/pkg /usr/local /usr \
/usr/freeware/lib/openssl /usr/sfw/include /opt/openssl; do
/usr/freeware/lib/openssl /usr/sfw /usr/sfw/include \
/opt/openssl; do
ssldir="$dir"
if test -f "$dir/include/openssl/ssl.h"; then
found_ssl=yes
Expand Down Expand Up @@ -8237,7 +8238,8 @@ do
"startup/newbsd-init") CONFIG_FILES="$CONFIG_FILES startup/newbsd-init" ;;
"startup/openrc-conf") CONFIG_FILES="$CONFIG_FILES startup/openrc-conf" ;;
"startup/openrc-init") CONFIG_FILES="$CONFIG_FILES startup/openrc-init" ;;
"startup/solaris-PKG_NAME.xml") CONFIG_FILES="$CONFIG_FILES startup/solaris-PKG_NAME.xml" ;;
"startup/solaris-init.xml") CONFIG_FILES="$CONFIG_FILES startup/solaris-init.xml" ;;
"startup/solaris-inetd.xml") CONFIG_FILES="$CONFIG_FILES startup/solaris-inetd.xml" ;;
"startup/tmpfile.conf") CONFIG_FILES="$CONFIG_FILES startup/tmpfile.conf" ;;
"startup/upstart-init") CONFIG_FILES="$CONFIG_FILES startup/upstart-init" ;;
"startup/rh-upstart-init") CONFIG_FILES="$CONFIG_FILES startup/rh-upstart-init" ;;
Expand Down
6 changes: 4 additions & 2 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,8 @@ AC_CONFIG_FILES([Makefile
startup/newbsd-init
startup/openrc-conf
startup/openrc-init
startup/solaris-PKG_NAME.xml
startup/solaris-init.xml
startup/solaris-inetd.xml
startup/tmpfile.conf
startup/upstart-init
startup/rh-upstart-init
Expand Down Expand Up @@ -357,7 +358,8 @@ if test x$check_for_ssl = xyes; then
found_ssl=no
for dir in $ssl_inc_dir $ssl_dir /usr/local/openssl /usr/local/opt/openssl \
/usr/local/ssl /usr/lib/ssl /usr/ssl /usr/pkg /usr/local /usr \
/usr/freeware/lib/openssl /usr/sfw/include /opt/openssl; do
/usr/freeware/lib/openssl /usr/sfw /usr/sfw/include \
/opt/openssl; do
ssldir="$dir"
if test -f "$dir/include/openssl/ssl.h"; then
found_ssl=yes
Expand Down
2 changes: 1 addition & 1 deletion src/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ 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
Expand Down
5 changes: 3 additions & 2 deletions src/check_nrpe.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ int show_version = FALSE;
int packet_ver = NRPE_PACKET_VERSION_3;

#ifdef HAVE_SSL
# if (defined(__sun) && defined(__SunOS_5_10)) || defined(_AIX) || defined(__hpux)
/* # if (defined(__sun) && defined(__SunOS_5_10)) || defined(_AIX) || defined(__hpux) */
# if defined(__sun) || defined(_AIX) || defined(__hpux)
SSL_METHOD *meth;
# else
const SSL_METHOD *meth;
Expand Down Expand Up @@ -672,7 +673,7 @@ int connect_to_remote()
if (sslprm.log_opts & SSL_LogCipher) {
const SSL_CIPHER *c = SSL_get_current_cipher(ssl);
syslog(LOG_NOTICE, "Remote %s - %s, Cipher is %s", rem_host,
SSL_CIPHER_get_version(c), SSL_CIPHER_get_name(c));
(char*)SSL_CIPHER_get_version(c), (char*)SSL_CIPHER_get_name(c));
}

if ((sslprm.log_opts & SSL_LogIfClientCert) || (sslprm.log_opts & SSL_LogCertDetails)) {
Expand Down
5 changes: 3 additions & 2 deletions src/nrpe.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ int rfc931_timeout=15;
#endif

#ifdef HAVE_SSL
# if (defined(__sun) && defined(__SunOS_5_10)) || defined(_AIX) || defined(__upux)
/* # if (defined(__sun) && defined(__SunOS_5_10)) || defined(_AIX) || defined(__hpux) */
# if defined(__sun) || defined(_AIX) || defined(__hpux)
SSL_METHOD *meth;
# else
const SSL_METHOD *meth;
Expand Down Expand Up @@ -1771,7 +1772,7 @@ int handle_conn_ssl(int sock, void *ssl_ptr)
if (sslprm.log_opts & SSL_LogCipher) {
c = SSL_get_current_cipher(ssl);
syslog(LOG_NOTICE, "Remote %s - %s, Cipher is %s", remote_host,
SSL_CIPHER_get_version(c), SSL_CIPHER_get_name(c));
(char*)SSL_CIPHER_get_version(c), (char*)SSL_CIPHER_get_name(c));
}

if ((sslprm.log_opts & SSL_LogIfClientCert)
Expand Down
Loading

0 comments on commit 2c4ee42

Please sign in to comment.