File: //usr/local/cwaf/web/directadmin/scripts/install.sh
#!/bin/sh
#################################################
# VARS AND VARIOUS SETTINGS
#################################################
. /usr/local/directadmin/plugins/comodo_waf/scripts/variables.sh
################## MAIN PART ##############################
chown -R diradmin:diradmin "$PLUGIN_PATH"
chmod -R 755 "$PLUGIN_PATH/admin"
chmod -R 700 "$PLUGIN_PATH/scripts"
cd ${TMP_PATH}
echo "Download CWAF install file<br>"
#wget $WEBADDR --no-check-certificate
cp "$PLUGIN_PATH/scripts/cwaf_client_install.sh" ${TMP_PATH}
if [ -r ./cwaf_client_install.sh ]; then
echo "Installing CWAF to ${INST_PATH}<br>"
PLATFORM=""
APACHE_RUNNING=$(ps ax | egrep -w '(httpd|apache|apache2)' | grep -v grep)
NGINX_RUNNING=$(ps ax | egrep -w 'nginx' | grep -v grep)
if [ ! -z "$NGINX_RUNNING" ]; then
PLATFORM="--platform=Nginx"
fi
if [ ! -z "$APACHE_RUNNING" ]; then
PLATFORM="--platform=Apache"
fi
sh ./cwaf_client_install.sh -- --batch --login=${LOGIN} --password=${PASSWD} ${PLATFORM} > /dev/null
echo "<br>Preparing CWAF<br>"
chown -R "$PLUGIN_USER" ${INST_PATH}
rm ./cwaf_client_install.sh
echo "<br>Comodo Web Application Firewall is installed!<br>"
else
echo "Cannot find install script<br>"
fi
exit 0;