Subversion Repositories ALCASAR

Rev

Rev 1872 | Rev 2010 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log

Rev Author Line No. Line
872 richard 1
#!/bin/sh
2
 
3
# alcasar-conup.sh
4
# by Rexy
5
# This script is distributed under the Gnu General Public License (GPL)
6
 
7
# This script is launched after each successfull login
8
# Ce script est lancé à chaque connexion d'usager (authentification réussi)
9
 
10
# Debug : show all the coova parse variables. There are declared in /src/chilli.c
1294 richard 11
#echo "parse coova variables" > /tmp/debug-conup.txt
12
#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
13
#do
14
#	echo "$i : ${!i}" >> /tmp/debug-conup.txt
15
#done
1867 raphael.pi 16
ipset del not_auth_yet $FRAMED_IP_ADDRESS
2006 raphael.pi 17
 
18
 
1364 richard 19
# Add user to the SET (function of his filtering level)
2006 raphael.pi 20
 
21
#12345678
22
#1-> profile1
23
#2-> profile2
24
#3-> profile3
25
#6-> WL
26
#7-> BL
27
#8-> HAVP
28
 
29
if [ ${FILTER_ID:7:1} -eq '1' ] #HAVP
30
then 
31
	set="havp"
32
	if [ ${FILTER_ID:0:1} -eq '1' ]
33
	then 
34
		set_proto="proto_1";
35
	fi
36
 
37
	if [ ${FILTER_ID:1:1} -eq '1' ]
38
	then 
39
		set_proto="proto_2";
40
	fi
41
 
42
	if [ ${FILTER_ID:2:1} -eq '1' ]
43
	then 
44
		set_proto="proto_3";
45
	fi
46
 
47
	if [ -z "$set_proto"  ]
48
	then 
49
		set_proto="proto_0";
50
	fi
51
fi
52
 
53
 
54
if [ ${FILTER_ID:6:1} -eq '1' ] #HAVP_BL
55
then 
56
	set="havp_bl"
57
	if [ ${FILTER_ID:0:1} -eq '1' ]
58
	then 
59
		set_proto="proto_1";
60
	fi
61
 
62
	if [ ${FILTER_ID:1:1} -eq '1' ]
63
	then 
64
		set_proto="proto_2";
65
	fi
66
 
67
	if [ ${FILTER_ID:2:1} -eq '1' ]
68
	then 
69
		set_proto="proto_3";
70
	fi
71
 
72
	if [ -z "$set_proto"  ]
73
	then 
74
		set_proto="proto_0";
75
	fi
76
fi
77
 
78
if [ ${FILTER_ID:5:1} -eq '1' ] #HAVP_WL
79
then 
80
	set="havp_wl"
81
	if [ ${FILTER_ID:0:1} -eq '1' ]
82
	then 
83
		set_proto="proto_1";
84
	fi
85
 
86
	if [ ${FILTER_ID:1:1} -eq '1' ]
87
	then 
88
		set_proto="proto_2";
89
	fi
90
 
91
	if [ ${FILTER_ID:2:1} -eq '1' ]
92
	then 
93
		set_proto="proto_3";
94
	fi
95
 
96
	if [ -z "$set_proto"  ]
97
	then 
98
		set_proto="proto_0";
99
	fi
100
fi
101
 
102
 
103
 
104
if [ -z "$set"  ] #NOT_FILTERED
105
then 
106
	set="not_filtered"
107
	if [ ${FILTER_ID:0:1} -eq '1' ]
108
	then 
109
		set_proto="proto_1";
110
	fi
111
 
112
	if [ ${FILTER_ID:1:1} -eq '1' ]
113
	then 
114
		set_proto="proto_2";
115
	fi
116
 
117
	if [ ${FILTER_ID:2:1} -eq '1' ]
118
	then 
119
		set_proto="proto_3";
120
	fi
121
 
122
	if [ -z "$set_proto"  ]
123
	then 
124
		set_proto="proto_0";
125
	fi
126
fi
127
 
128
 
1364 richard 129
ipset add $set $FRAMED_IP_ADDRESS
2006 raphael.pi 130
ipset add $set_proto $FRAMED_IP_ADDRESS