Subversion Repositories ALCASAR

Rev

Rev 790 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log

Rev 790 Rev 791
1
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
1
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
2
<HTML><!-- written by Rexy -->
2
<HTML><!-- written by Rexy -->
3
<HEAD>
3
<HEAD>
4
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
4
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
5
<TITLE>Network Filter</TITLE>
5
<TITLE>Network Filter</TITLE>
6
<link rel="stylesheet" href="/css/style.css" type="text/css">
6
<link rel="stylesheet" href="/css/style.css" type="text/css">
7
</HEAD>
7
</HEAD>
8
<body>
8
<body>
9
<TABLE width="100%" border=0 cellspacing=0 cellpadding=0>
9
<TABLE width="100%" border=0 cellspacing=0 cellpadding=0>
10
<?
10
<?
11
# Choice of language
11
# Choice of language
12
$Language = 'en';
12
$Language = 'en';
13
if(isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])){
13
if(isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])){
14
  $Langue = explode(",",$_SERVER['HTTP_ACCEPT_LANGUAGE']);
14
  $Langue = explode(",",$_SERVER['HTTP_ACCEPT_LANGUAGE']);
15
  $Language = strtolower(substr(chop($Langue[0]),0,2)); }
15
  $Language = strtolower(substr(chop($Langue[0]),0,2)); }
