Subversion Repositories ALCASAR

Rev

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

Rev 878 Rev 879
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>ALCASAR DNS filtering</TITLE>
5
<TITLE>ALCASAR DNS filtering</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
<?
9
<?
10
function form_filter ($form_content)
10
function form_filter ($form_content)
11
{
11
{
12
// réencodage iso + format unix + rc fin de ligne (ouf...)
12
// réencodage iso + format unix + rc fin de ligne (ouf...)
13
	$list = str_replace("\r\n", "\n", utf8_decode($form_content));
13
	$list = str_replace("\r\n", "\n", utf8_decode($form_content));
14
	if (strlen($list) != 0){
14
	if (strlen($list) != 0){
15
		if ($list[strlen($list)-1] != "\n") { $list[strlen($list)]="\n";} ;} ;
15
		if ($list[strlen($list)-1] != "\n") { $list[strlen($list)]="\n";} ;} ;
16
	return $list;
16
	return $list;
17
}
17
}
18
# Choice of language
18
# Choice of language
19
$Language = 'en';
19
$Language = 'en';
20
if(isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])){
20
if(isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])){
21
  $Langue = explode(",",$_SERVER['HTTP_ACCEPT_LANGUAGE']);
21
  $Langue = explode(",",$_SERVER['HTTP_ACCEPT_LANGUAGE']);
22
  $Language = strtolower(substr(chop($Langue[0]),0,2)); }
22
  $Language = strtolower(substr(chop($Langue[0]),0,2)); }
