View Single Post
  #16  
Old 14th May 2008, 22:17
CavalierDeVache CavalierDeVache is offline
Junior Member
 
Join Date: Aug 2007
Location: Yellowstone Valley
Posts: 4
Thanks: 0
Thanked 1 Time in 1 Post
Default

I'm sorry I wasn't more verbose, I was in the middle of sorting 3 or 4 things myself with 8.04.

But there is 1 more problem you will have to deal with, the /var/run directory structure is wiped on every reboot so you will need to create /ver/run/fail2ban from within the init script with a check to see if it already exists.

Here is a snippet of the script where you can see the changes I made to get it to work.
Code:
PATH=/usr/sbin:/usr/bin:/sbin:/bin
DESC="authentication failure monitor"
NAME=fail2ban

# /var/run is emptied on reboot, need to create run directory on startup
FAIL2BANRUNDIR=/var/run/fail2ban
if [ -d $FAIL2BANRUNDIR ]; then
        #do nothing
        echo "Directory '$FAIL2BANRUNDIR' already exists."
else
        mkdir -p $FAIL2BANRUNDIR
fi

# fail2ban-client is not a daemon itself but starts a daemon and
# loads its with configuration
DAEMON=/usr/bin/$NAME-client
SCRIPTNAME=/etc/init.d/$NAME

# Ad-hoc way to parse out socket file name
SOCKFILE=`grep -h '^[^#]*socket *=' /etc/$NAME/$NAME.conf /etc/$NAME/$NAME.local 2>/dev/null \
          | tail -n 1 | sed -e 's/.*socket *= *//g' -e 's/ *$//g'`
[ -z "$SOCKFILE" ] && SOCKFILE='/var/run/fail2ban/fail2ban.sock'
Reply With Quote