DOSC TWiki snapshot as of mid-2005

Top

SystraceSidecard2


This goes in /etc/rc.d/init.d/sidecar. See AlexsSidecardScript for install instructions. This is a drop in replacement for my standard sidecard and, more or less, for the old, official one. This is intended for Redhat 8.0; I don't know if other systems work the same way or not.

#########################BEGIN########################
#!/bin/bash
# jlh
# prettified by Alex Ferguson on Mar 18 2003


# This script is designed to live in /etc/rc.d/init.d/ and to be used
# to [start | stop] the sidecar daemon
# Usage: sidecar (start|stop)

# Start the sidecar deamon

# Paranoia.  Why would root ever be running an untrusted environment?
# Maybe some fool managed to suid this?
PATH=""
IFS=`printf ' \t\n'`
export PATH IFS

# Settings which you might change

# path to the sidecar executable
SIDECAR=/usr/local/sbin/sidecar
# Directory where sidecar.pid and sidecar.log go
SIDECAR_DIR=/var/run
# Valid options are "" and -D1 through -D5, in order of increasing verbosity
DEBUG_OPTION=""

# End of settings

# Check that we even have sidecar
[ -x $SIDECAR ] || exit 0

# Source handy init.d functions
. /etc/init.d/functions

# This is "sidecar" in all but unusual cases..
prog=`/bin/basename $SIDECAR`
# Log file to which we redirect.  It is truncated at start time
log=$SIDECAR_DIR/sidecar.log

case "$1" in
'start')
      echo -n "Starting $prog: "

      daemon /bin/bash -c "\"/usr/local/bin/systrace -aid /etc/systrace $SIDECAR $DEBUG_OPTION -d $SIDECAR_DIR > $log 2>&1\""
      [ $? = 0 ] && touch /var/lock/subsys/$prog

      echo
   ;;

'stop')
      echo -n "Stopping $prog: "
   
      killproc $SIDECAR
      [ $? = 0 ] &&          rm -f /var/lock/subsys/$prog $SIDECAR_DIR/sidecar.pid
   
      echo
   ;;

   *)
      echo "usage: $0 {start|stop}"
      exit 1
   ;;
esac
##########################END############################

Check /var/log/messages for gripes from systrace in case I missed some syscalls (or your sidecar gets hacked ;)

AlexFerguson - 18 Mar 2003