23
if($Language == 'fr'){
23
if($Language == 'fr'){
24
  $l_title1 = "Filtrage de noms de domaine et d'URL";
24
  $l_title1 = "Filtrage de noms de domaine et d'URL";
25
  $l_error_open_file="Erreur d'ouverture du fichier";
25
  $l_error_open_file="Erreur d'ouverture du fichier";
26
  $l_dnsfilter_on="Le filtrage de noms de domaine et d'URL est actuellement activé";
26
  $l_dnsfilter_on="Le filtrage de noms de domaine et d'URL est actuellement activé";
27
  $l_dnsfilter_off="Le filtrage de noms de domaine et d'URL est actuellement désactivé";
27
  $l_dnsfilter_off="Le filtrage de noms de domaine et d'URL est actuellement désactivé";
28
  $l_switch_filtering_on="Activer le filtrage";
28
  $l_switch_filtering_on="Activer le filtrage";
29
  $l_switch_filtering_off="Désactiver le filtrage";
29
  $l_switch_filtering_off="Désactiver le filtrage";
30
  $l_main_bl="Liste noire";
30
  $l_main_bl="Liste noire";
31
  $l_bl_version="Version actuelle :";
31
  $l_bl_version="Version actuelle :";
32
  $l_bl_categories="Choix des catégories à filtrer";
32
  $l_bl_categories="Choix des catégories à filtrer";
33
  $l_download_bl="Télécharger la dernière version";
33
  $l_download_bl="Télécharger la dernière version";
34
  $l_fingerprint="L'empreinte numérique du fichier téléchargé est : ";
34
  $l_fingerprint="L'empreinte numérique du fichier téléchargé est : ";
35
  $l_fingerprint2="Vérifiez-là en suivant ce lien (ligne 'blacklists.tar.gz') : ";
35
  $l_fingerprint2="Vérifiez-là en suivant ce lien (ligne 'blacklists.tar.gz') : ";
36
  $l_activate_bl="Activer cette version";
36
  $l_activate_bl="Activer cette version";
37
  $l_warning="Temps estimé : une minute.";
37
  $l_warning="Temps estimé : une minute.";
38
  $l_specific_filtering="Filtrage special";
38
  $l_specific_filtering="Filtrage special";
39
  $l_forbidden_dns="Noms de domaine filtrés";
39
  $l_forbidden_dns="Noms de domaine filtrés";
40
  $l_forbidden_dns_explain="Entrez un nom de domaine par ligne (exemple : .domaine.org)";
40
  $l_forbidden_dns_explain="Entrez un nom de domaine par ligne (exemple : .domaine.org)";
41
  $l_one_dns="Entrez un nom de domaine par ligne (exemple : .domaine.org)";
41
  $l_one_dns="Entrez un nom de domaine par ligne (exemple : .domaine.org)";
42
  $l_maj_rehabilitated="Noms de domaine ou URLs réhabilités";
42
  $l_maj_rehabilitated="Noms de domaine ou URLs réhabilités";
43
  $l_rehabilitated_dns="Noms de domaine réhabilités";
43
  $l_rehabilitated_dns="Noms de domaine réhabilités";
44
  $l_rehabilitated_dns_explain="Entrez ici des noms de domaine bloqués par la liste noire <BR> que vous souhaitez réhabiliter.";
44
  $l_rehabilitated_dns_explain="Entrez ici des noms de domaine bloqués par la liste noire <BR> que vous souhaitez réhabiliter.";
45
  $l_add_to_bl="Noms de domaine ou URLs ajoutés à la liste noire";
45
  $l_add_to_bl="Noms de domaine ou URLs ajoutés à la liste noire";
46
  $l_forbidden_url="URL filtrés";
46
  $l_forbidden_url="URL filtrés";
47
  $l_forbidden_url_explain="Entrez une URL par ligne (exemple : www.domaine.org/perso/index.htm)";
47
  $l_forbidden_url_explain="Entrez une URL par ligne (exemple : www.domaine.org/perso/index.htm)";
48
  $l_rehabilitated_url="URL réhabilités";
48
  $l_rehabilitated_url="URL réhabilités";
49
  $l_rehabilitated_url_explain="Entrez ici des URL bloquées par la liste noire <BR> que vous souhaitez réhabiliter.";
49
  $l_rehabilitated_url_explain="Entrez ici des URL bloquées par la liste noire <BR> que vous souhaitez réhabiliter.";
50
  $l_one_url="Entrez une URL par ligne (exemple : www.domaine.org/perso/index.htm)";
50
  $l_one_url="Entrez une URL par ligne (exemple : www.domaine.org/perso/index.htm)";
51
  $l_record="Enregistrer les modifications";
51
  $l_record="Enregistrer les modifications";
52
  $l_wait="Une fois validées, 30 secondes sont nécessaires pour traiter vos modifications";
52
  $l_wait="Une fois validées, 30 secondes sont nécessaires pour traiter vos modifications";
53
  $l_ip_filtering="Filtrer les URLs contenant une adresse IP au lien d'un nom de domaine (ex: http://25.56.58.59/index.htm)";
53
  $l_ip_filtering="Filtrer les URLs contenant une adresse IP au lien d'un nom de domaine (ex: http://25.56.58.59/index.htm)";
54
  $l_safe_searching="Activer le contrôle scolaire/parentale pour les moteurs de recherche suivants : google, yahoo, bing, alltheweb, lycos, metacrawler et Youtube."; 
54
  $l_safe_searching="Activer le contrôle scolaire/parentale pour les moteurs de recherche suivants : google, yahoo, bing, alltheweb, lycos, metacrawler et Youtube."; 
55
  $l_safe_youtube="Pour Youtube, créez un ID et entrez le ici : "; 
55
  $l_safe_youtube="Pour Youtube, créez un ID et entrez le ici : "; 
56
}
56
}
57
else {
57
else {
58
  $l_title1 = "Domain names and URL filtering";
58
  $l_title1 = "Domain names and URL filtering";
59
  $l_error_open_file="Error opening the file";
59
  $l_error_open_file="Error opening the file";
60
  $l_dnsfilter_on="Actually, the Domain name and URL filter is on";
60
  $l_dnsfilter_on="Actually, the Domain name and URL filter is on";
61
  $l_dnsfilter_off="Actually, the Domain name and URL filter is off";
61
  $l_dnsfilter_off="Actually, the Domain name and URL filter is off";
62
  $l_switch_filtering_on="Switch the Filter on";
62
  $l_switch_filtering_on="Switch the Filter on";
63
  $l_switch_filtering_off="Switch the Filter off";
63
  $l_switch_filtering_off="Switch the Filter off";
64
  $l_main_bl="Blacklist";
64
  $l_main_bl="Blacklist";
65
  $l_bl_version="Current version : ";
65
  $l_bl_version="Current version : ";
66
  $l_bl_categories="Choice of filtered categories";
66
  $l_bl_categories="Choice of filtered categories";
67
  $l_download_bl="Download the last version";
67
  $l_download_bl="Download the last version";
68
  $l_fingerprint="The digital fingerprint of the downloaded blacklist is : ";
68
  $l_fingerprint="The digital fingerprint of the downloaded blacklist is : ";
69
  $l_fingerprint2="Verify it with this link (line 'blacklists.tar.gz') : ";
69
  $l_fingerprint2="Verify it with this link (line 'blacklists.tar.gz') : ";
70
  $l_activate_bl="Activate this version";
70
  $l_activate_bl="Activate this version";
71
  $l_warning="Estimated time : one minute.";
71
  $l_warning="Estimated time : one minute.";
72
  $l_specific_filtering="Specific filtering";
72
  $l_specific_filtering="Specific filtering";
73
  $l_forbidden_dns="Filtered domain names";
73
  $l_forbidden_dns="Filtered domain names";
74
  $l_forbidden_dns_explain="Enter one domain name per row (exemple : .domain.org)";
74
  $l_forbidden_dns_explain="Enter one domain name per row (exemple : .domain.org)";
75
  $l_one_dns="Enter one domain name per row (example : .domain.org)";
75
  $l_one_dns="Enter one domain name per row (example : .domain.org)";
76
  $l_maj_rehabilitated="Domain names or URLs rehabilitated";
76
  $l_maj_rehabilitated="Domain names or URLs rehabilitated";
77
  $l_rehabilitated_dns="Rehabilitated domain names";
77
  $l_rehabilitated_dns="Rehabilitated domain names";
78
  $l_rehabilitated_dns_explain="Enter here domain names that are blocked by the blacklist <BR> and you want to rehabilitate.";
78
  $l_rehabilitated_dns_explain="Enter here domain names that are blocked by the blacklist <BR> and you want to rehabilitate.";
79
  $l_add_to_bl="Domain names or URLs to add to blacklist";
79
  $l_add_to_bl="Domain names or URLs to add to blacklist";
80
  $l_forbidden_url="Filtered URL";
80
  $l_forbidden_url="Filtered URL";
81
  $l_forbidden_url_explain="Enter one URL per row (example : www.domaine.org/perso/index.htm)";
81
  $l_forbidden_url_explain="Enter one URL per row (example : www.domaine.org/perso/index.htm)";
82
  $l_rehabilitated_url="Rehabilitated URL";
82
  $l_rehabilitated_url="Rehabilitated URL";
83
  $l_rehabilitated_url_explain="Enter here URL that are blocked by the blacklist <BR> and you want to rehabilitate.";
83
  $l_rehabilitated_url_explain="Enter here URL that are blocked by the blacklist <BR> and you want to rehabilitate.";
84
  $l_one_url="Enter one URL per row (example : www.domaine.org/perso/index.htm)";
84
  $l_one_url="Enter one URL per row (example : www.domaine.org/perso/index.htm)";
85
  $l_record="Save changes";
85
  $l_record="Save changes";
86
  $l_wait="Once validated, 30 seconds is necessary to compute your modifications";
86
  $l_wait="Once validated, 30 seconds is necessary to compute your modifications";
87
  $l_ip_filtering="Filtering URLs that contain an IP address instead of a domain name (ie: http://25.56.58.59/index.htm)";
87
  $l_ip_filtering="Filtering URLs that contain an IP address instead of a domain name (ie: http://25.56.58.59/index.htm)";
88
  $l_safe_searching="Enabling school/parental control for the following search engines : google, yahoo, bing, alltheweb, lycos, metacrawler and Youtube."; 
88
  $l_safe_searching="Enabling school/parental control for the following search engines : google, yahoo, bing, alltheweb, lycos, metacrawler and Youtube."; 
89
  $l_safe_youtube="For Youtube, create an ID and write it here : "; 
89
  $l_safe_youtube="For Youtube, create an ID and write it here : "; 
90
}
90
}
91
$bl_categories="/usr/local/etc/alcasar-bl-categories";
91
$bl_categories="/usr/local/etc/alcasar-bl-categories";
92
$bl_categories_enabled="/usr/local/etc/alcasar-bl-categories-enabled";
92
$bl_categories_enabled="/usr/local/etc/alcasar-bl-categories-enabled";
93
$dir_blacklist="/etc/dansguardian/lists/blacklist/";
93
$dir_blacklist="/etc/dansguardian/lists/blacklist/";
94
$conf_file="/usr/local/etc/alcasar.conf";
94
$conf_file="/usr/local/etc/alcasar.conf";
-
 
