First off, thanks very much p0liX. I haven't tested the rules themselves yet, but it's excellent that you've made your work available.

Originally Posted by
richenou
I tested it but it failed:
I'm guessing you accepted the default location by entering a blank. That would take you to...
Code:
else
echo "Nothing was entered, Using default directory /usr/local/apache/conf/modsec_rules"
RULEDIR="/usr/local/apache/conf/modsec_rules"
if [ -d $RULEDIR ]; then
echo "Directory already exists. Backing up current directory"
mv $RULEDIR $RULEDIR.`date +%m%d%Y-%H%M`
mkdir $RULEDIR
if [ -d $RULEDIR ]; then
echo "Directory created successfully"
else
echo "Directory creation failed."
echo "Installation aborted"
exit 0
fi
fi
fi
That logic is used when you accept the default destination path by entering a blank. It doesn't handle the situation where the folder doesn't already exist. It only creates the folder after an existing folder has been moved. The creation logic is incorrectly contained in the same if fi block. I think p0liX wanted something more like...
Code:
else
echo "Nothing was entered, Using default directory /usr/local/apache/conf/modsec_rules"
RULEDIR="/usr/local/apache/conf/modsec_rules"
if [ -d $RULEDIR ]; then
echo "Directory already exists. Backing up current directory"
mv $RULEDIR $RULEDIR.`date +%m%d%Y-%H%M`
fi
mkdir $RULEDIR
if [ -d $RULEDIR ]; then
echo "Directory created successfully"
else
echo "Directory creation failed."
echo "Installation aborted"
exit 0
fi
fi
That should correct it.
Regards,
LBJ