Subversion Repositories ALCASAR

Rev

Rev 2088 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log

Rev 2088 Rev 2094
Line 8... Line 8...
8
is_connected=$(echo $chilli_current_mac | cut -d' ' -f5)
8
is_connected=$(echo $chilli_current_mac | cut -d' ' -f5)
9
current_mac=$(echo $chilli_current_mac | cut -d' ' -f1)
9
current_mac=$(echo $chilli_current_mac | cut -d' ' -f1)
10
current_name=$(echo $chilli_current_mac | cut -d' ' -f6)
10
current_name=$(echo $chilli_current_mac | cut -d' ' -f6)
11
current_ip=$(echo $chilli_current_mac | cut -d' ' -f2)
11
current_ip=$(echo $chilli_current_mac | cut -d' ' -f2)
12
 
12
 
-
 
13
 
-
 
14
 
13
if [ $is_connected == "1" ] && [ $current_mac == $current_name ]; then
15
if [ $is_connected == "1" ] && [ $current_mac == $current_name ]; then
-
 
16
	#Lecture du filter-id dans la DB radius afin de placer l'équipement réseau dans le bon ipset
-
 
17
	#Un équipement autorisé "à chaud" sera placé dans l'ipset 'not_filtered' + pas de filtrage de protocole (proto_0)
-
 
18
	PASSWD_FILE="/root/ALCASAR-passwords.txt"
-
 
19
	QUERY="SELECT value from radreply where username='$current_mac'"
-
 
20
	FILTER_ID=$(mysql -D radius -u root -p$(cat $PASSWD_FILE | grep "root /" | rev | cut -d' '  -f1 | rev)<<<"$QUERY" | tail -1)
-
 
21
 
-
 
22
	#Suppression de l'utilisateur de l'ipset not_auth_yet (au cas où)	
14
        ipset add not_filtered $current_ip
23
	ipset del not_auth_yet $current_ip
-
 
24
 
-
 
25
	#Valeur de FILTER-ID : 12345678
-
 
26
	#1-> profile1
-
 
27
	#2-> profile2
-
 
28
	#3-> profile3
-
 
29
	#4-> warn_user (if imputability report has been generated)
-
 
30
	#6-> WL + HAVP
-
 
31
	#7-> BL + HAVP
-
 
32
	#8-> HAVP
-
 
33
 
-
 
34
	
-
 
35
	if [ ${FILTER_ID:7:1} -eq '1' ] #HAVP
-
 
36
	then 
-
 
37
		set="havp"
-
 
38
		if [ ${FILTER_ID:0:1} -eq '1' ]
-
 
39
		then 
-
 
40
			set_proto="proto_1";
-
 
41
		fi
-
 
42
 
-
 
43
		if [ ${FILTER_ID:1:1} -eq '1' ]
-
 
44
		then 
-
 
45
			set_proto="proto_2";
-
 
46
		fi
-
 
47
	
-
 
48
		if [ ${FILTER_ID:2:1} -eq '1' ]
-
 
49
		then 
-
 
50
			set_proto="proto_3";
-
 
51
		fi
-
 
52
 
-
 
53
		if [ -z "$set_proto"  ]
-
 
54
		then 
-
 
55
			set_proto="proto_0";
-
 
56
		fi
-
 
57
	fi
-
 
58
 
-
 
59
 
-
 
60
	if [ ${FILTER_ID:6:1} -eq '1' ] #HAVP_BL
-
 
61
	then 
-
 
62
		set="havp_bl"
-
 
63
		if [ ${FILTER_ID:0:1} -eq '1' ]
-
 
64
		then 
-
 
65
			set_proto="proto_1";
-
 
66
		fi
-
 
67
 
-
 
68
		if [ ${FILTER_ID:1:1} -eq '1' ]
-
 
69
		then 
-
 
70
			set_proto="proto_2";
-
 
71
		fi
-
 
72
	
-
 
73
		if [ ${FILTER_ID:2:1} -eq '1' ]
-
 
74
		then 
-
 
75
			set_proto="proto_3";
-
 
76
		fi
-
 
77
 
-
 
78
		if [ -z "$set_proto"  ]
-
 
79
		then 
-
 
80
			set_proto="proto_0";
-
 
81
		fi
-
 
82
	fi
-
 
83
 
-
 
84
	if [ ${FILTER_ID:5:1} -eq '1' ] #HAVP_WL
-
 
85
	then 
-
 
86
		set="havp_wl"
-
 
87
		if [ ${FILTER_ID:0:1} -eq '1' ]
-
 
88
		then 
-
 
89
			set_proto="proto_1";
-
 
90
		fi
-
 
91
 
-
 
92
		if [ ${FILTER_ID:1:1} -eq '1' ]
-
 
93
		then 
-
 
94
			set_proto="proto_2";
-
 
95
		fi
-
 
96
	
-
 
97
		if [ ${FILTER_ID:2:1} -eq '1' ]
-
 
98
		then 
-
 
99
			set_proto="proto_3";
-
 
100
		fi
-
 
101
 
-
 
102
		if [ -z "$set_proto"  ]
-
 
103
		then 
-
 
104
			set_proto="proto_0";
-
 
105
		fi
-
 
106
	fi
-
 
107
 
-
 
108
 
-
 
109
 
-
 
110
	if [ -z "$set"  ] #NOT_FILTERED
-
 
111
	then 
-
 
112
		set="not_filtered"
-
 
113
		if [ ${FILTER_ID:0:1} -eq '1' ]
-
 
114
		then 
-
 
115
			set_proto="proto_1";
-
 
116
		fi
-
 
117
 
-
 
118
		if [ ${FILTER_ID:1:1} -eq '1' ]
-
 
119
		then 
-
 
120
			set_proto="proto_2";
-
 
121
		fi
-
 
122
	
-
 
123
		if [ ${FILTER_ID:2:1} -eq '1' ]
-
 
124
		then 
-
 
125
			set_proto="proto_3";
-
 
126
		fi
-
 
127
 
-
 
128
		if [ -z "$set_proto"  ]
-
 
129
		then 
-
 
130
			set_proto="proto_0";
-
 
131
		fi
-
 
132
	fi
-
 
133
 
-
 
134
 
-
 
135
	ipset add $set $current_ip
-
 
136
	ipset add $set_proto $current_ip
-
 
137
 
15
fi
138
fi
16
 
139