95
$urlregex_file="/etc/dansguardian/lists/urlregexplist";
-
 
96
$bannedsite_file="/etc/dansguardian/lists/bannedsitelist";
95
if (isset($_POST['choix'])){ $choix=$_POST['choix']; } else { $choix=""; }
97
if (isset($_POST['choix'])){ $choix=$_POST['choix']; } else { $choix=""; }
96
switch ($choix)
98
switch ($choix)
97
{
99
{
98
case 'BL_On' :
100
case 'BL_On' :
99
	exec ("sudo /usr/local/sbin/alcasar-bl.sh --on");
101
	exec ("sudo /usr/local/sbin/alcasar-bl.sh --on");
100
	break;
102
	break;
101
case 'BL_Off' :
103
case 'BL_Off' :
102
	exec ("sudo /usr/local/sbin/alcasar-bl.sh --off");
104
	exec ("sudo /usr/local/sbin/alcasar-bl.sh --off");
103
	break;
105
	break;
104
case 'Download_bl' :
106
case 'Download_bl' :
105
	exec ("sudo /usr/local/sbin/alcasar-bl.sh --download");
107
	exec ("sudo /usr/local/sbin/alcasar-bl.sh --download");
106
	break;
108
	break;
107
case 'Active_bl' :
109
case 'Active_bl' :
108
	exec ("sudo /usr/local/sbin/alcasar-bl.sh --adapt");
110
	exec ("sudo /usr/local/sbin/alcasar-bl.sh --adapt");
109
	exec ("sudo /usr/local/sbin/alcasar-bl.sh --reload");
111
	exec ("sudo /usr/local/sbin/alcasar-bl.sh --reload");
110
	break;
112
	break;
111
case 'MAJ_cat' :
113
case 'MAJ_cat' :
112
	$tab=file($bl_categories_enabled);	
114
	$tab=file($bl_categories_enabled);	
113
	if ($tab)
115
	if ($tab)
114
		{
116
		{
115
		$pointeur=fopen($bl_categories_enabled, "w+");
117
		$pointeur=fopen($bl_categories_enabled, "w+");
116
		foreach ($_POST as $key => $value)
118
		foreach ($_POST as $key => $value)
117
			{
119
			{
118
			if (strstr($key,'chk-'))
120
			if (strstr($key,'chk-'))
119
				{	
121
				{	
120
				$line=str_replace('chk-','',$key)."\n";
122
				$line=str_replace('chk-','',$key)."\n";
121
				fwrite($pointeur,$line);
123
				fwrite($pointeur,$line);
122
				}
124
				}
123
			}
125
			}
124
		fclose($pointeur);
126
		fclose($pointeur);
125
		}
127
		}
126
	else {echo "$l_error_open_file $bl_categories_enabled";}
128
	else {echo "$l_error_open_file $bl_categories_enabled";}
127
	$fichier=fopen("/etc/dansguardian/lists/blacklists/ossi/domains","w+");
129
	$fichier=fopen("/etc/dansguardian/lists/blacklists/ossi/domains","w+");
128
	fputs($fichier, form_filter($_POST['OSSI_bl_domains']));
130
	fputs($fichier, form_filter($_POST['OSSI_bl_domains']));
129
	fclose($fichier);
131
	fclose($fichier);
130
	unset($_POST['OSSI_bl_domains']);
132
	unset($_POST['OSSI_bl_domains']);
131
	$fichier=fopen("/etc/dansguardian/lists/exceptionsitelist","w+");
133
	$fichier=fopen("/etc/dansguardian/lists/exceptionsitelist","w+");
132
	fputs($fichier, form_filter($_POST['OSSI_wl_domains']));
134
	fputs($fichier, form_filter($_POST['OSSI_wl_domains']));
133
	fclose($fichier);
135
	fclose($fichier);
134
	unset($_POST['OSSI_wl_domains']);
136
	unset($_POST['OSSI_wl_domains']);
135
	$fichier=fopen("/etc/dansguardian/lists/blacklists/ossi/urls","w+");
137
	$fichier=fopen("/etc/dansguardian/lists/blacklists/ossi/urls","w+");
136
	fputs($fichier, form_filter($_POST['OSSI_bl_urls']));
138
	fputs($fichier, form_filter($_POST['OSSI_bl_urls']));
137
	fclose($fichier);
139
	fclose($fichier);
138
	unset($_POST['OSSI_bl_urls']);
140
	unset($_POST['OSSI_bl_urls']);
139
	$fichier=fopen("/etc/dansguardian/lists/exceptionurllist","w+");
141
	$fichier=fopen("/etc/dansguardian/lists/exceptionurllist","w+");
140
	fputs($fichier, form_filter($_POST['OSSI_wl_urls']));
142
	fputs($fichier, form_filter($_POST['OSSI_wl_urls']));
141
	fclose($fichier);
143
	fclose($fichier);
142
	unset($_POST['OSSI_wl_urls']);
144
	unset($_POST['OSSI_wl_urls']);
143
	exec ("sudo /usr/local/sbin/alcasar-bl.sh --reload");
145
	exec ("sudo /usr/local/sbin/alcasar-bl.sh --reload");
144
	break;
146
	break;
145
case 'Specific_filtering' :
147
case 'Specific_filtering' :
146
	break;
148
	break;
147
}
149
}
148
?>
150
?>
149
</TABLE>
151
</TABLE>
150
<TABLE width="100%" border=0 cellspacing=0 cellpadding=0>
152
<TABLE width="100%" border=0 cellspacing=0 cellpadding=0>
151
<tr><th><?php echo "$l_title1"; ?></th></tr>
153
<tr><th><?php echo "$l_title1"; ?></th></tr>
152
	<tr bgcolor="#FFCC66"><td><img src="/images/pix.gif" width=1 height=2></td></tr>