16
if($Language == 'fr'){
16
if($Language == 'fr'){
17
  $l_title_antivir = "Antivirus de flux WEB";
17
  $l_title_antivir = "Antivirus de flux WEB";
18
  $l_title_proto = "Filtrage de protocoles r&eacute;seau";
-
 
19
  $l_antivir_on="L'antivirus de flux WEB est actuellement activ&eacute;";
18
  $l_antivir_on="L'antivirus de flux WEB est actuellement activ&eacute;";
20
  $l_antivir_off="L'antivirus de flux WEB est actuellement désactiv&eacute;";
19
  $l_antivir_off="L'antivirus de flux WEB est actuellement désactiv&eacute;";
21
  $l_switch_antivir_on="Activer l'antivirus";
20
  $l_switch_antivir_on="Activer l'antivirus";
22
  $l_switch_antivir_off="D&eacute;sactiver l'antivirus";
21
  $l_switch_antivir_off="D&eacute;sactiver l'antivirus";
-
 
22
  $l_title_lan_ext = "Filtrage de l'accès au LAN extérieur";
-
 
23
  $l_lan_ext_on="L'accès au réseau situé entre ALCASAR et le routeur Internet (box) est actuellement autorisé";
-
 
24
  $l_lan_ext_off="L'accès au réseau situé entre ALCASAR et le routeur Internet (box) est actuellement interdit";
-
 
25
  $l_switch_lan_ext_on="Autoriser l'accès";
-
 
26
  $l_switch_lan_ext_off="Interdire l'accès";
-
 
27
  $l_title_proto = "Filtrage de protocoles r&eacute;seau";
23
  $l_netfilter_on="Le filtrage de protocoles r&eacute;seau est actuellement activ&eacute;";
28
  $l_netfilter_on="Le filtrage de protocoles r&eacute;seau est actuellement activ&eacute;";
24
  $l_netfilter_off="Le filtrage de protocoles réseau est actuellement désactiv&eacute";
29
  $l_netfilter_off="Le filtrage de protocoles réseau est actuellement désactiv&eacute";
25
  $l_switch_on="Activer le filtrage";
30
  $l_switch_on="Activer le filtrage";
26
  $l_switch_off="D&eacute;sactiver le filtrage";
31
  $l_switch_off="D&eacute;sactiver le filtrage";
27
  $l_comment_on="&Agrave; l'exclusion du WEB (port 80), les protocoles r&eacute;seau sont interdits.<BR>Choisissez ci-dessous les protocoles que vous autorisez";
32
  $l_comment_on="&Agrave; l'exclusion du WEB (port 80), les protocoles r&eacute;seau sont interdits.<BR>Choisissez ci-dessous les protocoles que vous autorisez";
28
  $l_comment_off="(tous les protocoles réseau sont autoris&eacute;s)";
33
  $l_comment_off="(tous les protocoles réseau sont autoris&eacute;s)";
29
  $l_protocols="Protocoles autoris&eacute;s";
34
  $l_protocols="Protocoles autoris&eacute;s";
30
  $l_error_open_file="Erreur d'ouverture du fichier";
35
  $l_error_open_file="Erreur d'ouverture du fichier";
31
  $l_proto="Protocole";
36
  $l_proto="Protocole";
32
  $l_enabled="Autoris&eacute;";
37
  $l_enabled="Autoris&eacute;";
33
  $l_delete="Supprimer de la liste";
38
  $l_delete="Supprimer de la liste";
34
  $l_add_to_list="Ajouter &agrave; la liste";
39
  $l_add_to_list="Ajouter &agrave; la liste";
35
  $l_save_modif="Enregistrer les modifications";
40
  $l_save_modif="Enregistrer les modifications";
36
}
41
}
37
else {
42
else {
38
  $l_title_antivir = "WEB antivirus";
43
  $l_title_antivir = "WEB antivirus";
39
  $l_title_proto = "Network protocols filter";
-
 
40
  $l_antivir_on="Actually, the WEB antivirus is on";
44
  $l_antivir_on="Actually, the WEB antivirus is on";
41
  $l_antivir_off="Actually, the WEB antivirus is off";
45
  $l_antivir_off="Actually, the WEB antivirus is off";
42
  $l_switch_antivir_on="Switch the antivirus on";
46
  $l_switch_antivir_on="Switch the antivirus on";
43
  $l_switch_antivir_off="Switch the antivirus off";
47
  $l_switch_antivir_off="Switch the antivirus off";
-
 
48
  $l_title_lan_ext = "External LAN access filtering";
-
 
49
  $l_lan_ext_on="The access to the LAN located between ALCASAR and the Internet Gateway (box) is allowed";
-
 
50
  $l_lan_ext_off="The access to the LAN located between ALCASAR and the Internet Gateway (box) is forbidden";
-
 
51
  $l_switch_lan_ext_on="Allow access";
-
 
52
  $l_switch_lan_ext_off="Deny access";
-
 
53
  $l_title_proto = "Network protocols filter";
44
  $l_netfilter_on="Actually, the network protocols filter is enable";
54
  $l_netfilter_on="Actually, the network protocols filter is enable";
45
  $l_netfilter_off="Actually, the network protocols filter is disable";
55
  $l_netfilter_off="Actually, the network protocols filter is disable";
46
  $l_switch_on="Switch the Filter on";
56
  $l_switch_on="Switch the Filter on";
47
  $l_switch_off="Switch the Filter off";
57
  $l_switch_off="Switch the Filter off";
48
  $l_comment_on="(choose the authorized network protocols)";
58
  $l_comment_on="(choose the authorized network protocols)";
49
  $l_comment_off="(all the network protocols are allowed for authenticated users)";
59
  $l_comment_off="(all the network protocols are allowed for authenticated users)";
50
  $l_protocols="Authorize protocols";
60
  $l_protocols="Authorize protocols";
51
  $l_error_open_file="Error opening the file";
61
  $l_error_open_file="Error opening the file";
52
  $l_proto="Protocol";
62
  $l_proto="Protocol";
53
  $l_enabled="Enable";
63
  $l_enabled="Enable";
54
  $l_delete="Delete from list";
64
  $l_delete="Delete from list";
55
  $l_add_to_list="Add to the list";
65
  $l_add_to_list="Add to the list";
56
  $l_save_modif="Save modifications";
66
  $l_save_modif="Save modifications";
57
}
67
}
58
$services_list="/usr/local/etc/alcasar-services";
68
$services_list="/usr/local/etc/alcasar-services";
59
$conf_file="/usr/local/etc/alcasar.conf";
69
$conf_file="/usr/local/etc/alcasar.conf";
60
if (isset($_POST['choix'])){$choix=$_POST['choix'];} else {$choix="";}
70
if (isset($_POST['choix'])){$choix=$_POST['choix'];} else {$choix="";}
61
switch ($choix)
71
switch ($choix)
62
{
72
{
63
case 'AV_On' :
73
case 'AV_On' :
64
	exec ("sudo /usr/local/sbin/alcasar-havp.sh -on");
74
	exec ("sudo /usr/local/sbin/alcasar-havp.sh -on");
65
	break;
75
	break;
66
case 'AV_Off' :
76
case 'AV_Off' :
67
	exec ("sudo /usr/local/sbin/alcasar-havp.sh -off");
77
	exec ("sudo /usr/local/sbin/alcasar-havp.sh -off");
68
	break;
78
	break;
-
 
79
case 'Lan_Ext_Filter_Off' :
-
 
80
	exec ("sudo /usr/local/sbin/alcasar-nf.sh -lan_ext_filter_off");
-
 
81
	break;
-
 
82
case 'Lan_Ext_Filter_On' :
-
 
83
	exec ("sudo /usr/local/sbin/alcasar-nf.sh -lan_ext_filter_on");
-
 
84
	break;
69
case 'NF_On' :
85
case 'NF_On' :
70
	exec ("sudo /usr/local/sbin/alcasar-nf.sh -on");
86
	exec ("sudo /usr/local/sbin/alcasar-nf.sh -on");
71
	break;
87
	break;
72
case 'NF_Off' :
88
case 'NF_Off' :
73
	exec ("sudo /usr/local/sbin/alcasar-nf.sh -off");
89
	exec ("sudo /usr/local/sbin/alcasar-nf.sh -off");
74
	break;
90
	break;
75
case 'new_proto' :
91
case 'new_proto' :
76
	$_POST['add_proto'] = str_replace (CHR(32),"-",$_POST['add_proto']);
92
	$_POST['add_proto'] = str_replace (CHR(32),"-",$_POST['add_proto']);
77
	if ((trim($_POST['add_port']) != "80") and ($_POST['add_port'] != "") and ($_POST['add_proto'] != "") and (is_numeric($_POST['add_port'])))
93
	if ((trim($_POST['add_port']) != "80") and ($_POST['add_port'] != "") and ($_POST['add_proto'] != "") and (is_numeric($_POST['add_port'])))
78
		{
94
		{
79
		$tab=file($services_list);
95
		$tab=file($services_list);
80
		if ($tab)
96
		if ($tab)
81
			{
97
			{
82
			$pointeur=fopen($services_list,"r");
98
			$pointeur=fopen($services_list,"r");
83
			//on teste si le port n'est pas déjà présent
99
			//on teste si le port n'est pas déjà présent
84
			$insert = true;
100
			$insert = true;
85
			foreach ($tab as $ligne)
101
			foreach ($tab as $ligne)
86
				{
102
				{
87
				$proto_f=explode(" ", $ligne);
103
				$proto_f=explode(" ", $ligne);
88
				if (trim($_POST['add_port']) == trim($proto_f[1])) {$insert = false;}
104
				if (trim($_POST['add_port']) == trim($proto_f[1])) {$insert = false;}
89
				}
105
				}
90
			fclose($pointeur);
106
			fclose($pointeur);
91
			if ($insert == true) 
107
			if ($insert == true) 
92
				{
108
				{
93
				$line = "#" . trim($_POST['add_proto']) . " " . trim($_POST['add_port']);
109
				$line = "#" . trim($_POST['add_proto']) . " " . trim($_POST['add_port']);
94
				$pointeur=fopen($services_list,"a");
110
				$pointeur=fopen($services_list,"a");
95
				fwrite ($pointeur, $line);
111
				fwrite ($pointeur, $line);
96
				fclose ($pointeur);
112
				fclose ($pointeur);
97
				exec ("sudo /usr/local/sbin/alcasar-nf.sh -on");
113
				exec ("sudo /usr/local/sbin/alcasar-nf.sh -on");
98
				}
114
				}
99
			}
115
			}
100
		else {echo "$l_error_open_file $services_list";}
116
		else {echo "$l_error_open_file $services_list";}
101
		}
117
		}
102
	break;
118
	break;
103
case 'change' :
119
case 'change' :
104
	$tab=file($services_list);
120
	$tab=file($services_list);
105
	if ($tab)
121
	if ($tab)
106
		{
122
		{
107
//on active|désactive les protocoles
123
//on active|désactive les protocoles
108
		$pointeur=fopen($services_list,"w+");
124
		$pointeur=fopen($services_list,"w+");
109
		foreach ($tab as $ligne)
125
		foreach ($tab as $ligne)
110
			{
126
			{
111
			$proto_f=explode(" ", $ligne);
127
			$proto_f=explode(" ", $ligne);
112
			$name_svc1=trim($proto_f[0],"#");
128
			$name_svc1=trim($proto_f[0],"#");
113
			$actif = False; $remove_line = false;
129
			$actif = False; $remove_line = false;
114
			foreach ($_POST as $key => $value)
130
			foreach ($_POST as $key => $value)
115
				{
131
				{
116
				if (strstr($key,'del-'))
132
				if (strstr($key,'del-'))
117
					{
133
					{
118
					$name_svc2 = str_replace('del-','',$key);
134
					$name_svc2 = str_replace('del-','',$key);
119
					if ($name_svc1 == $name_svc2)
135
					if ($name_svc1 == $name_svc2)
120
				       		{
136
				       		{
121
						$remove_line = True;
137
						$remove_line = True;
122
						break;
138
						break;
123
						}
139
						}
124
					}
140
					}
125
				if (strstr($key,'chk-'))
141
				if (strstr($key,'chk-'))
126
					{
142
					{
127
					$name_svc2 = str_replace('chk-','',$key);
143
					$name_svc2 = str_replace('chk-','',$key);
128
					if ($name_svc1 == $name_svc2)
144
					if ($name_svc1 == $name_svc2)
129
				       		{
145
				       		{
130
						$actif = True;
146
						$actif = True;
131
						break;
147
						break;
132
						}
148
						}
133
					}
149
					}
134
				}
150
				}
135
			if (! $remove_line)
151
			if (! $remove_line)
136
				{
152
				{
137
				if (! $actif) {	$line="#$name_svc1 $proto_f[1]";}
153
				if (! $actif) {	$line="#$name_svc1 $proto_f[1]";}
138
				else { $line="$name_svc1 $proto_f[1]";}
154
				else { $line="$name_svc1 $proto_f[1]";}
139
				fwrite($pointeur,$line);
155
				fwrite($pointeur,$line);
140
				}
156
				}
141
			}
157
			}
142
		fclose($pointeur);
158
		fclose($pointeur);
143
		}
159
		}
144
	else {echo "$l_error_open_file $services_list";}
160
	else {echo "$l_error_open_file $services_list";}
145
	exec ("sudo /usr/local/sbin/alcasar-nf.sh -on");
161
	exec ("sudo /usr/local/sbin/alcasar-nf.sh -on");
146
	break;
162
	break;
147
	}
163
	}
