/usr/bin/yasat is in yasat 526-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 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 | #!/bin/sh
################################################################################
# #
# Copyright (C) 2008-2012 LABBE Corentin <corentin.labbe@geomatys.fr>
#
# 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/>.
# #
################################################################################
umask 027
#test SHELL variable and/or /bin/sh link to "set -o nounset" if we are using bash
#if [ "$SHELL" = '/bin/bash' ] ; then
# set -o nounset
#fi
#TODO use http://wiki.apache.org/httpd/DistrosDefaultLayout for missing
APACHE_CONF_REP="/etc/apache2"
POSSIBLE_APACHE_CONFIG_LOCATION="/etc/apache2/ /etc/apache22/ /etc/apache13/ /etc/apache/ /usr/local/etc/httpd/ /usr/local/etc/apache22/ /usr/apache22/etc/ /usr/local/apache2/conf /etc/httpd/conf/ /etc/httpd/ /usr/pkg/etc/httpd/ /usr/local/etc/apache2/ /var/www/conf/"
POSSIBLE_SNMP_DAEMON_CONFIG_LOCATION="/etc/snmpd /etc/snmp /usr/local/etc/snmpd /usr/local/etc/snmp /usr/local/etc"
POSSIBLE_PHP_CONF_REP="/etc/php.ini /etc/php5/apache2/php.ini /private/etc/php.ini /etc/php/apache2-php5/php.ini /usr/local/etc/php.ini /usr/local/lib/php.ini /var/www/conf/php.ini /etc/php/apache2-php5.3/php.ini"
POSSIBLE_MYSQL_CONF_REP="/etc/mysql/my.cnf /usr/local/etc/mysql/my.cnf"
POSSIBLE_APACHE_BIN="/usr/sbin/apache2 /usr/local/sbin/httpd /usr/local/sbin/apache2 /usr/sbin/httpd"
DEBUG=0
TEMPYASATDIR="`echo ~/.yasat/`"
HTML_OUTPUT=""
ERROR_OUTPUT_FILE="`echo ~/.yasat/yasat.err`"
REPORT_OUTPUT="`echo ~/.yasat/yasat.report`"
CORRECT_FILE="`echo ~/.yasat/yasat_correct.shell`"
ADVICELANG="EN"
PLUGINS_REP="./plugins"
SCANTYPE=""
NOPAUSE='no'
ONEPLUGIN=''
SKIPPED_TESTS=''
#by default common is on the same place that yasat
#but it can be copied to $DESTDIR/$PREFIX/share/yasat/common
YASAT_ROOT='.'
COL_WIDTH=80
#info = 0 green =1 warning,orange=2 red,error =3
PRINT_LEVEL=0
YASAT_VERSION=526
if [ -e '/etc/yasat/yasat.conf' ]
then
. /etc/yasat/yasat.conf
echo 'Found /etc/yasat/yasat.conf'
fi
if [ -e '/usr/local/etc/yasat/yasat.conf' ]
then
. /usr/local/etc/yasat/yasat.conf
echo 'Found /usr/local/etc/yasat/yasat.conf'
fi
if [ -e "$TEMPYASATDIR/yasat.conf" ]
then
. $TEMPYASATDIR/yasat.conf
echo "Found $TEMPYASATDIR/yasat.conf"
fi
if [ -e "$REPORT_OUTPUT" ] ;then
rm $REPORT_OUTPUT
fi
if [ -e "$CORRECT_FILE" ] ;then
rm $CORRECT_FILE
fi
. ${YASAT_ROOT}/common
if [ -z "$1" ]
then
print_help
exit 0;
fi
trap armageddon INT
while [ $# -ge 1 ]; do
case $1 in
--help)
shift
print_help
exit 0;
;;
-h)
shift
print_help
exit 0;
;;
--debug)
shift
DEBUG=1
;;
-d)
shift
DEBUG=1
;;
--full-scan)
shift
SCANTYPE='FULL'
echo "Enabling FULL SCAN"
;;
-f)
shift
SCANTYPE='FULL'
echo "Enabling FULL SCAN"
;;
--nopause)
shift
NOPAUSE='yes'
;;
-a)
shift
NOPAUSE='yes'
;;
-s)
shift
;;
--standard)
shift
;;
-l)
shift
if [ -d "$PLUGINS_REP" ]
then
ls $PLUGINS_REP/ | grep '.test'
exit 0;
fi
;;
--list)
shift
if [ -d "$PLUGINS_REP" ]
then
ls $PLUGINS_REP/ | grep '.test'
exit 0;
fi
;;
--skip)
shift
for TEST in `echo $1 | sed 's/,/\n/g'`;
do
if [ -f "${PLUGINS_REP}/${TEST}.test" ]; then
SKIPPED_TESTS="${SKIPPED_TESTS}${TEST}"
else
echo "Invalid test $TEST"
echo "see $0 --list for all tests"
exit 1
fi
done
shift
;;
--plugin)
shift
if [ -z "$1" ] ;then
echo "Missing parameter for --plugin"
print_help
exit 1;
fi
ONEPLUGIN="$1"
if [ ! -e "$1" ] ; then
if [ ! -e "$PLUGINS_REP/$1" ] ; then
if [ ! -e "$PLUGINS_REP/$1.test" ] ; then
echo "$1 do not exists"
exit 1;
else
ONEPLUGIN="$PLUGINS_REP/$1.test"
fi
else
ONEPLUGIN="$PLUGINS_REP/$1"
fi
fi
shift
;;
-1)
shift
if [ "$1x" = "x" ] ; then
echo "Missing parameter for --plugin"
print_help
exit 1;
fi
ONEPLUGIN="$1"
if [ ! -e "$1" ] ; then
if [ ! -e "$PLUGINS_REP/$1" ] ; then
if [ ! -e "$PLUGINS_REP/$1.test" ] ; then
echo "$1 do not exists"
exit 1;
else
ONEPLUGIN="$PLUGINS_REP/$1.test"
fi
else
ONEPLUGIN="$PLUGINS_REP/$1"
fi
fi
shift
;;
-p)
shift
if [ -z "$1" ] ;then
echo "Missing parameter for --Plugin"
print_help
exit 1;
fi
ONEPLUGIN="$PLUGINS_REP/$1"
if [ ! -e "$ONEPLUGIN" ] ;then
echo "$1 do not exists"
exit 1;
fi
shift
;;
-H)
shift
HTML_OUTPUT="`echo ~/.yasat/yasat.html`"
echo "Enabling output in $HTML_OUTPUT"
;;
--html)
shift
HTML_OUTPUT="`echo ~/.yasat/yasat.html`"
echo "Enabling output in $HTML_OUTPUT"
;;
--html-output )
shift
if [ "$1x" = "x" ]
then
echo "Missing parameter for --html-output"
print_help
exit 1;
fi
HTML_OUTPUT="$1"
shift
echo "HTML output is $HTML_OUTPUT"
echo "" > "$HTML_OUTPUT"
;;
--advice-lang )
shift
if [ "$1x" = "x" ]
then
echo "Missing parameter for --advice-lang"
print_help
exit 1;
fi
ADVICELANG=$1
shift
echo "ADVICELANG is $ADVICELANG"
;;
--print-level)
shift
if [ -z "$1" ]
then
echo 'Missing parameter for --print-level'
print_help
exit 1;
fi
if [ $1 -ge 4 -o $1 -lt 0 ]
then
echo 'The level must be between 0 and 3'
exit 1
fi
PRINT_LEVEL=$1
shift
;;
-P)
shift
if [ -z "$1" ] ;then
echo 'Missing parameter for --plugins-dir'
print_help
exit 1;
fi
if [ ! -e "$1" ] ; then
echo "$1 do not exist"
exit 1
fi
PLUGINS_REP="$1"
shift
echo "PLUGINS_REP is now $PLUGINS_REP"
;;
--plugins-dir)
shift
if [ -z "$1" ] ;then
echo 'Missing parameter for --plugins-dir'
print_help
exit 1;
fi
if [ ! -e "$1" ] ; then
echo "$1 do not exist"
exit 1
fi
PLUGINS_REP="$1"
shift
echo "PLUGINS_REP is now $PLUGINS_REP"
;;
--check-update)
shift
Check_for_update
;;
--send-support)
shift
send_support
;;
--listtest)
shift
list_all_yasat_test
exit 0
;;
*)
echo "unrecognized option $1"
print_help
exit 1
;;
esac
done
mkdir -p ~/.yasat
if [ "`id -u`" = "0" ]
then
Display --indent 2 --text "Using YASAT with UID=0" --result OK --color GREEN
else
Display --indent 2 --text "Using YASAT with UID!=0 Some test mail fail" --result WARNING --color ORANGE
if [ $NOPAUSE = "no" ]
then
echo ""
echo "Press ENTER to continue Ctrl/C to quit"
read void
fi
fi
SELINUX_CONTEXT="`id -Z 2> /dev/null`"
if [ $? -ne 0 ]
then
Display --indent 2 --text "Using YASAT without SELinux" --result OK --color BLUE
else
Display --indent 2 --text "Using YASAT with SELinux context=$SELINUX_CONTEXT" --result OK --color BLUE
fi
. ${YASAT_ROOT}/osdetection
Display --indent 2 --text "Detecting OS... " --result DONE --color GREEN
echo " ${LINUX_VERSION} ${OS} $OS_FULLNAME"
COL_WIDTH="`tput cols`"
if [ ! -z "$COL_WIDTH" ]
then
Display --indent 2 --text "Detecting TERM width... " --result "$COL_WIDTH" --color GREEN
else
Display --indent 2 --text "Detecting TERM width... " --result "ERROR" --color RED
Debug "TODO"
COL_WIDTH=79
fi
print_color_chart
if [ ! -z "$SKIPPED_TESTS" ]; then
echo "Skipped tests"
for TEST in `echo $SKIPPED_TESTS`; do
echo " $TEST"
done
echo ""
fi
if [ ! -z $REPORT_OUTPUT ]
then
echo ""
echo "At the end of the audit, a report would be viewable at $REPORT_OUTPUT"
echo ""
fi
if [ ! -z "$HTML_OUTPUT" ]
then
echo '<html><head><title>YASAT report</title><link href="./yasat.css" rel="stylesheet" type="text/css"></head><body>'> "${HTML_OUTPUT}"
echo "<i>Generated by YASAT $YASAT_VERSION </i>" >> "${HTML_OUTPUT}"
cp "${YASAT_ROOT}/yasat.css" "`dirname ${HTML_OUTPUT}`"
fi
if [ -d "$PLUGINS_REP" ] ; then
LISTE_ADVICE="`ls $PLUGINS_REP/*.advice`"
cat $LISTE_ADVICE | grep $ADVICELANG > ${YASAT_ROOT}/yasat.advices
if [ -z "$ONEPLUGIN" ] ; then
Debug "Analyse de $PLUGINS_REP"
if [ -z "$SKIPPED_TESTS" ] ; then
LISTE_PLUGINS=`ls $PLUGINS_REP/*test`
else
SKIPPED_TESTS=`echo $SKIPPED_TESTS | tr " " "|"`
LISTE_PLUGINS=`ls $PLUGINS_REP/*test | grep -Ev $SKIPPED_TESTS`
fi
for A_PLUGIN in $LISTE_PLUGINS
do
. $A_PLUGIN
# Title "run $0 --plugin $A_PLUGIN to replay this test"
Debug "End of $A_PLUGIN"
if [ "$NOPAUSE" = 'no' ] ; then
echo ""
echo "Press ENTER to continue Ctrl/C to quit"
read void
fi
done
else
. $ONEPLUGIN
fi
fi
if [ ! -z "$HTML_OUTPUT" ]
then
echo '</html>' >> "$HTML_OUTPUT"
fi
|