Permalink
Browse files

root privilege escalation fix

  • Loading branch information...
John C. Frickson
John C. Frickson committed Nov 9, 2016
1 parent 17087c5 commit f2ed227673d3b2da643eb5cad26b2d87674f28c1
Showing with 15 additions and 6 deletions.
  1. +4 −1 Changelog
  2. +11 −5 daemon-init.in
View
@@ -5,6 +5,9 @@ Nagios Core 4 Change Log
4.2.x - xxxx-xx-xx
-------------------
+SECURITY FIXES
+* Fixed a root privilege escalation
+
FIXES
* external command during reload doesn't work (John Frickson)
* Nagios provides no error condition as to why it fails on the verify for serviceescalation (John Frickson)
@@ -19,7 +22,7 @@ FIXES
* nagios: job XX (pid=YY): read() returned error 11 (changed from LOG_ERR to LOG_NOTICE) (John Frickson)
-4.2.2 - 2016-10-xx
+4.2.2 - 2016-10-24
------------------
SECURITY FIXES
* There was a fix to vulnerability CVE-2008-4796 in the 4.2.0 release on
View
@@ -79,7 +79,7 @@ if test "$USE_RAMDISK" -ne 0 && test "$RAMDISK_SIZE"X != "X"; then
mkdir -p -m 0755 ${RAMDISK_DIR}
mount -t tmpfs -o size=${RAMDISK_SIZE}m tmpfs ${RAMDISK_DIR}
mkdir -p -m 0755 ${RAMDISK_DIR}/checkresults
- chown -R $NagiosUser:$NagiosGroup ${RAMDISK_DIR}
+ chown -h -R $NagiosUser:$NagiosGroup ${RAMDISK_DIR}
fi
fi
@@ -91,26 +91,32 @@ check_config ()
WARN=`grep ^"Total Warnings:" "$TMPFILE" |awk -F: '{print \$2}' |sed s/' '//g`
ERR=`grep ^"Total Errors:" "$TMPFILE" |awk -F: '{print \$2}' |sed s/' '//g`
+ rm -f "$NagiosCfgtestFile";
+ if test -e "$NagiosCfgtestFile"; then
+ echo "ERROR: Could not delete '$NagiosCfgtestFile'"
+ exit 8
+ fi
+
if test "$WARN" = "0" && test "${ERR}" = "0"; then
echo "OK - Configuration check verified" > $NagiosCfgtestFile
chmod 0644 $NagiosCfgtestFile
- chown $NagiosUser:$NagiosGroup $NagiosCfgtestFile
+ chown -h $NagiosUser:$NagiosGroup $NagiosCfgtestFile
/bin/rm "$TMPFILE"
return 0
elif test "${ERR}" = "0"; then
# Write the errors to a file we can have a script watching for.
echo "WARNING: Warnings in config files - see log for details: $NagiosCfgtestFile" > $NagiosCfgtestFile
egrep -i "(^warning|^error)" "$TMPFILE" >> $NagiosCfgtestFile
chmod 0644 $NagiosCfgtestFile
- chown $NagiosUser:$NagiosGroup $NagiosCfgtestFile
+ chown -h $NagiosUser:$NagiosGroup $NagiosCfgtestFile
/bin/rm "$TMPFILE"
return 0
else
# Write the errors to a file we can have a script watching for.
echo "ERROR: Errors in config files - see log for details: $NagiosCfgtestFile" > $NagiosCfgtestFile
egrep -i "(^warning|^error)" "$TMPFILE" >> $NagiosCfgtestFile
chmod 0644 $NagiosCfgtestFile
- chown $NagiosUser:$NagiosGroup $NagiosCfgtestFile
+ chown -h $NagiosUser:$NagiosGroup $NagiosCfgtestFile
cat "$TMPFILE"
exit 8
fi
@@ -188,7 +194,7 @@ case "$1" in
touch $NagiosVarDir/nagios.log $NagiosRetentionFile
rm -f $NagiosCommandFile
touch $NagiosRunFile
- chown $NagiosUser:$NagiosGroup $NagiosRunFile $NagiosVarDir/nagios.log $NagiosRetentionFile
+ chown -h $NagiosUser:$NagiosGroup $NagiosRunFile $NagiosVarDir/nagios.log $NagiosRetentionFile
$NagiosBin -d $NagiosCfgFile
if [ -d $NagiosLockDir ]; then touch $NagiosLockDir/$NagiosLockFile; fi

0 comments on commit f2ed227

Please sign in to comment.