/usr/share/yasat/plugins/php_conf.test is in yasat 755-1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 | #!/bin/sh
################################################################################
# #
# Copyright (C) 2008-2014 LABBE Corentin <clabbe.montjoie@gmail.com>
#
# YASAT 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 3 of the License, or
# (at your option) any later version.
#
# YASAT 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.
#
# You should have received a copy of the GNU General Public License
# along with YASAT. If not, see <http://www.gnu.org/licenses/>.
# #
################################################################################
Title "Check PHP configuration"
PHP_CONF_REP=''
for LOCATION in ${POSSIBLE_PHP_CONF_REP}
do
if [ -e "${LOCATION}" ] ; then
PHP_CONF_REP="`dirname ${LOCATION}`"
fi
done
if [ ! -e "${PHP_CONF_REP}/php.ini" ] ; then
Debug "No $PHP_CONF_REP/php.ini FOUND"
return 1;
fi
if [ -e "${PLUGINS_REP}/php_conf.data" ] ; then
for i in `grep -v '^\#' $PLUGINS_REP/php_conf.data`
do
ldirective=`echo $i | cut -f1 -d\|`
lparam=`echo $i | cut -f2 -d\|`
loption=`echo $i | cut -f3 -d\|`
ltestoptional=`echo $i | cut -f4 -d\|`
OPT_ADVICE=''
OPT_ADVICE="`echo $i | cut -f5 -d\|`"
if [ -z $OPT_ADVICE ] ; then
OPT_ADVICE='NONE'
fi
Debug "check for $ldirective"
FindValueOfEqual $PHP_CONF_REP/php.ini $ldirective JUSTTEST
VAL="$RESULTAT"
if [ -z "$RESULTAT" ] ; then
loption='NODEF'
fi
case $loption in
S)#string equal
if [ "$VAL" != "$lparam" ] ;then
#affiche_rouge "$ldirective pas a $lparam"
Display --indent 2 --text "$ldirective ( want $lparam )" --result "$VAL" --color RED --advice $OPT_ADVICE
else
#affiche_vert "GOOD"
Display --indent 2 --text "$ldirective " --result "$VAL" --color GREEN
fi
;;
s)#string equal casse insensitive
VAL=`echo $RESULTAT | tr A-Z a-z`
if [ "$VAL" != "$lparam" ] ;then
Display --indent 2 --text "$ldirective ( want $lparam )" --result "$VAL" --color RED --advice $OPT_ADVICE
else
Display --indent 2 --text "$ldirective " --result "$VAL" --color GREEN
fi
;;
snot)#not string casse insensitive
VAL=`echo $RESULTAT | tr A-Z a-z`
if [ "$VAL" = "$lparam" ] ;then
Display --indent 2 --text "$ldirective ( dont want $lparam )" --result "$VAL" --color RED --advice $OPT_ADVICE
else
Display --indent 2 --text "$ldirective " --result "$VAL" --color GREEN
fi
;;
NM)#Numeric max
## FindValueOf $PHP_CONF_REP/php.ini $ldirective
if [ -z "$RESULTAT" ] ; then
Display --indent 2 --text "Missing declaration of $ldirective " --result WARNING --color RED --advice $OPT_ADVICE
else
if [ "$RESULTAT" -ge $lparam ] ;then
Display --indent 2 --text "$ldirective < $lparam" --result "$VAL" --color RED --advice $OPT_ADVICE
else
Display --indent 2 --text "$ldirective " --result "$VAL" --color GREEN
fi
fi
;;
C)#contains
if [ -z "$RESULTAT" ] ; then
Display --indent 2 --text "Missing declaration of $ldirective " --result WARNING --color RED --advice $OPT_ADVICE
else
#this is ugly but it works
RESULTAT="beginline, $RESULTAT, endline"
if [ -z "`echo $RESULTAT |grep [,[:space:]]$lparam[,[:space:]]`" ] ;then
Display --indent 2 --text "$ldirective without $lparam" --result NOTFOUND --color RED --advice $OPT_ADVICE
else
Display --indent 2 --text "$ldirective " --result "$lparam" --color GREEN
fi
fi
;;
NODEF)
Display --indent 2 --text "No declaration of $ldirective (want $lparam)" --result WARNING --color RED --advice $OPT_ADVICE
;;
*)
Display --indent 2 --text "Unknown option $loption" --result ERROR --color RED
;;
esac
done
FindValueOfEqual $PHP_CONF_REP/php.ini 'error_log' JUSTTEST
if [ -z "$RESULTAT" ] ; then
Display --indent 2 --text "Missing declaration de error_log " --result WARNING --color RED
else
REPLOG="`dirname $RESULTAT`"
Display --indent 2 --text "error_log $RESULTAT" --result DEFINED --color GREEN
if [ -e "$REPLOG" ] ; then
Find_apache_conf_location
if [ "$APACHE_CONF_REP" = 'NOTFOUND' ];then
prepare_apache_conf $APACHE_CONF_REP
APACHE_CONF_LOCATION_TO_TEST="${TEMPYASATDIR}/apache.conf"
if [ ! -e "$APACHE_CONF_LOCATION_TO_TEST" ] ; then
echo "Error no $APACHE_CONF_LOCATION_TO_TEST"
return 1;
fi
FindValueOf "$APACHE_CONF_LOCATION_TO_TEST" "User"
else
RESULTAT='root'
fi
Display --indent 4 --text "$REPLOG " --result FOUND --color GREEN
#check rights of apache on $REPLOG
if [ `stat $STAT_GROUP $REPLOG` = $RESULTAT ] ; then
Display --indent 6 --text "rights of $REPLOG " --result "$RESULTAT" --color GREEN
else
Display --indent 6 --text "rights of $REPLOG " --result WARNING --color RED
fi
else
Display --indent 4 --text "$REPLOG " --result NOTFOUND --color RED
fi
fi
#TODO error_reporting must be set to ??
else
Display --indent 2 --text "ERROR No php_conf.data" --result ERROR --color RED --advice YASAT_BUG
fi
return 0;
|