148
# default values
164
# default values
149
if (is_file ($conf_file))
165
if (is_file ($conf_file))
150
	{
166
	{
151
	$tab=file($conf_file);
167
	$tab=file($conf_file);
152
	if ($tab)
168
	if ($tab)
153
		{
169
		{
154
		foreach ($tab as $line)
170
		foreach ($tab as $line)
155
			{
171
			{
156
			$field=explode("=", $line);
172
			$field=explode("=", $line);
157
			if ($field[0] == "PROTOCOLS_FILTERING")	{$PROTOCOLS_FILTERING=trim($field[1]);}
173
			if ($field[0] == "PROTOCOLS_FILTERING")	{$PROTOCOLS_FILTERING=trim($field[1]);}
158
			if ($field[0] == "EXT_LAN_FILTERING")	{$EXT_LAN_FILTERING=trim($field[1]);}
174
			if ($field[0] == "EXT_LAN_FILTERING")	{$EXT_LAN_FILTERING=trim($field[1]);}
159
			if ($field[0] == "WEB_ANTIVIRUS")	{$WEB_ANTIVIRUS=trim($field[1]);}
175
			if ($field[0] == "WEB_ANTIVIRUS")	{$WEB_ANTIVIRUS=trim($field[1]);}
160
			}
176
			}
161
		}
177
		}
162
	}
178
	}
