| #!/bin/bash |
| |
| |
| t_Log "Running $0 - checking iptraf runs and returns non-zero exit status." |
| |
| TMP=/tmp/iptraf.log |
| |
| |
| trap "[ -e ${TMP} ] && { /bin/rm ${TMP}; }" EXIT |
| |
| |
| [ ${EUID} -eq 0 ] || { t_Log "Not running as root, skipping this test. Non-fatal."; exit $PASS; } |
| |
| IPTRAF=`which iptraf` |
| PING=`which ping` |
| STAT=`which stat` |
| KILL=`which kill` |
| |
| [ "$IPTRAF" ] || { t_log "Failed to find iptraf binary. That ain't good..."; exit $FAIL; } |
| [ "$PING" ] || { t_Log "Failed to find the ping binary. That ain't good..."; exit $FAIL; } |
| [ "$STAT" ] || { t_Log "Failed to find the stat binary. That ain't good..."; exit $FAIL; } |
| [ "$KILL" ] || { t_Log "Failed to find the kill binary. That ain't good..."; exit $FAIL; } |
| |
| |
| ${IPTRAF} -i all -t 1 -B -L ${TMP} &>/dev/null |
| |
| |
| ${PING} -c 5 127.0.0.1 &>/dev/null |
| |
| |
| LOGSIZE=`stat -c '%s' ${TMP}` |
| |
| |
| ${KILL} -USR2 `pidof iptraf` |
| |
| |
| [ ${LOGSIZE} -gt 0 ] || { t_Log "iptraf failed to log any traffic?!. That ain't good..."; exit $FAIL; } |
| |