Commit 8780a93d authored by Loic's avatar Loic
Browse files

Change location of log file in paxtest



Change location of the paxtest shell script so that
it default location is the user's HOME directory.

Also add an option to define the logfile location
in the command line

Conflicts: genpaxtest

Author: Javier Fernández-Sanguino Peña <jfs@debian.org>
Signed-off-by: Loic's avatarLoic <loic.f@hardenedbsd.org>
parent d19ef1cb
......@@ -50,7 +50,7 @@ or
./paxtest blackhat (to run paxtest in blackhat mode)
This will create a file paxtest.log in the current directory.
This will create a file paxtest.log in the user's home directory.
Kiddie and blackhat mode:
......
......@@ -22,11 +22,12 @@ OS_TYPE=`uname -o`
cat << __here__ > paxtest
#!/bin/sh
if [ \$# = 1 ]
if [ \$# = 1 -o \$# = 2 ]
then
if [ "\$1" = "kiddie" ]
then
PAXTEST_MODE=0
shift
elif [ "\$1" = "blackhat" ]
then
__here__
......@@ -39,18 +40,26 @@ __here__
else
cat << __here__ >>paxtest
PAXTEST_MODE=1
shift
__here__
fi
cat << __here__ >>paxtest
else
echo "usage: paxtest [kiddie|blackhat]"
echo "usage: paxtest [kiddie|blackhat] [logfile]"
exit 1
fi
else
echo "usage: paxtest [kiddie|blackhat]"
echo "usage: paxtest [kiddie|blackhat] [logfile]"
exit 1
fi
LOG=\$HOME/paxtest.log
[ -n "\$1" ] && LOG=\$1
touch "\$LOG"
if [ ! -e "\$LOG" ] ; then
echo "Could not create logfile in \$LOG" >&2
exit 1
fi
export PAXTEST_MODE
if [ "\${LD_LIBRARY_PATH}" = "" ]
......@@ -61,7 +70,7 @@ else
fi
export LD_LIBRARY_PATH
cat <<__end__ | tee paxtest.log
cat <<__end__ | tee \$LOG
PaXtest
Copyright(c) 2003-2014 by Peter Busser <peter@adamantix.org> and Brad Spengler <spender@grsecurity.net>
Copyright(c) 2015 by Oliver Pinter <op@hardenedbsd.org>
......@@ -69,18 +78,18 @@ Released under the GNU Public Licence version 2 or later
__end__
echo "Mode: \$1" >>paxtest.log
echo "Uname: `uname -a`" >>paxtest.log
echo "Compiler: ${COMPILER_VERSION}" >>paxtest.log
echo >>paxtest.log
echo "Mode: \$1" >>\$LOG 2>&1
echo "Uname: `uname -a`" >>\$LOG 2>&1
echo "Compiler: ${COMPILER_VERSION}" >>\$LOG 2>&1
echo >>\$LOG 2>&1
echo 'Writing output to paxtest.log'
echo 'Writing output to \$LOG'
echo 'It may take a while for the tests to complete'
for i in $*
do
${RUNDIR}/\$i || echo
done >>paxtest.log 2>&1
done >>\$LOG 2>&1
__here__
if [ ${OS_TYPE} = "FreeBSD" ]
......@@ -88,15 +97,15 @@ then
cat << __here__ >>paxtest
if [ "$USER" != "root" ] && [ \`sysctl -n security.bsd.unprivileged_proc_debug\` = 0 ]
then
echo >>paxtest.log
echo "warning: the randvdso test may be invalid, try to retest with the security.bsd.unprivileged_proc_debug=1 sysctl setting" >>paxtest.log
echo >>\$LOG 2>&1
echo "warning: the randvdso test may be invalid, try to retest with the security.bsd.unprivileged_proc_debug=1 sysctl setting" >>\$LOG 2>&1
fi
__here__
fi
cat << __here__ >>paxtest
echo "Test results:"
cat paxtest.log
cat \$LOG
echo
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment