From: Miroslav V. <mva...@re...> - 2011-11-28 08:27:29
|
Hi Linda and Jim, ----- Original Message ----- > Hi Miroslav, > > Thanks very much. I was thinking of doing the same thing > but you beat me to it. > > One thing I was considering was moving the ltp directory up > one level and adding a makefile there that would run the ltp and > the audit tests. That's essentially how we had things in our > previous evaluation. The top level makefile also had a make > target to generate a report of all the test results. I will add the top level Makefile as it was previously and move ltp one folder higher. > > Since the bulk of our development is on the audit tests, I'd > like to be able to run them from the top of the audit directory > without running the ltp tests, which to me are just a sanity test > that happens to take a long time to run. :-) Yeap I agree. By the way These are the latest results for the LTP tests: TESTS PASSED = 1926 FAILED = 13 Failed tests: ------------- syscalls.rollup.log:access01 FAIL 1 syscalls.rollup.log:access02 FAIL 1 syscalls.rollup.log:execve03 FAIL 1 syscalls.rollup.log:mmap03 FAIL 1 syscalls.rollup.log:mmap04 FAIL 1 syscalls.rollup.log:sched_getaffinity01 FAIL 1 syscalls.rollup.log:utimensat01 FAIL 255 syscalls.rollup.log:access01 FAIL 1 syscalls.rollup.log:access02 FAIL 1 syscalls.rollup.log:execve03 FAIL 1 syscalls.rollup.log:mmap03 FAIL 1 syscalls.rollup.log:mmap04 FAIL 1 syscalls.rollup.log:utimensat01 FAIL 255 James any ideas why are these failing (I'm attaching the run.log also) Regards, /M > > -- ljk > > Miroslav Vadkerti wrote: > > Hi Linda and James, > > > > I added the makefile for LTP tests and should fully > > automatize their running. I also enabled the test > > in the root Makefile. I hope this is ok, though > > I welcome any comments you may have. Sorry for > > the one patch only. > > > > I'm thinking pulling this in right away as I tested > > it quite thoroughly, we patch later if needed. > > > > Thanks and regards, > > /M > > > > ----- Original Message ----- > >> From: Miroslav Vadkerti <mva...@re...> > >> > >> The chosen LTP tests will now run by default during the > >> audit-test suite run. > >> > >> The LTP test suite is build and installed during the make > >> process and run during the make run process. > >> > >> The logs generated are compatible with audit-test log > >> harvesting and should appear in audit.run.log and > >> audit.rollup.log. > >> > >> Signed-off-by: Miroslav Vadkerti <mva...@re...> > >> --- > >> audit/Makefile | 9 +- > >> audit/README.ltp | 24 ++++++ > >> audit/ltp/Makefile | 103 +++++++++++++++++++++++ > >> audit/ltp/README_ltp | 65 --------------- > >> audit/ltp/cc_commands | 5 - > >> audit/ltp/cc_ospp.sh | 168 > >> ------------------------------------- > >> audit/ltp/patch/cc_commands | 5 + > >> audit/ltp/patch/cc_ospp.sh | 168 > >> +++++++++++++++++++++++++++++++++++++ > >> audit/ltp/patch/ssh03 | 91 ++++++++++++++++++++ > >> audit/ltp/patch/su01 | 193 > >> +++++++++++++++++++++++++++++++++++++++++++ > >> audit/ltp/ssh03 | 91 -------------------- > >> audit/ltp/su01 | 193 > >> ------------------------------------------- > >> 12 files changed, 589 insertions(+), 526 deletions(-) > >> create mode 100644 audit/README.ltp > >> create mode 100644 audit/ltp/Makefile > >> delete mode 100644 audit/ltp/README_ltp > >> delete mode 100644 audit/ltp/cc_commands > >> delete mode 100755 audit/ltp/cc_ospp.sh > >> create mode 100644 audit/ltp/patch/cc_commands > >> create mode 100755 audit/ltp/patch/cc_ospp.sh > >> create mode 100755 audit/ltp/patch/ssh03 > >> create mode 100755 audit/ltp/patch/su01 > >> delete mode 100755 audit/ltp/ssh03 > >> delete mode 100755 audit/ltp/su01 > >> > >> diff --git a/audit/Makefile b/audit/Makefile > >> index 54eba00..693fdb9 100644 > >> --- a/audit/Makefile > >> +++ b/audit/Makefile > >> @@ -5,12 +5,12 @@ > >> # This program is free software: you can redistribute it and/or > >> modify > >> # it under the terms of version 2 the GNU General Public > >> License > >> as > >> # published by the Free Software Foundation. > >> -# > >> +# > >> # This program 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 this program. If not, see > >> <http://www.gnu.org/licenses/>. > >> ############################################################################### > >> @@ -36,14 +36,15 @@ RUN_DIRS += trustedprograms \ > >> kvm-cgroups \ > >> kvm-iommu \ > >> audit-remote \ > >> - misc > >> + misc \ > >> + ltp > >> endif > >> endif > >> > >> SUB_DIRS = $(RUN_DIRS) \ > >> utils > >> > >> -run: > >> +run: > >> @for l in run rollup; do \ > >> echo "audit.$$l.log will be collected from subdirectories > >> when > >> the test completes" >audit.$$l.log; \ > >> done > >> diff --git a/audit/README.ltp b/audit/README.ltp > >> new file mode 100644 > >> index 0000000..62b87bb > >> --- /dev/null > >> +++ b/audit/README.ltp > >> @@ -0,0 +1,24 @@ > >> +| Running LTP tests for RHEL6.2 certification > >> ++--------------------------------------------- > >> + > >> +Requirements > >> +------------ > >> +Be sure to have properly configured system according to > >> README.run > >> +file. > >> + > >> +Running > >> +------- > >> +Running required LTP tests is fully automatized and they are run > >> as > >> +part of the audit-test test suite. > >> + > >> +The LTP suite is built and installed during the make phase. The > >> tests > >> +are executed during the make run phase. > >> + > >> +Logs from the runs are harvested and will be available in the > >> +audit.run.log and audit.rollup.log files. > >> + > >> +To run only the LTP tests use the commands below. These expect > >> you > >> +already did run make in the audit-test root directory > >> + > >> +# cd ltp > >> +# make run > >> diff --git a/audit/ltp/Makefile b/audit/ltp/Makefile > >> new file mode 100644 > >> index 0000000..d055d0e > >> --- /dev/null > >> +++ b/audit/ltp/Makefile > >> @@ -0,0 +1,103 @@ > >> +########################################################################## > >> +# Copyright (c) 2011 Red Hat, Inc. All rights reserved. > >> +# > >> +# This program is free software: you can redistribute it and/or > >> modify > >> +# it under the terms of version 2 the GNU General Public > >> License > >> as > >> +# published by the Free Software Foundation. > >> +# > >> +# This program 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 this program. If not, see > >> <http://www.gnu.org/licenses/>. > >> +# > >> +# > >> +# > >> +# FILE : Makefile > >> +# > >> +# PURPOSE: Downloads and runs syscalls and cc_ospp tests from > >> LTP > >> suite > >> +# > >> +# REQUIRENTS: Exported RHOST and PASSWD env variables > >> +# > >> +# HISTORY: > >> +# 11/11 originated by Miroslav Vadkerti <mva...@re...> > >> +# > >> +########################################################################## > >> + > >> +RUN_LOG = run.log > >> +ROLLUP_LOG = rollup.log > >> + > >> +LTP_BASE = ltp-full > >> +LTP_BASE_PATH = $(CURDIR)/$(LTP_BASE) > >> +PATCH_DIR = $(CURDIR)/patch > >> +MDIR = $(CURDIR) > >> + > >> +LTP_ROLLUP_LOG = .rollup.log > >> +LTP_RUN_LOG = .run.log > >> + > >> +LTP_FULL = ltp-full.tar.bz2 > >> + > >> +all:: download extract patch build > >> + > >> +run:: runtests report > >> + > >> +build:: > >> + echo "Makefile: build" > >> + export TOP_SRCDIR=$(LTP_BASE_PATH) > >> + @$(MAKE) -C $(LTP_BASE_PATH) autotools > >> + cd $(LTP_BASE_PATH) && ./configure && cd - > >> + @$(MAKE) -C $(LTP_BASE_PATH) all > >> + @$(MAKE) -C $(LTP_BASE_PATH) install > >> + > >> +extract:: > >> + echo "Makefile: extract" > >> + tar xvf $(LTP_FULL) > >> + mv -f ltp-full-* $(LTP_BASE) > >> + > >> +patch:: > >> + echo "Makefile: patch" > >> + cp -fv $(PATCH_DIR)/cc_commands > >> $(LTP_BASE_PATH)/runtest/cc_commands > >> + cp -fv $(PATCH_DIR)/cc_ospp.sh > >> $(LTP_BASE_PATH)/testscripts/cc_ospp.sh > >> + cp -fv $(PATCH_DIR)/ssh03 > >> $(LTP_BASE_PATH)/testcases/network/tcp_cmds/ssh/ssh03 > >> + cp -fv $(PATCH_DIR)/su01 > >> $(LTP_BASE_PATH)/testcases/commands/su/su01 > >> + > >> +clean:: > >> + echo "Makefile: clean" > >> + # remove installed ltp > >> + rm -rf /opt/ltp > >> + # remove all logs, downloaded and created files/dirs > >> + rm -f cc_ospp$(LTP_ROLLUP_LOG) cc_ospp$(LTP_RUN_LOG) > >> + rm -f syscalls$(LTP_ROLLUP_LOG) syscalls$(LTP_RUN_LOG) > >> + rm -f $(LTP_FULL) $(RUN_LOG) $(ROLLUP_LOG) > >> + rm -rf $(LTP_BASE) > >> + > >> +download:: > >> + echo "Makefile: download" > >> + # download latest LTP source > >> + wget -O $(LTP_FULL) > >> http://sourceforge.net/projects/ltp/files/latest/download > >> + > >> +runtests:: > >> + echo "Makefile: runtests" > >> + # needed for sendfile tests > >> + setsebool allow_execmem=on > >> + # run tests > >> + echo "Running syscalls tests" > >> + /opt/ltp/testscripts/syscalls.sh -p -l > >> $(MDIR)/syscalls$(LTP_ROLLUP_LOG) 2>&1 | tee > >> syscalls$(LTP_RUN_LOG) > >> + echo "Running cc_ospp tests" > >> + /opt/ltp/testscripts/cc_ospp.sh -p -l > >> $(MDIR)/cc_ospp$(LTP_ROLLUP_LOG) 2>&1 | tee cc_ospp$(LTP_RUN_LOG) > >> + > >> +report:: > >> + echo "Makefile: report" > >> + # create rollup.log > >> + echo "TESTS PASSED = "$$(grep PASS cc_ospp$(LTP_ROLLUP_LOG) > >> syscalls$(LTP_ROLLUP_LOG) 2>&1 | wc -l) > $(ROLLUP_LOG) > >> + echo " FAILED =" $$(grep FAIL cc_ospp$(LTP_ROLLUP_LOG) > >> syscalls$(LTP_ROLLUP_LOG) 2>&1 | wc -l) >> $(ROLLUP_LOG) > >> + echo >> $(ROLLUP_LOG) > >> + if [ "x$$(grep FAIL cc_ospp$(LTP_ROLLUP_LOG) > >> syscalls$(LTP_ROLLUP_LOG) 2>&1 | wc -l)" != "x0" ]; then \ > >> + echo "Failed tests:" >> $(ROLLUP_LOG); \ > >> + echo "-------------" >> $(ROLLUP_LOG); \ > >> + grep -H "\WFAIL\W" cc_ospp$(LTP_ROLLUP_LOG) > >> syscalls$(LTP_ROLLUP_LOG) >> $(ROLLUP_LOG); \ > >> + fi > >> + # create run.log > >> + cat cc_ospp$(LTP_RUN_LOG) syscalls$(LTP_RUN_LOG) > $(RUN_LOG) > >> diff --git a/audit/ltp/README_ltp b/audit/ltp/README_ltp > >> deleted file mode 100644 > >> index 47cc1f3..0000000 > >> --- a/audit/ltp/README_ltp > >> +++ /dev/null > >> @@ -1,65 +0,0 @@ > >> -Running LTP syscalls and tcp_cmds for RHEL6.2 certification > >> - > >> - > >> - > >> -get ltp git tree from > >> git://ltp.git.sourceforge.net/gitroot/ltp/ltp > >> -In your local git tree add/replace the following files from the > >> audit-test suite > >> -directory "ltp" to the designated locations as shown below. > >> - > >> -cc_ospp.sh -> ltp/testscripts/cc_ospp.sh > >> -cc_commands -> ltp/runtest/cc_commands > >> -ssh03 -> ltp/testcases/network/tcp_cmds/ssh/ssh03 > >> -su01 -> ltp/testcases/commands/su/su01 > >> - > >> -create tarball of the ltp tree > >> -cd to git path > >> -tar -cvzf <tarball name> . > >> - > >> - > >> -Unpack tarball on TOE > >> -cd to chosen path (usr/local/eal4_testing/ltp) > >> -tar -xvzf <tarball name> > >> - > >> -# > >> -#export TOP_SRCDIR so it points to where ltp tarball is unpacked > >> -#for example (export TOP_SRCDIR=/usr/local/eal4_testing/ltp) > >> - > >> -(building in same directory - simpliest?) > >> - > >> -cd $TOP_SRCDIR > >> -make autotools > >> -./configure > >> -make all > >> -make install > >> - > >> -(did not need to create nobody, bin, daemon already there) > >> - > >> -You should set the boolean allow_execmem to "on" so that one of > >> the > >> sendfile tests > >> -will pass > >> - > >> -setsebool allow_execmem=on > >> - > >> --------- > >> -to run the syscalls: > >> -cd /opt/ltp/testscripts > >> -syscalls.sh > >> - > >> -results of the syscall tests will be located in /opt/ltp/results > >> -directory > >> - > >> -to run the tcp_cmds required for the RHEL6.2 CC certification > >> -cc_ospp.sh > >> - > >> -In order to obtain a human readable log the command should > >> include > >> the > >> --l and -p otion for example "cc_ospp.sh -l result1 -p" > >> -This will cause a result file named result1 to be created in > >> -the /opt/ltp/testscripts/results directory > >> - > >> - > >> -note, fork13 takes a long time to run. > >> - > >> -As of Oct 06 2011 tests were all passing on RHEL6.2 beta in mls > >> mode > >> -(cc-eal4-config-rhel62-0.14-noarch.rpm) > >> - > >> -These tests were built and run as root in the lspp_test_r role > >> -on the mls intel based platform > >> diff --git a/audit/ltp/cc_commands b/audit/ltp/cc_commands > >> deleted file mode 100644 > >> index 2ba85c7..0000000 > >> --- a/audit/ltp/cc_commands > >> +++ /dev/null > >> @@ -1,5 +0,0 @@ > >> -ping export LTPROOT; ping01 > >> -ssh01 ssh01 > >> -ssh02 ssh02 > >> -ssh03 ssh03 > >> -su01 export TCbin=$LTPROOT/../testcases/bin;su01 > >> diff --git a/audit/ltp/cc_ospp.sh b/audit/ltp/cc_ospp.sh > >> deleted file mode 100755 > >> index c3c0738..0000000 > >> --- a/audit/ltp/cc_ospp.sh > >> +++ /dev/null > >> @@ -1,168 +0,0 @@ > >> -#!/bin/sh > >> - > >> - > >> -# > >> -# 08/17/11 - Jim Czyzak - This script is based upon > >> runEALtests.sh script. > >> -# It has been modified to use the > >> command > >> file > >> -# cc_commands and only include > >> arguments > >> that might > >> -# be useful for the common criteria > >> testing against > >> -# the ospp in conjunction with the > >> audit-test suite. > >> -# Also includes code to turn off > >> screen > >> in > >> -# /etc/profile for the test run as > >> screen > >> interferes > >> -# with the su tests (screen is turned > >> on > >> in the > >> -# in some evaluated configurations for > >> purposes of > >> -# securing display devices) > >> - > >> -cd `dirname $0` > >> -export LTPROOT=${PWD} > >> -export TMPBASE="/tmp" > >> -export TMP="${TMPBASE}/runalltests-$$" > >> -export PATH="${PATH}:${LTPROOT}/../testcases/bin" > >> -cmdfile="${LTPROOT}/../runtest/cc_commands" > >> -pretty_prt=" " > >> -alt_dir=0 > >> -quiet_mode=" " > >> - > >> -usage() > >> -{ > >> - cat <<-END >&2 > >> - usage: ./${0##*/} -c [-d tmpdir] [-f cmdfile ] [ -l logfile ] > >> - -q [ -r ltproot ] [ -t duration ] [ -x > >> instances ] > >> - > >> - -c Run LTP under additional background CPU load. > >> - -d tmpdir Directory where temporary files will be > >> created. > >> - -f cmdfile Execute user defined list of testcases. > >> - -h Help. Prints all available options. > >> - -l logfile Log results of test in a logfile. > >> - -p Human readable format logfiles. > >> - -q Print less verbose output to screen. > >> - -r ltproot Fully qualified path where testsuite is > >> installed. > >> - -t duration Execute the testsuite for given duration in > >> hours. > >> - -x instances Run multiple instances of this testsuite. > >> - > >> - example: ./${0##*/} -i 1024 -m 128 -p -q -l > >> /tmp/resultlog.$$ > >> -d ${PWD} > >> - END > >> -exit > >> -} > >> - > >> -mkdir -p ${TMP} > >> - > >> -cd ${TMP} > >> -if [ $? -ne 0 ]; then > >> - echo "could not cd ${TMP} ... exiting" > >> - exit > >> -fi > >> - > >> -while getopts cd:f:h:l:pqr:t:x arg > >> -do case $arg in > >> - c) > >> - $LTPROOT/../testcases/bin/genload --cpu 1 2>&1 > >> 1>/dev/null & > >> - GenLoad=1 ;; > >> - > >> - d) # append $$ to TMP, as it is recursively > >> - # removed at end of script. > >> - TMPBASE=$OPTARG;; > >> - f) # Execute user defined set of testcases. > >> - cmdfile=$OPTARG;; > >> - > >> - h) usage;; > >> - > >> - l) > >> - if [ ${OPTARG:0:1} != "/" ] > >> - then > >> - if [ -d $LTPROOT/results ] > >> - then > >> - logfile="-l > >> $LTPROOT/results/$OPTARG" > >> - else > >> - mkdir -p $LTPROOT/results > >> - if [ $? -ne 0 ] > >> - then > >> - echo "ERROR: > >> failed > >> to create $LTPROOT/results" > >> - exit 1 > >> - fi > >> - logfile="-l > >> $LTPROOT/results/$OPTARG" > >> - fi > >> - alt_dir=1 > >> - else > >> - logfile="-l $OPTARG" > >> - fi ;; > >> - > >> - p) pretty_prt=" -p ";; > >> - > >> - q) quiet_mode=" -q ";; > >> - > >> - r) LTPROOT=$OPTARG;; > >> - > >> - t) # In case you want to specify the time > >> - # to run from the command line > >> - # (2m = two minutes, 2h = two hours, etc) > >> - duration="-t $OPTARG" ;; > >> - > >> - x) # number of ltp's to run > >> - instances="-x $OPTARG";; > >> - > >> - \?) usage;; > >> - esac > >> -done > >> - > >> -if [ -z $PASSWD ] > >> -then > >> - echo " " > >> - echo "ERROR:" > >> - echo "Please export enviroment variable PASSWD" > >> - echo "INFO: export PASSWD = 'root's password'" > >> - exit 1 > >> -fi > >> - > >> -if [ -n "$instances" ]; then > >> - instances="$instances -O ${TMP}" > >> -fi > >> - > >> - > >> -# If user does not provide a command file select a default set of > >> testcases > >> -# to execute. > >> -if [ -z $cmdfile ] > >> -then > >> - cat ${LTPROOT}/../runtest/admin_tools > ${TMP}/alltests > >> -else > >> - cat $cmdfile > ${TMP}/alltests > >> -fi > >> - > >> -# The fsx-linux tests use the SCRATCHDEV environment variable as > >> a > >> location > >> -# that can be reformatted and run on. Set SCRATCHDEV if you want > >> to > >> run > >> -# these tests. As a safeguard, this is disabled. > >> -unset SCRATCHDEV > >> -if [ -n "$SCRATCHDEV" ]; then > >> - cat ${LTPROOT}/../runtest/fsx >> ${TMP}/alltests > >> -fi > >> - > >> -# turn off screen in /etc/profile > >> -tmpbkup=$(mktemp "/etc/profile.XXXXXX") || exit 1 > >> -cp -a /etc/profile $tmpbkup || exit 1 > >> -sed -i 's/\[ -w $(tty) \]/false/' /etc/profile > >> - > >> -# display versions of installed software > >> -${LTPROOT}/../ver_linux > >> - > >> -${LTPROOT}/../bin/ltp-pan $quiet_mode -e -S $instances $duration > >> -a > >> $$ -n $$ $pretty_prt -f ${TMP}/alltests $logfile > >> - > >> -if [ $? -eq 0 ]; then > >> - echo ltp-pan reported PASS > >> -else > >> - echo ltp-pan reported FAIL > >> -fi > >> - > >> -if [ $alt_dir -eq 1 ] > >> -then > >> - echo " " > >> - echo > >> "###############################################################" > >> - echo " " > >> - echo " result log is in the $LTPROOT/results directory" > >> - echo " " > >> - echo > >> "###############################################################" > >> - echo " " > >> -fi > >> -# restore /etc/profile > >> -mv -f $tmpbkup /etc/profile > >> - > >> -rm -rf ${TMP} > >> diff --git a/audit/ltp/patch/cc_commands > >> b/audit/ltp/patch/cc_commands > >> new file mode 100644 > >> index 0000000..2ba85c7 > >> --- /dev/null > >> +++ b/audit/ltp/patch/cc_commands > >> @@ -0,0 +1,5 @@ > >> +ping export LTPROOT; ping01 > >> +ssh01 ssh01 > >> +ssh02 ssh02 > >> +ssh03 ssh03 > >> +su01 export TCbin=$LTPROOT/../testcases/bin;su01 > >> diff --git a/audit/ltp/patch/cc_ospp.sh > >> b/audit/ltp/patch/cc_ospp.sh > >> new file mode 100755 > >> index 0000000..c3c0738 > >> --- /dev/null > >> +++ b/audit/ltp/patch/cc_ospp.sh > >> @@ -0,0 +1,168 @@ > >> +#!/bin/sh > >> + > >> + > >> +# > >> +# 08/17/11 - Jim Czyzak - This script is based upon > >> runEALtests.sh script. > >> +# It has been modified to use the > >> command > >> file > >> +# cc_commands and only include > >> arguments > >> that might > >> +# be useful for the common criteria > >> testing against > >> +# the ospp in conjunction with the > >> audit-test suite. > >> +# Also includes code to turn off > >> screen > >> in > >> +# /etc/profile for the test run as > >> screen > >> interferes > >> +# with the su tests (screen is turned > >> on > >> in the > >> +# in some evaluated configurations for > >> purposes of > >> +# securing display devices) > >> + > >> +cd `dirname $0` > >> +export LTPROOT=${PWD} > >> +export TMPBASE="/tmp" > >> +export TMP="${TMPBASE}/runalltests-$$" > >> +export PATH="${PATH}:${LTPROOT}/../testcases/bin" > >> +cmdfile="${LTPROOT}/../runtest/cc_commands" > >> +pretty_prt=" " > >> +alt_dir=0 > >> +quiet_mode=" " > >> + > >> +usage() > >> +{ > >> + cat <<-END >&2 > >> + usage: ./${0##*/} -c [-d tmpdir] [-f cmdfile ] [ -l logfile ] > >> + -q [ -r ltproot ] [ -t duration ] [ -x > >> instances ] > >> + > >> + -c Run LTP under additional background CPU load. > >> + -d tmpdir Directory where temporary files will be > >> created. > >> + -f cmdfile Execute user defined list of testcases. > >> + -h Help. Prints all available options. > >> + -l logfile Log results of test in a logfile. > >> + -p Human readable format logfiles. > >> + -q Print less verbose output to screen. > >> + -r ltproot Fully qualified path where testsuite is > >> installed. > >> + -t duration Execute the testsuite for given duration in > >> hours. > >> + -x instances Run multiple instances of this testsuite. > >> + > >> + example: ./${0##*/} -i 1024 -m 128 -p -q -l > >> /tmp/resultlog.$$ > >> -d ${PWD} > >> + END > >> +exit > >> +} > >> + > >> +mkdir -p ${TMP} > >> + > >> +cd ${TMP} > >> +if [ $? -ne 0 ]; then > >> + echo "could not cd ${TMP} ... exiting" > >> + exit > >> +fi > >> + > >> +while getopts cd:f:h:l:pqr:t:x arg > >> +do case $arg in > >> + c) > >> + $LTPROOT/../testcases/bin/genload --cpu 1 2>&1 > >> 1>/dev/null & > >> + GenLoad=1 ;; > >> + > >> + d) # append $$ to TMP, as it is recursively > >> + # removed at end of script. > >> + TMPBASE=$OPTARG;; > >> + f) # Execute user defined set of testcases. > >> + cmdfile=$OPTARG;; > >> + > >> + h) usage;; > >> + > >> + l) > >> + if [ ${OPTARG:0:1} != "/" ] > >> + then > >> + if [ -d $LTPROOT/results ] > >> + then > >> + logfile="-l > >> $LTPROOT/results/$OPTARG" > >> + else > >> + mkdir -p $LTPROOT/results > >> + if [ $? -ne 0 ] > >> + then > >> + echo "ERROR: > >> failed > >> to create $LTPROOT/results" > >> + exit 1 > >> + fi > >> + logfile="-l > >> $LTPROOT/results/$OPTARG" > >> + fi > >> + alt_dir=1 > >> + else > >> + logfile="-l $OPTARG" > >> + fi ;; > >> + > >> + p) pretty_prt=" -p ";; > >> + > >> + q) quiet_mode=" -q ";; > >> + > >> + r) LTPROOT=$OPTARG;; > >> + > >> + t) # In case you want to specify the time > >> + # to run from the command line > >> + # (2m = two minutes, 2h = two hours, etc) > >> + duration="-t $OPTARG" ;; > >> + > >> + x) # number of ltp's to run > >> + instances="-x $OPTARG";; > >> + > >> + \?) usage;; > >> + esac > >> +done > >> + > >> +if [ -z $PASSWD ] > >> +then > >> + echo " " > >> + echo "ERROR:" > >> + echo "Please export enviroment variable PASSWD" > >> + echo "INFO: export PASSWD = 'root's password'" > >> + exit 1 > >> +fi > >> + > >> +if [ -n "$instances" ]; then > >> + instances="$instances -O ${TMP}" > >> +fi > >> + > >> + > >> +# If user does not provide a command file select a default set of > >> testcases > >> +# to execute. > >> +if [ -z $cmdfile ] > >> +then > >> + cat ${LTPROOT}/../runtest/admin_tools > ${TMP}/alltests > >> +else > >> + cat $cmdfile > ${TMP}/alltests > >> +fi > >> + > >> +# The fsx-linux tests use the SCRATCHDEV environment variable as > >> a > >> location > >> +# that can be reformatted and run on. Set SCRATCHDEV if you want > >> to > >> run > >> +# these tests. As a safeguard, this is disabled. > >> +unset SCRATCHDEV > >> +if [ -n "$SCRATCHDEV" ]; then > >> + cat ${LTPROOT}/../runtest/fsx >> ${TMP}/alltests > >> +fi > >> + > >> +# turn off screen in /etc/profile > >> +tmpbkup=$(mktemp "/etc/profile.XXXXXX") || exit 1 > >> +cp -a /etc/profile $tmpbkup || exit 1 > >> +sed -i 's/\[ -w $(tty) \]/false/' /etc/profile > >> + > >> +# display versions of installed software > >> +${LTPROOT}/../ver_linux > >> + > >> +${LTPROOT}/../bin/ltp-pan $quiet_mode -e -S $instances $duration > >> -a > >> $$ -n $$ $pretty_prt -f ${TMP}/alltests $logfile > >> + > >> +if [ $? -eq 0 ]; then > >> + echo ltp-pan reported PASS > >> +else > >> + echo ltp-pan reported FAIL > >> +fi > >> + > >> +if [ $alt_dir -eq 1 ] > >> +then > >> + echo " " > >> + echo > >> "###############################################################" > >> + echo " " > >> + echo " result log is in the $LTPROOT/results directory" > >> + echo " " > >> + echo > >> "###############################################################" > >> + echo " " > >> +fi > >> +# restore /etc/profile > >> +mv -f $tmpbkup /etc/profile > >> + > >> +rm -rf ${TMP} > >> diff --git a/audit/ltp/patch/ssh03 b/audit/ltp/patch/ssh03 > >> new file mode 100755 > >> index 0000000..30caaba > >> --- /dev/null > >> +++ b/audit/ltp/patch/ssh03 > >> @@ -0,0 +1,91 @@ > >> +#!/bin/sh > >> +#********************************************************************* > >> +# Copyright (c) International Business Machines Corp., 2000 > >> +# > >> +# This program 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 2 of the > >> License, > >> or > >> +# (at your option) any later version. > >> +# > >> +# This program 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 this program; if not, write to the Free Software > >> +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA > >> 02111-1307 USA > >> +# > >> +# FILE : ssh > >> +# > >> +# PURPOSE: Tests to see that ssh allows a valid username > >> (non-root) > >> +# > >> +# SETUP: The program `/usr/bin/expect' MUST be installed. > >> +# > >> +# HISTORY: > >> +# 03/03 Jerone Young (je...@us...) > >> +# > >> + > >> +#----------------------------------------------------------------------- > >> +# FUNCTION: do_setup > >> +#----------------------------------------------------------------------- > >> + > >> +do_setup() > >> +{ > >> + export RHOST="localhost" > >> + export TEST_USER="ssh_usr3" > >> + export TEST_USER_PASSWD="eal" > >> + export TEST_USER_ENCRYPTED_PASSWD="42VmxaOByKwlA" > >> + export TEST_USER_HOMEDIR="/home/$TEST_USER" > >> + > >> + # erase user if he/she already exists, so we can have a clean > >> env > >> + > >> + rm -Rf /home/$TEST_USER > >> + tst_setup > >> + > >> + exists expect ssh ssh03_s1 useradd userdel > >> + > >> + userdel $TEST_USER > >> + sleep 1 > >> + > >> + if ! useradd -m -p $TEST_USER_ENCRYPTED_PASSWD $TEST_USER; > >> then > >> + end_testcase "Could not add test user $TEST_USER to > >> system > >> $RHOST." > >> + fi > >> + > >> + # create users home diretory (SLES 8 does not do this, even > >> when > >> specified > >> + # in adduser) > >> + USER_UID=$(id -u $TEST_USER) > >> + USER_GID=$(id -g $TEST_USER) > >> + if ! mkdir -p "$TEST_USER_HOMEDIR"; then > >> + end_testcase "Failed to create $TEST_USER_HOMEDIR" > >> + fi > >> + chown -R $USER_UID.$USER_GID "$TEST_USER_HOMEDIR" > >> + > >> + trap do_cleanup EXIT > >> + > >> +} > >> + > >> +#----------------------------------------------------------------------- > >> +# FUNCTION: do_cleanup > >> +#----------------------------------------------------------------------- > >> + > >> +do_cleanup() > >> +{ > >> + userdel $TEST_USER > >> + tst_cleanup > >> +} > >> + > >> +#----------------------------------------------------------------------- > >> +# FUNCTION: MAIN > >> +# > >> +# DESCRIPTION: Create Test User > >> +# Call upon script to make sure an invalid user can > >> not > >> have access > >> +# Cleanup Test User from system > >> +# Exit with exit code of script called upon > >> +#----------------------------------------------------------------------- > >> +. net_cmdlib.sh > >> + > >> +read_opts $* > >> +do_setup > >> +ssh03_s1 || end_testcase "Testcase failed" > >> +do_cleanup > >> diff --git a/audit/ltp/patch/su01 b/audit/ltp/patch/su01 > >> new file mode 100755 > >> index 0000000..0ca6b87 > >> --- /dev/null > >> +++ b/audit/ltp/patch/su01 > >> @@ -0,0 +1,193 @@ > >> +#!/bin/sh > >> +#********************************************************************* > >> +# Copyright (c) International Business Machines Corp., 2003, > >> 2004 > >> +# > >> +# This program 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 2 of the > >> License, > >> or > >> +# (at your option) any later version. > >> +# > >> +# This program 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 this program; if not, write to the Free Software > >> +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA > >> 02111-1307 USA > >> +# > >> +# FILE : su > >> +# > >> +# PURPOSE: Tests the basic functionality of `su`. > >> +# > >> +# SETUP: The program `/usr/bin/expect' MUST be installed. > >> +# > >> +# HISTORY: > >> +# 03/03 Dustin Kirkland (dki...@us...) > >> +# 03/03 Jerone Young (je...@us...) > >> +# 10/01/04 Kris Wilson Port to Red Hat > >> +# > >> +#********************************************************************* > >> + > >> +if [ -z ${TCbin} ] > >> +then > >> + export TCbin="/opt/ltp/testcases/bin" > >> +# $PWD > >> +fi > >> + > >> +export TEST_USER1="su_usr1" > >> + > >> +tvar=${MACHTYPE%-*} > >> +tvar=${tvar#*-} > >> + > >> +# need to export tvar for su01_s1 > >> +export tvar > >> +printf "Machine type is: $tvar\n\n" > >> + > >> +if [ "$tvar" = "redhat" -o "$tvar" = "redhat-linux" ] > >> +# Need to also set group for TEST_USER2 > >> +then > >> +export TEST_USER1_GROUP="wheel" > >> +export TEST_USER2_GROUP="wheel" > >> +else > >> +export TEST_USER1_GROUP="trusted" > >> +export TEST_USER2_GROUP="trusted" > >> +fi > >> +export TEST_USER1_PASSWD="eal" > >> +export TEST_USER1_ENCRYPTED_PASSWD="42VmxaOByKwlA" > >> +export TEST_USER1_NEW_PASSWD="a_very_good_and_long_password" > >> +export TEST_USER1_HOMEDIR="/home/$TEST_USER1" > >> + > >> +export TEST_USER2="su_usr2" > >> +# Group needs to be trusted for Red Hat. > >> +#export TEST_USER2_GROUP="trusted" > >> +export TEST_USER2_PASSWD="eal" > >> +export TEST_USER2_ENCRYPTED_PASSWD="42VmxaOByKwlA" > >> +export TEST_USER2_HOMEDIR="/home/$TEST_USER2" > >> + > >> +#This is for enviroment test > >> +export TEST_LINE="YOU_HAVE_THE_VARIABLE" > >> +export TEST_ENV_FILE="/tmp/TEST_ENV_FILE_ROOT" > >> +export TEST_ENV_FILE_USER="/tmp/TEST_ENV_FILE_USER" > >> +export TEST_ENV_FILE2="/tmp/TEST_ENV_FILE_ROOT2" > >> +#----------------------------------------------------------------------- > >> +# FUNCTION: do_setup > >> +#----------------------------------------------------------------------- > >> + > >> +do_setup(){ > >> + > >> +#REMOVE ANY TEMPOARY FILES THAT MAY STILL BE AROUND > >> +rm -f $TEST_ENV_FILE_USER > /dev/null 2>&1 > >> +rm -f $TEST_ENV_FILE2 > /dev/null 2>&1 > >> +rm -f $TEST_ENV_FILE > /dev/null 2>&1 > >> + > >> + > >> +#Create 1st test user > >> + #erase user if he may exist , so we can have a clean en > >> + rm -rf /home/$TEST_USER1 > >> + userdel $TEST_USER1 > >> + sleep 1 > >> + > >> + useradd -m -g users $TEST_USER1 > >> + if [ $? != 0 ] > >> + then { > >> + echo "Could not add test user $TEST_USER1." > >> + exit 1 > >> + } > >> + fi > >> + > >> + usermod -G users,$TEST_USER1_GROUP $TEST_USER1 > >> + > >> + #create users home directory (SLES 8 does not do this, even when > >> specified in adduser) > >> +# Only do this if not RH; RH creates the directory. > >> + if [ "$tvar" != "redhat" -a "$tvar" != "redhat-linux" ] > >> + then { > >> + USER_UID=`id -u $TEST_USER1` > >> + USER_GID=`id -g $TEST_USER1` > >> + mkdir $TEST_USER1_HOMEDIR > >> + chown -R $USER_UID.$USER_GID $TEST_USER1_HOMEDIR > >> + } > >> + fi > >> + > >> + usermod -p $TEST_USER1_ENCRYPTED_PASSWD $TEST_USER1 > > >> /dev/null 2>&1 > >> + if [ $? != 0 ] > >> + then { > >> + echo "Could not set password for test user > >> $TEST_USER1" > >> + exit 1 > >> + } > >> + fi > >> + > >> +#Create 2nd test user > >> + #erase user if he may exist , so we can have a clean en > >> + rm -rf /home/$TEST_USER2 > >> + userdel $TEST_USER2 > >> + sleep 1 > >> + > >> + useradd -m -g users $TEST_USER2 > >> + > >> + if [ $? != 0 ] > >> + then { > >> + echo "Could not add test user $TEST_USER2." > >> + exit 1 > >> + } > >> + fi > >> + > >> + usermod -G users,$TEST_USER2_GROUP $TEST_USER2 > >> + > >> + #create users home diretory (SLES 8 does not do this, even when > >> specified in adduser) > >> +# Only do this if not RH; RH creates the directory. > >> + if [ "$tvar" != "redhat" -a "$tvar" != "redhat-linux" ] > >> + then { > >> + USER_UID=`id -u $TEST_USER2` > >> + USER_GID=`id -g $TEST_USER2` > >> + mkdir $TEST_USER2_HOMEDIR > >> + chown -R $USER_UID.$USER_GID $TEST_USER2_HOMEDIR > >> + } > >> + fi > >> + > >> + usermod -p $TEST_USER2_ENCRYPTED_PASSWD $TEST_USER2 > > >> /dev/null 2>&1 > >> + if [ $? != 0 ] > >> + then { > >> + echo "Could not set password for test user > >> $TEST_USER2" > >> + exit 1 > >> + } > >> + fi > >> +} > >> + > >> + > >> +#----------------------------------------------------------------------- > >> +# FUNCTION: do_cleanup > >> +#----------------------------------------------------------------------- > >> + > >> +do_cleanup() { > >> + rm -rf /home/$TEST_USER1 > >> + rm -rf /home/$TEST_USER2 > >> + userdel $TEST_USER1 > >> + userdel $TEST_USER2 > >> + #REMOVE ANY TEMPOARY FILES THAT MAY STILL BE AROUND > >> + rm -f $TEST_ENV_FILE_USER > /dev/null 2>&1 > >> + rm -f $TEST_ENV_FILE2 > /dev/null 2>&1 > >> + rm -f $TEST_ENV_FILE > /dev/null 2>&1 > >> +} > >> + > >> +#----------------------------------------------------------------------- > >> +# FUNCTION: screenoff > >> +# > >> +# DESCRIPTION: save off /etc/profile and turn off screen > >> +# > >> +#----------------------------------------------------------------------- > >> +screenoff (){ > >> + tmpbkup=$(mktemp "/etc/profile.XXXXXX") || exit 1 > >> + cp -a /etc/profile $tmpbkup || exit 1 > >> + sed -i 's/\[ -w $(tty) \]/false/' /etc/profile > >> +} > >> +#----------------------------------------------------------------------- > >> +# FUNCTION: MAIN > >> +#----------------------------------------------------------------------- > >> +do_setup > >> +screenoff > >> +/bin/su $TEST_USER1 -c ${TCbin}/su01_s1 > >> +mv -f $tmpbkup /etc/profile > >> +EXIT_CODE=$? > >> +do_cleanup > >> +exit $EXIT_CODE > >> diff --git a/audit/ltp/ssh03 b/audit/ltp/ssh03 > >> deleted file mode 100755 > >> index 30caaba..0000000 > >> --- a/audit/ltp/ssh03 > >> +++ /dev/null > >> @@ -1,91 +0,0 @@ > >> -#!/bin/sh > >> -#********************************************************************* > >> -# Copyright (c) International Business Machines Corp., 2000 > >> -# > >> -# This program 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 2 of the > >> License, > >> or > >> -# (at your option) any later version. > >> -# > >> -# This program 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 this program; if not, write to the Free Software > >> -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA > >> 02111-1307 USA > >> -# > >> -# FILE : ssh > >> -# > >> -# PURPOSE: Tests to see that ssh allows a valid username > >> (non-root) > >> -# > >> -# SETUP: The program `/usr/bin/expect' MUST be installed. > >> -# > >> -# HISTORY: > >> -# 03/03 Jerone Young (je...@us...) > >> -# > >> - > >> -#----------------------------------------------------------------------- > >> -# FUNCTION: do_setup > >> -#----------------------------------------------------------------------- > >> - > >> -do_setup() > >> -{ > >> - export RHOST="localhost" > >> - export TEST_USER="ssh_usr3" > >> - export TEST_USER_PASSWD="eal" > >> - export TEST_USER_ENCRYPTED_PASSWD="42VmxaOByKwlA" > >> - export TEST_USER_HOMEDIR="/home/$TEST_USER" > >> - > >> - # erase user if he/she already exists, so we can have a clean > >> env > >> - > >> - rm -Rf /home/$TEST_USER > >> - tst_setup > >> - > >> - exists expect ssh ssh03_s1 useradd userdel > >> - > >> - userdel $TEST_USER > >> - sleep 1 > >> - > >> - if ! useradd -m -p $TEST_USER_ENCRYPTED_PASSWD $TEST_USER; > >> then > >> - end_testcase "Could not add test user $TEST_USER to > >> system > >> $RHOST." > >> - fi > >> - > >> - # create users home diretory (SLES 8 does not do this, even > >> when > >> specified > >> - # in adduser) > >> - USER_UID=$(id -u $TEST_USER) > >> - USER_GID=$(id -g $TEST_USER) > >> - if ! mkdir -p "$TEST_USER_HOMEDIR"; then > >> - end_testcase "Failed to create $TEST_USER_HOMEDIR" > >> - fi > >> - chown -R $USER_UID.$USER_GID "$TEST_USER_HOMEDIR" > >> - > >> - trap do_cleanup EXIT > >> - > >> -} > >> - > >> -#----------------------------------------------------------------------- > >> -# FUNCTION: do_cleanup > >> -#----------------------------------------------------------------------- > >> - > >> -do_cleanup() > >> -{ > >> - userdel $TEST_USER > >> - tst_cleanup > >> -} > >> - > >> -#----------------------------------------------------------------------- > >> -# FUNCTION: MAIN > >> -# > >> -# DESCRIPTION: Create Test User > >> -# Call upon script to make sure an invalid user can > >> not > >> have access > >> -# Cleanup Test User from system > >> -# Exit with exit code of script called upon > >> -#----------------------------------------------------------------------- > >> -. net_cmdlib.sh > >> - > >> -read_opts $* > >> -do_setup > >> -ssh03_s1 || end_testcase "Testcase failed" > >> -do_cleanup > >> diff --git a/audit/ltp/su01 b/audit/ltp/su01 > >> deleted file mode 100755 > >> index 0ca6b87..0000000 > >> --- a/audit/ltp/su01 > >> +++ /dev/null > >> @@ -1,193 +0,0 @@ > >> -#!/bin/sh > >> -#********************************************************************* > >> -# Copyright (c) International Business Machines Corp., 2003, > >> 2004 > >> -# > >> -# This program 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 2 of the > >> License, > >> or > >> -# (at your option) any later version. > >> -# > >> -# This program 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 this program; if not, write to the Free Software > >> -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA > >> 02111-1307 USA > >> -# > >> -# FILE : su > >> -# > >> -# PURPOSE: Tests the basic functionality of `su`. > >> -# > >> -# SETUP: The program `/usr/bin/expect' MUST be installed. > >> -# > >> -# HISTORY: > >> -# 03/03 Dustin Kirkland (dki...@us...) > >> -# 03/03 Jerone Young (je...@us...) > >> -# 10/01/04 Kris Wilson Port to Red Hat > >> -# > >> -#********************************************************************* > >> - > >> -if [ -z ${TCbin} ] > >> -then > >> - export TCbin="/opt/ltp/testcases/bin" > >> -# $PWD > >> -fi > >> - > >> -export TEST_USER1="su_usr1" > >> - > >> -tvar=${MACHTYPE%-*} > >> -tvar=${tvar#*-} > >> - > >> -# need to export tvar for su01_s1 > >> -export tvar > >> -printf "Machine type is: $tvar\n\n" > >> - > >> -if [ "$tvar" = "redhat" -o "$tvar" = "redhat-linux" ] > >> -# Need to also set group for TEST_USER2 > >> -then > >> -export TEST_USER1_GROUP="wheel" > >> -export TEST_USER2_GROUP="wheel" > >> -else > >> -export TEST_USER1_GROUP="trusted" > >> -export TEST_USER2_GROUP="trusted" > >> -fi > >> -export TEST_USER1_PASSWD="eal" > >> -export TEST_USER1_ENCRYPTED_PASSWD="42VmxaOByKwlA" > >> -export TEST_USER1_NEW_PASSWD="a_very_good_and_long_password" > >> -export TEST_USER1_HOMEDIR="/home/$TEST_USER1" > >> - > >> -export TEST_USER2="su_usr2" > >> -# Group needs to be trusted for Red Hat. > >> -#export TEST_USER2_GROUP="trusted" > >> -export TEST_USER2_PASSWD="eal" > >> -export TEST_USER2_ENCRYPTED_PASSWD="42VmxaOByKwlA" > >> -export TEST_USER2_HOMEDIR="/home/$TEST_USER2" > >> - > >> -#This is for enviroment test > >> -export TEST_LINE="YOU_HAVE_THE_VARIABLE" > >> -export TEST_ENV_FILE="/tmp/TEST_ENV_FILE_ROOT" > >> -export TEST_ENV_FILE_USER="/tmp/TEST_ENV_FILE_USER" > >> -export TEST_ENV_FILE2="/tmp/TEST_ENV_FILE_ROOT2" > >> -#----------------------------------------------------------------------- > >> -# FUNCTION: do_setup > >> -#----------------------------------------------------------------------- > >> - > >> -do_setup(){ > >> - > >> -#REMOVE ANY TEMPOARY FILES THAT MAY STILL BE AROUND > >> -rm -f $TEST_ENV_FILE_USER > /dev/null 2>&1 > >> -rm -f $TEST_ENV_FILE2 > /dev/null 2>&1 > >> -rm -f $TEST_ENV_FILE > /dev/null 2>&1 > >> - > >> - > >> -#Create 1st test user > >> - #erase user if he may exist , so we can have a clean en > >> - rm -rf /home/$TEST_USER1 > >> - userdel $TEST_USER1 > >> - sleep 1 > >> - > >> - useradd -m -g users $TEST_USER1 > >> - if [ $? != 0 ] > >> - then { > >> - echo "Could not add test user $TEST_USER1." > >> - exit 1 > >> - } > >> - fi > >> - > >> - usermod -G users,$TEST_USER1_GROUP $TEST_USER1 > >> - > >> - #create users home directory (SLES 8 does not do this, even when > >> specified in adduser) > >> -# Only do this if not RH; RH creates the directory. > >> - if [ "$tvar" != "redhat" -a "$tvar" != "redhat-linux" ] > >> - then { > >> - USER_UID=`id -u $TEST_USER1` > >> - USER_GID=`id -g $TEST_USER1` > >> - mkdir $TEST_USER1_HOMEDIR > >> - chown -R $USER_UID.$USER_GID $TEST_USER1_HOMEDIR > >> - } > >> - fi > >> - > >> - usermod -p $TEST_USER1_ENCRYPTED_PASSWD $TEST_USER1 > > >> /dev/null 2>&1 > >> - if [ $? != 0 ] > >> - then { > >> - echo "Could not set password for test user > >> $TEST_USER1" > >> - exit 1 > >> - } > >> - fi > >> - > >> -#Create 2nd test user > >> - #erase user if he may exist , so we can have a clean en > >> - rm -rf /home/$TEST_USER2 > >> - userdel $TEST_USER2 > >> - sleep 1 > >> - > >> - useradd -m -g users $TEST_USER2 > >> - > >> - if [ $? != 0 ] > >> - then { > >> - echo "Could not add test user $TEST_USER2." > >> - exit 1 > >> - } > >> - fi > >> - > >> - usermod -G users,$TEST_USER2_GROUP $TEST_USER2 > >> - > >> - #create users home diretory (SLES 8 does not do this, even when > >> specified in adduser) > >> -# Only do this if not RH; RH creates the directory. > >> - if [ "$tvar" != "redhat" -a "$tvar" != "redhat-linux" ] > >> - then { > >> - USER_UID=`id -u $TEST_USER2` > >> - USER_GID=`id -g $TEST_USER2` > >> - mkdir $TEST_USER2_HOMEDIR > >> - chown -R $USER_UID.$USER_GID $TEST_USER2_HOMEDIR > >> - } > >> - fi > >> - > >> - usermod -p $TEST_USER2_ENCRYPTED_PASSWD $TEST_USER2 > > >> /dev/null 2>&1 > >> - if [ $? != 0 ] > >> - then { > >> - echo "Could not set password for test user > >> $TEST_USER2" > >> - exit 1 > >> - } > >> - fi > >> -} > >> - > >> - > >> -#----------------------------------------------------------------------- > >> -# FUNCTION: do_cleanup > >> -#----------------------------------------------------------------------- > >> - > >> -do_cleanup() { > >> - rm -rf /home/$TEST_USER1 > >> - rm -rf /home/$TEST_USER2 > >> - userdel $TEST_USER1 > >> - userdel $TEST_USER2 > >> - #REMOVE ANY TEMPOARY FILES THAT MAY STILL BE AROUND > >> - rm -f $TEST_ENV_FILE_USER > /dev/null 2>&1 > >> - rm -f $TEST_ENV_FILE2 > /dev/null 2>&1 > >> - rm -f $TEST_ENV_FILE > /dev/null 2>&1 > >> -} > >> - > >> -#----------------------------------------------------------------------- > >> -# FUNCTION: screenoff > >> -# > >> -# DESCRIPTION: save off /etc/profile and turn off screen > >> -# > >> -#----------------------------------------------------------------------- > >> -screenoff (){ > >> - tmpbkup=$(mktemp "/etc/profile.XXXXXX") || exit 1 > >> - cp -a /etc/profile $tmpbkup || exit 1 > >> - sed -i 's/\[ -w $(tty) \]/false/' /etc/profile > >> -} > >> -#----------------------------------------------------------------------- > >> -# FUNCTION: MAIN > >> -#----------------------------------------------------------------------- > >> -do_setup > >> -screenoff > >> -/bin/su $TEST_USER1 -c ${TCbin}/su01_s1 > >> -mv -f $tmpbkup /etc/profile > >> -EXIT_CODE=$? > >> -do_cleanup > >> -exit $EXIT_CODE > >> -- > >> 1.7.6.4 > >> > >> > > |