Subversion Repositories ALCASAR

Compare Revisions

Ignore whitespace Rev 2233 → Rev 2234

/scripts/alcasar-conup.sh
1,5 → 1,7
#!/bin/sh
 
#
# $Id$
#
# alcasar-conup.sh
# by Rexy
# This script is distributed under the Gnu General Public License (GPL)
7,126 → 9,45
# This script is launched by coova after each successfull login
# Ce script est lancé par coova à chaque connexion d'usager (authentification réussi)
 
if [ -z $FRAMED_IP_ADDRESS ]
then
exit
if [ -z $FRAMED_IP_ADDRESS ]; then
exit 1
fi
 
ipset del not_auth_yet $FRAMED_IP_ADDRESS
 
# Add user to his IPSET (depending on FILTER_ID)
 
# FilterID Byte N°0 to 7
#0-> profile1
#1-> profile2
#2-> profile3
#3-> warn_user (if imputability report has been generated)
#5-> WL
#6-> BL
#7-> HAVP
# 0: profile_1 (WEB)
# 1: profile_2 (WEB + Mail + Remote access)
# 2: profile_3 (Custom)
# 3: warn_user (if imputability report has been generated)
# 5: WL
# 6: BL
# 7: HAVP
 
if [ ${FILTER_ID:7:1} -eq '1' ] #HAVP
then
set="havp"
if [ ${FILTER_ID:0:1} -eq '1' ]
then
set_proto="proto_1";
fi
 
if [ ${FILTER_ID:1:1} -eq '1' ]
then
set_proto="proto_2";
fi
if [ ${FILTER_ID:2:1} -eq '1' ]
then
set_proto="proto_3";
fi
 
if [ -z "$set_proto" ]
then
set_proto="proto_0";
fi
if [ ${FILTER_ID:7:1} == '1' ]; then # HAVP
set_filter="havp"
elif [ ${FILTER_ID:6:1} == '1' ]; then # HAVP_BL
set_filter="havp_bl"
elif [ ${FILTER_ID:5:1} == '1' ]; then # HAVP_WL
set_filter="havp_wl"
else # NOT_FILTERED
set_filter="not_filtered"
fi
 
if [ ${FILTER_ID:6:1} -eq '1' ] #HAVP_BL
then
set="havp_bl"
if [ ${FILTER_ID:0:1} -eq '1' ]
then
set_proto="proto_1";
fi
 
if [ ${FILTER_ID:1:1} -eq '1' ]
then
set_proto="proto_2";
fi
if [ ${FILTER_ID:2:1} -eq '1' ]
then
set_proto="proto_3";
fi
 
if [ -z "$set_proto" ]
then
set_proto="proto_0";
fi
if [ ${FILTER_ID:0:1} == '1' ]; then # PROFILE 1 (WEB)
set_proto="proto_1";
elif [ ${FILTER_ID:1:1} == '1' ]; then # PROFILE 2 (WEB + Mail + Remote access)
set_proto="proto_2";
elif [ ${FILTER_ID:2:1} == '1' ]; then # PROFILE 3 (Custom)
set_proto="proto_3";
else # PROFILE 0 (Not filtered)
set_proto="proto_0";
fi
 
if [ ${FILTER_ID:5:1} -eq '1' ] #HAVP_WL
then
set="havp_wl"
if [ ${FILTER_ID:0:1} -eq '1' ]
then
set_proto="proto_1";
fi
 
if [ ${FILTER_ID:1:1} -eq '1' ]
then
set_proto="proto_2";
fi
if [ ${FILTER_ID:2:1} -eq '1' ]
then
set_proto="proto_3";
fi
 
if [ -z "$set_proto" ]
then
set_proto="proto_0";
fi
fi
 
 
 
if [ -z "$set" ] #NOT_FILTERED
then
set="not_filtered"
if [ ${FILTER_ID:0:1} -eq '1' ]
then
set_proto="proto_1";
fi
 
if [ ${FILTER_ID:1:1} -eq '1' ]
then
set_proto="proto_2";
fi
if [ ${FILTER_ID:2:1} -eq '1' ]
then
set_proto="proto_3";
fi
 
if [ -z "$set_proto" ]
then
set_proto="proto_0";
fi
fi
 
ipset add $set $FRAMED_IP_ADDRESS
ipset add $set_filter $FRAMED_IP_ADDRESS
ipset add $set_proto $FRAMED_IP_ADDRESS
 
# Debug : show all the coova parse variables (+ $set + $set_proto).
# 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-conup.txt
#echo `date` >> /tmp/debug-conup.txt
134,6 → 55,6
#do
# echo "$i : ${!i}" >> /tmp/debug-conup.txt
#done
#echo "set : $set" >> /tmp/debug-conup.txt
#echo "set_filter : $set_filter" >> /tmp/debug-conup.txt
#echo "set_proto : $set_proto" >> /tmp/debug-conup.txt