Subversion Repositories ALCASAR

Rev

Rev 2376 | Rev 2501 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log

#!/bin/sh
#
# $Id: alcasar-condown.sh 2394 2017-08-27 13:28:59Z tom.houdayer $
#
# alcasar-condown.sh
# by Rexy
# This script is distributed under the Gnu General Public License (GPL)

# This script is launched by coova after each logout
# Ce script est lancé par coova à chaque déconnexion d'usager

if [ -z $FRAMED_IP_ADDRESS ]; then
        exit 1
fi

# Remove user from his IPSET (depending on FILTER_ID)

# FilterID Byte N°0 to 7
#  0: profile_1 (WEB)
#  1: profile_2 (WEB + Mail + Remote access)
#  2: profile_3 (Custom)
#  3: warn_user (if imputability report has been generated)
#  4: status_open_required (check user activity through status page)
#  5: WL
#  6: BL
#  7: HAVP

if [ ${FILTER_ID:5:1} == '1' ]; then    # HAVP_WL
        set_filter="havp_wl"
elif [ ${FILTER_ID:6:1} == '1' ]; then  # HAVP_BL
        set_filter="havp_bl"
elif [ ${FILTER_ID:7:1} == '1' ]; then  # HAVP
        set_filter="havp"
else                                    # NOT_FILTERED
        set_filter="not_filtered"
fi

if [ ${FILTER_ID:2:1} == '1' ]; then    # PROFILE 3 (Custom)
        set_proto="proto_3";
elif [ ${FILTER_ID:1:1} == '1' ]; then  # PROFILE 2 (WEB + Mail + Remote access)
        set_proto="proto_2";
elif [ ${FILTER_ID:0:1} == '1' ]; then  # PROFILE 1 (WEB)
        set_proto="proto_1";
else                                    # PROFILE 0 (Not filtered)
        set_proto="proto_0";
fi

ipset del $set_filter $FRAMED_IP_ADDRESS
ipset del $set_proto $FRAMED_IP_ADDRESS

# Remove IP address from active users
current_users_file="/var/tmp/havp/current_users.txt"
[ -e $current_users_file ] && sed -i "/^$FRAMED_IP_ADDRESS:/d" $current_users_file

# Debug : show all the coova parse variables (+ $set_filter + $set_proto).
# see "/src/chilli.c" for the complete list of parse variables
#echo "-----------------------------------------------" >> /tmp/debug-condown.txt
#echo `date` >> /tmp/debug-condown.txt
#for i in LAYER3 DEV NET MASK ADDR USER_NAME NAS_IP_ADDRESS SERVICE_TYPE FRAMED_IP_ADDRESS FILTER_ID STATE CLASS CUI SESSION_TIMEOUT IDLE_TIMEOUT CALLING_STATION_ID CALLED_STATION_ID NAS_ID NAS_PORT_TYPE ACCT_SESSION_ID ACCT_INTERIM_INTERVAL WISPR_LOCATION_ID WISPR_LOCATION_NAME WISPR_BANDWIDTH_MAX_UP WISPR_BANDWIDTH_MAX_DOWN WISPR-SESSION_TERMINATE_TIME CHILLISPOT_MAX_INPUT_OCTETS CHILLISPOT_MAX_OUTPUT_OCTETS CHILLISPOT_MAX_TOTAL_OCTETS INPUT_OCTETS OUTPUT_OCTETS SESSION_TIME IDLE_TIME LOCATION OLD_LOCATION TERMINATE_CAUSE
#do
#       echo "$i : ${!i}" >> /tmp/debug-condown.txt
#done
#echo "set_filter : $set_filter" >> /tmp/debug-condown.txt
#echo "set_proto : $set_proto" >> /tmp/debug-condown.txt

Generated by GNU Enscript 1.6.6.