#!/bin/sh
#
# ipscromp exit script to add specified IP to /var/spool/ipscromp/
# and then reload the firewall
#                                             cheesy@sackheads.org
#
# ***WARNING***
# $1 is not validated and will cause breakage if it's not a real IP
# Suggest 700 on $0 and /var/spool/ipscromp/
# ***WARNING***

IP_LIST_DIR=/var/spool/ipscromp
FW_UPD_SCRIPT=/usr/local/sbin/reload_ipf

if [ $# -lt 1 -o $# -gt 2]
then
  echo Usage: $(basename $0) '<ip>' '[<username>]' >&2
  exit 1
fi

touch $IP_LIST_DIR/$1
rc=$?

if [ $rc -eq 0 ]
then
  $FW_UPD_SCRIPT
  rc=$?
fi

exit $rc
