Subversion Repositories ALCASAR

Rev

Rev 364 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log

Rev 364 Rev 372
Line 13... Line 13...
13
$Language = 'en';
13
$Language = 'en';
14
if(isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])){
14
if(isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])){
15
  $Langue = explode(",",$_SERVER['HTTP_ACCEPT_LANGUAGE']);
15
  $Langue = explode(",",$_SERVER['HTTP_ACCEPT_LANGUAGE']);
16
  $Language = strtolower(substr(chop($Langue[0]),0,2)); }
16
  $Language = strtolower(substr(chop($Langue[0]),0,2)); }
17
if($Language == 'fr'){
17
if($Language == 'fr'){
-
 
18
  $l_title_antivir = "Antivirus de flux WEB";
18
  $l_title = "Filtrage de protocoles réacute;seau";
19
  $l_title_proto = "Filtrage de protocoles réseau";
19
  $l_antivir_on="L'antivirus de flux WEB est actuellement activé";
20
  $l_antivir_on="L'antivirus de flux WEB est actuellement activé";
20
  $l_antivir_off="L'antivirus de flux WEB est actuellement désactivé";
21
  $l_antivir_off="L'antivirus de flux WEB est actuellement désactivé";
21
  $l_switch_antivir_on="Activer l'antivirus";
22
  $l_switch_antivir_on="Activer l'antivirus";
22
  $l_switch_antivir_off="Désactiver l'antivirus";
23
  $l_switch_antivir_off="Désactiver l'antivirus";
23
  $l_netfilter_on="Le filtrage réseau est actuellement activé";
24
  $l_netfilter_on="Le filtrage de protocoles réseau est actuellement activé";
24
  $l_netfilter_off="Le filtrage réseau est actuellement désactiv&eacute";
25
  $l_netfilter_off="Le filtrage de protocoles réseau est actuellement désactiv&eacute";
25
  $l_switch_on="Activer le filtrage réseau";
26
  $l_switch_on="Activer le filtrage";
26
  $l_switch_off="Désactiver le filtrage réseau";
27
  $l_switch_off="Dé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";
28
  $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)";
29
  $l_comment_off="(tous les protocoles réseau sont autoris&eacute;s)";
29
  $l_protocols="Protocoles autoris&eacute;s";
30
  $l_protocols="Protocoles autoris&eacute;s";
30
  $l_error_open_file="Erreur d'ouverture du fichier";
31
  $l_error_open_file="Erreur d'ouverture du fichier";
31
  $l_proto="Protocole";
32
  $l_proto="Protocole";
32
  $l_enabled="Autoris&eacute;";
33
  $l_enabled="Autoris&eacute;";
33
  $l_delete="Supprimer de la liste";
34
  $l_delete="Supprimer de la liste";
34
  $l_add_to_list="Ajouter &agrave; la liste";
35
  $l_add_to_list="Ajouter &agrave; la liste";
35
  $l_save_modif="Enregistrer les modifications";
36
  $l_save_modif="Enregistrer les modifications";
-
 
37
  $l_exception_txt="Entrez ici les adresses IP des stations du réseau de consultation ne subissant ce filtrage de protocoles<BR>Entrez une adresse IP par ligne";
36
}
38
}
37
else {
39
else {
-
 
40
  $l_title_antivir = "WEB antivirus";
38
  $l_title = "Network protocols filtering";
41
  $l_title_proto = "Network protocols filter";
39
  $l_antivir_on="Actually, the antivirus is on";
42
  $l_antivir_on="Actually, the WEB antivirus is on";
40
  $l_antivir_off="Actually, the antivirus is off";
43
  $l_antivir_off="Actually, the WEB antivirus is off";
41
  $l_switch_antivir_on="Switch the antivirus on";
44
  $l_switch_antivir_on="Switch the antivirus on";
42
  $l_switch_antivir_off="Switch the antivirus off";
45
  $l_switch_antivir_off="Switch the antivirus off";
43
  $l_netfilter_on="Actually, the network filter is enable";
46
  $l_netfilter_on="Actually, the network protocols filter is enable";
44
  $l_netfilter_off="Actually, the network filter is disable";
47
  $l_netfilter_off="Actually, the network protocols filter is disable";
45
  $l_switch_on="Switch the Network Filter on";
48
  $l_switch_on="Switch the Filter on";
46
  $l_switch_off="Switch the Network Filter off";
49
  $l_switch_off="Switch the Filter off";
47
  $l_comment_on="(choose the authorized network protocols)";
50
  $l_comment_on="(choose the authorized network protocols)";
48
  $l_comment_off="(all the network protocols are allowed for authenticated users)";
51
  $l_comment_off="(all the network protocols are allowed for authenticated users)";
49
  $l_protocols="Authorize protocols";
52
  $l_protocols="Authorize protocols";
50
  $l_error_open_file="Error opening the file";
53
  $l_error_open_file="Error opening the file";
51
  $l_proto="Protocol";
54
  $l_proto="Protocol";
52
  $l_enabled="Enable";
55
  $l_enabled="Enable";
53
  $l_delete="Delete from list";
56
  $l_delete="Delete from list";
54
  $l_add_to_list="Add to the list";
57
  $l_add_to_list="Add to the list";
55
  $l_save_modif="Save modifications";
58
  $l_save_modif="Save modifications";
-
 
59
  $l_exception_txt="Put here the stations IP address that won't be protocols filtered<BR>Put one IP adress per row";
56
}
60
}
57
echo "
61
echo "
58
<tr><th>$l_title</th></tr>
62
<tr><th>$l_title_antivir</th></tr>
59
<tr bgcolor=\"#FFCC66\"><td><img src=\"/images/pix.gif\" width=1 height=2></td></tr>
63
<tr bgcolor=\"#FFCC66\"><td><img src=\"/images/pix.gif\" width=1 height=2></td></tr>
60
</TABLE>";
64
</TABLE>";
61
if (isset($_POST['choix'])){$choix=$_POST['choix'];} else {$choix="";}
65
if (isset($_POST['choix'])){$choix=$_POST['choix'];} else {$choix="";}
62
switch ($choix)
66
switch ($choix)
63
{
67
{
Line 142... Line 146...
142
		fclose($pointeur);
146
		fclose($pointeur);
143
		}
147
		}
