Rev 1377 | Go to most recent revision | Blame | Last modification | View Log
#!/bin/bash
# $Id: alcasar-bypass.sh 1469 2014-10-30 21:58:47Z richard $
# alcasar-bypass.sh
# by 3abtux and Rexy
# This script is distributed under the Gnu General Public License (GPL)
# activation / désactivation du contournement de l'authentification et du filtrage WEB
# enable / disable the bypass of authenticate process and filtering
usage="Usage: alcasar-bypass.sh {--on or -on } | {--off or -off}"
SED="/bin/sed -i"
CONF_FILE="/usr/local/etc/alcasar.conf"
INTIF=`grep ^INTIF= $CONF_FILE|cut -d"=" -f2` # INTernal InterFace
nb_args=$#
args=$1
if [ $nb_args -eq 0 ]
then
nb_args=1
args="-h"
fi
case $args in
-\? | -h* | --h*)
echo "$usage"
exit 0
;;
--on | -on)
# activation du contournement
for i in chilli dansguardian havp mysqld radiusd httpd freshclam dnsmasq squid
do
if (pgrep $i) > /dev/null ; then /usr/bin/systemctl stop $i.service ; fi
done
echo "$INTIF configuration ..."
cp /etc/sysconfig/network-scripts/default-ifcfg-$INTIF /etc/sysconfig/network-scripts/ifcfg-$INTIF
ifup $INTIF
sh /usr/local/bin/alcasar-iptables-bypass.sh
echo "dnsmasq Configuration ..."
$SED "s?^conf-dir=.*?#&?g" /etc/dnsmasq-blacklist.conf
$SED "s?^no-dhcp-interface=.*?#&?g" /etc/dnsmasq.conf /etc/dnsmasq-blacklist.conf
/etc/init.d/dnsmasq start
echo "Le contournement des modules d'authentification de filtrage est activé"
echo "les journaux de connexions continuent néanmoins d'être enregistrés"
;;
--off | -off)
# désactivation du contournement
if (pgrep dnsmasq) > /dev/null ; then /etc/init.d/dnsmasq stop ; fi
echo "dnsmasq Configuration ..."
$SED "s?^#conf-dir=.*?conf-dir=/usr/local/share/dnsmasq-bl-enabled?g" /etc/dnsmasq-blacklist.conf
$SED "s?^#no-dhcp-interface=.*?no-dhcp-interface=$INTIF?g" /etc/dnsmasq.conf /etc/dnsmasq-blacklist.conf
rm -f /etc/sysconfig/network-scripts/ifcfg-$INTIF
for i in chilli dansguardian havp mysqld radiusd httpd freshclam dnsmasq squid
do
if ! (pgrep $i) > /dev/null ; then /usr/bin/systemctl start $i.service; fi
done
sh /usr/local/bin/alcasar-iptables.sh
echo "L'authentification et le filtrage sont de nouveau activés"
;;
*)
echo "Argument inconnu :$1";
echo "$usage"
exit 1
;;
esac