1294 |
richard |
1 |
#!/bin/sh
|
2234 |
richard |
2 |
#
|
|
|
3 |
# $Id: alcasar-condown.sh 2394 2017-08-27 13:28:59Z tom.houdayer $
|
|
|
4 |
#
|
2068 |
richard |
5 |
# alcasar-condown.sh
|
1294 |
richard |
6 |
# by Rexy
|
|
|
7 |
# This script is distributed under the Gnu General Public License (GPL)
|
|
|
8 |
|
2184 |
richard |
9 |
# This script is launched by coova after each logout
|
|
|
10 |
# Ce script est lancé par coova à chaque déconnexion d'usager
|
1294 |
richard |
11 |
|
2234 |
richard |
12 |
if [ -z $FRAMED_IP_ADDRESS ]; then
|
|
|
13 |
exit 1
|
2184 |
richard |
14 |
fi
|
1294 |
richard |
15 |
|
2069 |
richard |
16 |
# Remove user from his IPSET (depending on FILTER_ID)
|
1364 |
richard |
17 |
|
2234 |
richard |
18 |
# FilterID Byte N°0 to 7
|
|
|
19 |
# 0: profile_1 (WEB)
|
|
|
20 |
# 1: profile_2 (WEB + Mail + Remote access)
|
|
|
21 |
# 2: profile_3 (Custom)
|
|
|
22 |
# 3: warn_user (if imputability report has been generated)
|
2394 |
tom.houday |
23 |
# 4: status_open_required (check user activity through status page)
|
2234 |
richard |
24 |
# 5: WL
|
|
|
25 |
# 6: BL
|
|
|
26 |
# 7: HAVP
|
2006 |
raphael.pi |
27 |
|
2249 |
tom.houday |
28 |
if [ ${FILTER_ID:5:1} == '1' ]; then # HAVP_WL
|
|
|
29 |
set_filter="havp_wl"
|
2234 |
richard |
30 |
elif [ ${FILTER_ID:6:1} == '1' ]; then # HAVP_BL
|
|
|
31 |
set_filter="havp_bl"
|
2249 |
tom.houday |
32 |
elif [ ${FILTER_ID:7:1} == '1' ]; then # HAVP
|
|
|
33 |
set_filter="havp"
|
2234 |
richard |
34 |
else # NOT_FILTERED
|
|
|
35 |
set_filter="not_filtered"
|
2006 |
raphael.pi |
36 |
fi
|
|
|
37 |
|
2249 |
tom.houday |
38 |
if [ ${FILTER_ID:2:1} == '1' ]; then # PROFILE 3 (Custom)
|
|
|
39 |
set_proto="proto_3";
|
2234 |
richard |
40 |
elif [ ${FILTER_ID:1:1} == '1' ]; then # PROFILE 2 (WEB + Mail + Remote access)
|
|
|
41 |
set_proto="proto_2";
|
2249 |
tom.houday |
42 |
elif [ ${FILTER_ID:0:1} == '1' ]; then # PROFILE 1 (WEB)
|
|
|
43 |
set_proto="proto_1";
|
2234 |
richard |
44 |
else # PROFILE 0 (Not filtered)
|
|
|
45 |
set_proto="proto_0";
|
2006 |
raphael.pi |
46 |
fi
|
|
|
47 |
|
2234 |
richard |
48 |
ipset del $set_filter $FRAMED_IP_ADDRESS
|
2006 |
raphael.pi |
49 |
ipset del $set_proto $FRAMED_IP_ADDRESS
|
2184 |
richard |
50 |
|
2376 |
tom.houday |
51 |
# Remove IP address from active users
|
|
|
52 |
current_users_file="/var/tmp/havp/current_users.txt"
|
2394 |
tom.houday |
53 |
[ -e $current_users_file ] && sed -i "/^$FRAMED_IP_ADDRESS:/d" $current_users_file
|
2376 |
tom.houday |
54 |
|
2234 |
richard |
55 |
# Debug : show all the coova parse variables (+ $set_filter + $set_proto).
|
2184 |
richard |
56 |
# see "/src/chilli.c" for the complete list of parse variables
|
|
|
57 |
#echo "-----------------------------------------------" >> /tmp/debug-condown.txt
|
|
|
58 |
#echo `date` >> /tmp/debug-condown.txt
|
|
|
59 |
#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
|
|
|
60 |
#do
|
|
|
61 |
# echo "$i : ${!i}" >> /tmp/debug-condown.txt
|
|
|
62 |
#done
|
2234 |
richard |
63 |
#echo "set_filter : $set_filter" >> /tmp/debug-condown.txt
|
2184 |
richard |
64 |
#echo "set_proto : $set_proto" >> /tmp/debug-condown.txt
|