163
else { echo "$l_error_open_file $conf_file";}
179
else { echo "$l_error_open_file $conf_file";}
164
echo "<tr><th>$l_title_antivir</th></tr>";
180
echo "<tr><th>$l_title_antivir</th></tr>";
165
?>
181
?>
166
<tr bgcolor=#FFCC66><td><img src=/images/pix.gif width=1 height=2></td></tr>
182
<tr bgcolor=#FFCC66><td><img src=/images/pix.gif width=1 height=2></td></tr>
167
</TABLE>
183
</TABLE>
168
<TABLE width="100%" border=1 cellspacing=0 cellpadding=0>
184
<TABLE width="100%" border=1 cellspacing=0 cellpadding=0>
169
	<tr><td valign="middle" align="left">
185
	<tr><td valign="middle" align="left">
170
<?php
186
<?php
171
if ($WEB_ANTIVIRUS == "on")
187
if ($WEB_ANTIVIRUS == "on")
172
	{
188
	{
173
	echo "<CENTER><H3>$l_antivir_on</H3></CENTER>";
189
	echo "<CENTER><H3>$l_antivir_on</H3></CENTER>";
174
 	echo "<FORM action='$_SERVER[PHP_SELF]' method=POST>";
190
 	echo "<FORM action='$_SERVER[PHP_SELF]' method=POST>";
175
	echo "<input type=hidden name='choix' value=\"AV_Off\">";
191
	echo "<input type=hidden name='choix' value=\"AV_Off\">";
176
	echo "<input type=submit value=\"$l_switch_antivir_off\">";
192
	echo "<input type=submit value=\"$l_switch_antivir_off\">";
177
}
193
}
178
else
194
else
179
	{
195
	{
180
	echo "<CENTER><H3>$l_antivir_off</H3></CENTER>";
196
	echo "<CENTER><H3>$l_antivir_off</H3></CENTER>";
181
 	echo "<FORM action='$_SERVER[PHP_SELF]' method=POST>";
197
 	echo "<FORM action='$_SERVER[PHP_SELF]' method=POST>";
182
	echo "<input type=hidden name='choix' value=\"AV_On\">";
198
	echo "<input type=hidden name='choix' value=\"AV_On\">";
183
	echo "<input type=submit value=\"$l_switch_antivir_on\">";
199
	echo "<input type=submit value=\"$l_switch_antivir_on\">";
184
	}
200
	}