144
	else {echo "$l_error_open_file $services_list";}
148
	else {echo "$l_error_open_file $services_list";}
145
	exec ("sudo /usr/local/sbin/alcasar-nf.sh -on");
149
	exec ("sudo /usr/local/sbin/alcasar-nf.sh -on");
146
	break;
150
	break;
-
 
151
case 'IP_exceptions' :
-
 
152
	// réencodage iso + format unix + rc fin de ligne (ouf...)
-
 
153
	$ip_list = str_replace("\r\n", "\n", utf8_decode($_POST['exception_list']));
-
 
154
	if (strlen($ip_list) != 0){
-
 
155
		if ($ip_list[strlen($ip_list)-1] != "\n") { $ip_list[strlen($ip_list)]="\n";} ;} ;
-
 
156
	unset($_POST['exception_list']);
-
 
157
	// écriture exception pour filtrage réseau
-
 
158
	$fichier=fopen("/usr/local/etc/alcasar-filter-exceptions", "w+");
-
 
159
	fputs($fichier, $ip_list);
-
 
160
	fclose($fichier);
-
 
161
	exec ("sudo /usr/local/sbin/alcasar-nf.sh -on");
-
 
162
	break;
147
	}
163
	}
148
?>
164
?>
149
<TABLE width="100%" border=1 cellspacing=0 cellpadding=0>
165
<TABLE width="100%" border=1 cellspacing=0 cellpadding=0>
150
	<tr><td valign="middle" align="left">
166
	<tr><td valign="middle" align="left">
151
<?php
167
<?php
152
$pointeur = fopen("/etc/dansguardian/dansguardian.conf", "r");
168
$pointeur = fopen("/etc/dansguardian/dansguardian.conf", "r");
153
$result_antivir = false; $result_filter = false; $out=0;
169
$antivir_filter = false; $DG_filter = false; $out=0;
154
if ($pointeur)
170
if ($pointeur)
155
	{
171
	{
156
  	while (!feof($pointeur))
172
  	while (!feof($pointeur))
157
		{
173
		{
158
    		$ligne = fgets($pointeur);
174
    		$ligne = fgets($pointeur);
159
    		if (preg_match("/^proxyport = 8090/", $ligne, $r))
175
    		if (preg_match("/^proxyport = 8090/", $ligne, $r))
160
			{
176
			{
161
			$result_antivir = true;
177
			$antivir_filter = true;
162
			$out++;
178
			$out++;
163
			}
179
			}
164
    		if (preg_match("/^reportinglevel = 3/", $ligne, $r))
180
    		if (preg_match("/^reportinglevel = 3/", $ligne, $r)) // non utilisé mais on garde pour l'exemple
165
			{
181
			{
166
			$result_filter = true;
182
			$DG_filter = true;
167
			$out++;
183
			$out++;
168
			}
184
			}
169
		if ($out == 2) break;
185
		if ($out == 2) break;
170
    		}
186
    		}
171
  	}
187
  	}
172
fclose($pointeur);
188
fclose($pointeur);
173
if ($result_antivir)
189
if ($antivir_filter)
174
	{
190
	{
175
	echo "<CENTER><H3>$l_antivir_on</H3></CENTER>";
191
	echo "<CENTER><H3>$l_antivir_on</H3></CENTER>";
176
 	echo "<FORM action='$_SERVER[PHP_SELF]' method=POST>";
192
 	echo "<FORM action='$_SERVER[PHP_SELF]' method=POST>";
177
	echo "<input type=hidden name='choix' value=\"AV_Off\">";
193
	echo "<input type=hidden name='choix' value=\"AV_Off\">";
178
	echo "<input type=submit value=\"$l_switch_antivir_off\">";
194
	echo "<input type=submit value=\"$l_switch_antivir_off\">";
Line 185... Line 201...
185
	echo "<input type=submit value=\"$l_switch_antivir_on\">";
201
	echo "<input type=submit value=\"$l_switch_antivir_on\">";
186
	}
202
	}
187
?>
203
?>
188
</FORM>
204
</FORM>
189
</td></tr>
205
</td></tr>
-
 
206
</table>
-
 
207
<TABLE width="100%" border=0 cellspacing=0 cellpadding=0>
-
 
208
<tr><th><?echo "$l_title_proto";?></th></tr>
-
 
209
<tr bgcolor="#FFCC66"><td><img src="/images/pix.gif" width="1" height="2"></td></tr>
-
 
210
</table>
-
 
211
<TABLE width="100%" border=1 cellspacing=0 cellpadding=0>
190
<tr><td valign="middle" align="left">
212
<tr><td valign="middle" align="left">
191
<?
213
<?
192
$pointeur = fopen("/usr/local/bin/alcasar-iptables.sh", "r");
214
$pointeur = fopen("/usr/local/bin/alcasar-iptables.sh", "r");
193
$result = False ;
215
$result = False ;
194
if ($pointeur)
216
if ($pointeur)