Subversion Repositories ALCASAR

Rev

Rev 1056 | Blame | Last modification | View Log

#/bin/bash
# $Id: alcasar-nf.sh 1827 2016-04-19 09:47:29Z raphael.pion $

# alcasar-nf.sh
# by Rexy
# This script is distributed under the Gnu General Public License (GPL)

# active ou desactive le filtrage de protocoles réseau
# enable or disable the network protocols filter

SED="/bin/sed -i"
CONF_FILE="/usr/local/etc/alcasar.conf"

usage="Usage: alcasar-nf.sh {--on | -on} | {--off | -off}"
nb_args=$#
args=$1
if [ $nb_args -eq 0 ]
then
        echo $usage
        exit 1
fi
case $args in
        -\? | -h* | --h*)
                echo "$usage"
                exit 0
                ;;
        --on|-on) # enable protocols filter
                $SED "s?^PROTOCOLS_FILTERING.*?PROTOCOLS_FILTERING=on?g" $CONF_FILE
                /usr/local/bin/alcasar-iptables.sh
                ;;
        --off|-off) # disable protocols filter
                $SED "s?^PROTOCOLS_FILTERING.*?PROTOCOLS_FILTERING=off?g" $CONF_FILE
                /usr/local/bin/alcasar-iptables.sh
                ;;
        *)
                echo "Argument inconnu :$1";
                echo "$usage"
                exit 1
                ;;
esac