185
?>
201
?>
186
</FORM>
202
</FORM>
187
</td></tr>
203
</td></tr>
188
</table>
204
</table>
189
<TABLE width="100%" border=0 cellspacing=0 cellpadding=0>
205
<TABLE width="100%" border=0 cellspacing=0 cellpadding=0>
190
<tr><th><?echo "$l_title_proto";?></th></tr>
206
<tr><th><?echo "$l_title_lan_ext";?></th></tr>
191
<tr bgcolor="#FFCC66"><td><img src="/images/pix.gif" width="1" height="2"></td></tr>
207
<tr bgcolor="#FFCC66"><td><img src="/images/pix.gif" width="1" height="2"></td></tr>
192
</table>
208
</table>
193
<TABLE width="100%" border=1 cellspacing=0 cellpadding=0>
209
<TABLE width="100%" border=1 cellspacing=0 cellpadding=0>
194
	<tr><td valign="middle" align="left">
210
	<tr><td valign="middle" align="left">
195
<?php
211
<?php
196
if ($EXT_LAN_FILTERING == "on")
212
if ($EXT_LAN_FILTERING == "on")
197
	{
213
	{
198
	echo "<CENTER><H3>$l_antivir_on</H3></CENTER>";
214
	echo "<CENTER><H3>$l_lan_ext_off</H3></CENTER>";
199
 	echo "<FORM action='$_SERVER[PHP_SELF]' method=POST>";
215
 	echo "<FORM action='$_SERVER[PHP_SELF]' method=POST>";
200
	echo "<input type=hidden name='choix' value=\"AV_Off\">";
216
	echo "<input type=hidden name='choix' value=\"Lan_Ext_Filter_Off\">";
201
	echo "<input type=submit value=\"$l_switch_antivir_off\">";
217
	echo "<input type=submit value=\"$l_switch_lan_ext_on\">";
202
}
218
}
203
else
219
else
204
	{
220
	{
205
	echo "<CENTER><H3>$l_antivir_off</H3></CENTER>";
221
	echo "<CENTER><H3>$l_lan_ext_on</H3></CENTER>";
206
 	echo "<FORM action='$_SERVER[PHP_SELF]' method=POST>";
222
 	echo "<FORM action='$_SERVER[PHP_SELF]' method=POST>";
207
	echo "<input type=hidden name='choix' value=\"AV_On\">";
223
	echo "<input type=hidden name='choix' value=\"Lan_Ext_Filter_On\">";
208
	echo "<input type=submit value=\"$l_switch_antivir_on\">";
224
	echo "<input type=submit value=\"$l_switch_lan_ext_off\">";
209
	}
225
	}
