#!/bin/bash -l IDENT="`date --date="today" "+%Y-%m-%d_%H-%M-%S"`.`whoami`.$$" LOGDIR="/var/log/auditshell/${IDENT}" TYPESCRIPT="${LOGDIR}/typescript.${IDENT}" TIMING="${LOGDIR}/timing.${IDENT}" # This is a file transfer, no audit shell neccessary if (echo "$@"|egrep -q "^-c.*scp.*$");then logger -t auditshell.filetransfer.${IDENT} <<< "/bin/sh $@" exec /bin/sh "$@" # Remote command execution elif (echo "$@"|egrep -q "^-c.*$");then logger -t auditshell.remotecommand.${IDENT} <<< "/bin/bash $@" exec /bin/bash "$@" fi if [ "$AUDITSHELL" ];then echo "INFO: already in a auditshell session" exit 1 fi mkdir $LOGDIR RET="$?" if [ "$RET" != "0" ];then echo "ERROR: Creation of dir '$LOGDIR' failed, exitcode $RET" exit 1 fi export SHELL=/bin/bash cat <