154
	<tr bgcolor="#FFCC66"><td><img src="/images/pix.gif" width=1 height=2></td></tr>
153
</TABLE>
155
</TABLE>
154
<TABLE width="100%" border=1 cellspacing=0 cellpadding=0>
156
<TABLE width="100%" border=1 cellspacing=0 cellpadding=0>
155
	<tr><td valign="middle" align="left">
157
	<tr><td valign="middle" align="left">
156
<?php
158
<?php
157
# default values
159
# default values
158
if (is_file ($conf_file))
160
if (is_file ($conf_file))
159
	{
161
	{
160
	$tab=file($conf_file);
162
	$tab=file($conf_file);
161
	if ($tab)
163
	if ($tab)
162
		{
164
		{
163
		foreach ($tab as $line)
165
		foreach ($tab as $line)
164
			{
166
			{
165
			$field=explode("=", $line);
167
			$field=explode("=", $line);
166
			if ($field[0] == "DNS_FILTERING")	{$DNS_FILTERING=trim($field[1]);}
168
			if ($field[0] == "DNS_FILTERING")	{$DNS_FILTERING=trim($field[1]);}
167
			}
169
			}
168
		}
170
		}
169
	}
171
	}
170
else { echo "$l_error_open_file $conf_file";}
172
else { echo "$l_error_open_file $conf_file";}
171
if ($DNS_FILTERING == "on")
173
if ($DNS_FILTERING == "on")
172
	{
174
	{
173
	echo "<CENTER><H3>$l_dnsfilter_on</H3></CENTER>";
175
	echo "<CENTER><H3>$l_dnsfilter_on</H3></CENTER>";
174
 	echo "<FORM action='$_SERVER[PHP_SELF]' method=POST>";
176
 	echo "<FORM action='$_SERVER[PHP_SELF]' method=POST>";
175
	echo "<input type=hidden name='choix' value=\"BL_Off\">";
177
	echo "<input type=hidden name='choix' value=\"BL_Off\">";
176
	echo "<input type=submit value=\"$l_switch_filtering_off\">";
178
	echo "<input type=submit value=\"$l_switch_filtering_off\">";
177
}
179
}
178
else
180
else
179
	{
181
	{
180
	echo "<CENTER><H3>$l_dnsfilter_off</H3></CENTER>";
182
	echo "<CENTER><H3>$l_dnsfilter_off</H3></CENTER>";
181
 	echo "<FORM action='$_SERVER[PHP_SELF]' method=POST>";
183
 	echo "<FORM action='$_SERVER[PHP_SELF]' method=POST>";
182
	echo "<input type=hidden name='choix' value=\"BL_On\">";
184
	echo "<input type=hidden name='choix' value=\"BL_On\">";
183
	echo "<input type=submit value=\"$l_switch_filtering_on\">";
185
	echo "<input type=submit value=\"$l_switch_filtering_on\">";
184
	}
186
	}
185
echo "</FORM>";
187
echo "</FORM>";
186
echo "</td></tr>";
188
echo "</td></tr>";
187
echo "</TABLE>";
189
echo "</TABLE>";
188
if ($DNS_FILTERING == "on") require ('dns_filter2.php');
190
if ($DNS_FILTERING == "on") require ('dns_filter2.php');
189
?>
191
?>
190
</BODY>
192
</BODY>
191
</HTML>
193
</HTML>
192
 
194