210
?>
226
?>
211
</FORM>
227
</FORM>
212
</td></tr>
228
</td></tr>
213
</table>
229
</table>
214
<TABLE width="100%" border=0 cellspacing=0 cellpadding=0>
230
<TABLE width="100%" border=0 cellspacing=0 cellpadding=0>
215
<tr><th><?echo "$l_title_proto";?></th></tr>
231
<tr><th><?echo "$l_title_proto";?></th></tr>
216
<tr bgcolor="#FFCC66"><td><img src="/images/pix.gif" width="1" height="2"></td></tr>
232
<tr bgcolor="#FFCC66"><td><img src="/images/pix.gif" width="1" height="2"></td></tr>
217
</table>
233
</table>
218
<TABLE width="100%" border=1 cellspacing=0 cellpadding=0>
234
<TABLE width="100%" border=1 cellspacing=0 cellpadding=0>
219
<tr><td valign="middle" align="left">
235
<tr><td valign="middle" align="left">
220
<?
236
<?
221
if ($PROTOCOLS_FILTERING == "on")
237
if ($PROTOCOLS_FILTERING == "on")
222
	{
238
	{
223
	echo "<CENTER><H3>$l_netfilter_on</H3>$l_comment_on</CENTER>";
239
	echo "<CENTER><H3>$l_netfilter_on</H3>$l_comment_on</CENTER>";
224
	echo "<FORM action='$_SERVER[PHP_SELF]' method=POST>";
240
	echo "<FORM action='$_SERVER[PHP_SELF]' method=POST>";
225
	echo "<input type=hidden name='choix' value=\"NF_Off\">";
241
	echo "<input type=hidden name='choix' value=\"NF_Off\">";
226
	echo "<input type=submit value=\"$l_switch_off\">";
242
	echo "<input type=submit value=\"$l_switch_off\">";
227
	}
243
	}
228
else
244
else
229
	{
245
	{
230
	echo "<CENTER><H3>$l_netfilter_off</H3>$l_comment_off</CENTER>";
246
	echo "<CENTER><H3>$l_netfilter_off</H3>$l_comment_off</CENTER>";
231
 	echo "<FORM action='$_SERVER[PHP_SELF]' method=POST>";
247
 	echo "<FORM action='$_SERVER[PHP_SELF]' method=POST>";
232
	echo "<input type=hidden name='choix' value=\"NF_On\">";
248
	echo "<input type=hidden name='choix' value=\"NF_On\">";
233
	echo "<input type=submit value=\"$l_switch_on\">";
249
	echo "<input type=submit value=\"$l_switch_on\">";
234
	}
250
	}
235
echo "</FORM>";
251
echo "</FORM>";
236
echo "</td></tr>";
252
echo "</td></tr>";
237
echo "</TABLE>";
253
echo "</TABLE>";
238
if ($PROTOCOLS_FILTERING == "on") require ('net_filter2.php');
254
if ($PROTOCOLS_FILTERING == "on") require ('net_filter2.php');
239
?>
255
?>
240
</BODY>
256
</BODY>
241
</HTML>
257
</HTML>
242
 
258