318 |
richard |
1 |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
|
|
2 |
<HTML><!-- written by Rexy -->
|
|
|
3 |
<HEAD>
|
|
|
4 |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
|
|
5 |
<TITLE>ALCASAR DNS filtering</TITLE>
|
|
|
6 |
<link rel="stylesheet" href="/css/style.css" type="text/css">
|
|
|
7 |
</HEAD>
|
|
|
8 |
<body>
|
|
|
9 |
<?
|
449 |
richard |
10 |
function form_filter ($form_content)
|
|
|
11 |
{
|
|
|
12 |
// réencodage iso + format unix + rc fin de ligne (ouf...)
|
|
|
13 |
$list = str_replace("\r\n", "\n", utf8_decode($form_content));
|
|
|
14 |
if (strlen($list) != 0){
|
|
|
15 |
if ($list[strlen($list)-1] != "\n") { $list[strlen($list)]="\n";} ;} ;
|
|
|
16 |
return $list;
|
|
|
17 |
}
|
318 |
richard |
18 |
# Choice of language
|
|
|
19 |
$Language = 'en';
|
|
|
20 |
if(isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])){
|
|
|
21 |
$Langue = explode(",",$_SERVER['HTTP_ACCEPT_LANGUAGE']);
|
|
|
22 |
$Language = strtolower(substr(chop($Langue[0]),0,2)); }
|
|
|
23 |
if($Language == 'fr'){
|
1041 |
richard |
24 |
$l_title1="Filtrage de noms de domaine et d'URL";
|
318 |
richard |
25 |
$l_dnsfilter_on="Le filtrage de noms de domaine et d'URL est actuellement activé";
|
|
|
26 |
$l_dnsfilter_off="Le filtrage de noms de domaine et d'URL est actuellement désactivé";
|
|
|
27 |
$l_switch_filtering_on="Activer le filtrage";
|
|
|
28 |
$l_switch_filtering_off="Désactiver le filtrage";
|
1041 |
richard |
29 |
$l_bl="Liste noire";
|
|
|
30 |
$l_wl="Liste blanche";
|
|
|
31 |
$l_list_version="Version de la liste : ";
|
|
|
32 |
$l_bl_categories="Sélectionnez les catégories à filtrer";
|
|
|
33 |
$l_wl_categories="Sélectionnez les catégories à autoriser";
|
878 |
richard |
34 |
$l_download_bl="Télécharger la dernière version";
|
|
|
35 |
$l_fingerprint="L'empreinte numérique du fichier téléchargé est : ";
|
|
|
36 |
$l_fingerprint2="Vérifiez-là en suivant ce lien (ligne 'blacklists.tar.gz') : ";
|
885 |
richard |
37 |
$l_activate_bl="Activer la nouvelle version";
|
|
|
38 |
$l_reject_bl="Rejeter";
|
878 |
richard |
39 |
$l_warning="Temps estimé : une minute.";
|
|
|
40 |
$l_specific_filtering="Filtrage special";
|
318 |
richard |
41 |
$l_forbidden_dns="Noms de domaine filtrés";
|
441 |
franck |
42 |
$l_forbidden_dns_explain="Entrez un nom de domaine par ligne (exemple : .domaine.org)";
|
1041 |
richard |
43 |
$l_allowed_dns="Noms de domaine autorisés";
|
441 |
franck |
44 |
$l_one_dns="Entrez un nom de domaine par ligne (exemple : .domaine.org)";
|
878 |
richard |
45 |
$l_maj_rehabilitated="Noms de domaine ou URLs réhabilités";
|
318 |
richard |
46 |
$l_rehabilitated_dns="Noms de domaine réhabilités";
|
878 |
richard |
47 |
$l_rehabilitated_dns_explain="Entrez ici des noms de domaine bloqués par la liste noire <BR> que vous souhaitez réhabiliter.";
|
|
|
48 |
$l_add_to_bl="Noms de domaine ou URLs ajoutés à la liste noire";
|
1041 |
richard |
49 |
$l_add_to_wl="Noms de domaine ou URLs ajoutés à la liste blanche";
|
318 |
richard |
50 |
$l_forbidden_url="URL filtrés";
|
688 |
richard |
51 |
$l_forbidden_url_explain="Entrez une URL par ligne (exemple : www.domaine.org/perso/index.htm)";
|
1041 |
richard |
52 |
$l_allowed_url="URL authorisés";
|
318 |
richard |
53 |
$l_rehabilitated_url="URL réhabilités";
|
878 |
richard |
54 |
$l_rehabilitated_url_explain="Entrez ici des URL bloquées par la liste noire <BR> que vous souhaitez réhabiliter.";
|
688 |
richard |
55 |
$l_one_url="Entrez une URL par ligne (exemple : www.domaine.org/perso/index.htm)";
|
318 |
richard |
56 |
$l_record="Enregistrer les modifications";
|
601 |
franck |
57 |
$l_wait="Une fois validées, 30 secondes sont nécessaires pour traiter vos modifications";
|
934 |
franck |
58 |
$l_ip_filtering="Filtrer les URLs contenant une adresse IP au lieu d'un nom de domaine (ex: http://25.56.58.59/index.htm)";
|
|
|
59 |
$l_safe_searching="Activer le contrôle scolaire/parental des moteurs de recherche : google, yahoo, bing, metacrawler et Youtube.";
|
885 |
richard |
60 |
$l_safe_youtube="Pour Youtube, entrez votre identifiant ici : ";
|
|
|
61 |
$l_youtube_id="(<a href='http://www.youtube.com/education_signup' target='cat_help' onclick=window.open('http://www.youtube.com/education_signup','cat_help','width=800,height=600,toolbar=no,scrollbars=yes,resizable=yes') title='Youtube for school'>lien pour créer un identifiant Youtube (Id)</a>)";
|
1332 |
richard |
62 |
$l_error_open_file="Erreur d'ouverture du fichier";
|
318 |
richard |
63 |
}
|
|
|
64 |
else {
|
1041 |
richard |
65 |
$l_title1="Domain names and URL filtering";
|
318 |
richard |
66 |
$l_dnsfilter_on="Actually, the Domain name and URL filter is on";
|
|
|
67 |
$l_dnsfilter_off="Actually, the Domain name and URL filter is off";
|
|
|
68 |
$l_switch_filtering_on="Switch the Filter on";
|
|
|
69 |
$l_switch_filtering_off="Switch the Filter off";
|
1041 |
richard |
70 |
$l_bl="BlackList";
|
|
|
71 |
$l_wl="WhiteList";
|
|
|
72 |
$l_list_version="List version : ";
|
|
|
73 |
$l_bl_categories="Select the categories to filter";
|
|
|
74 |
$l_wl_categories="Select the categories to allow";
|
878 |
richard |
75 |
$l_download_bl="Download the last version";
|
|
|
76 |
$l_fingerprint="The digital fingerprint of the downloaded blacklist is : ";
|
|
|
77 |
$l_fingerprint2="Verify it with this link (line 'blacklists.tar.gz') : ";
|
885 |
richard |
78 |
$l_activate_bl="Activate the new version";
|
|
|
79 |
$l_reject_bl="Reject";
|
878 |
richard |
80 |
$l_warning="Estimated time : one minute.";
|
|
|
81 |
$l_specific_filtering="Specific filtering";
|
318 |
richard |
82 |
$l_forbidden_dns="Filtered domain names";
|
441 |
franck |
83 |
$l_forbidden_dns_explain="Enter one domain name per row (exemple : .domain.org)";
|
1041 |
richard |
84 |
$l_allowed_dns="Allowed domain names";
|
441 |
franck |
85 |
$l_one_dns="Enter one domain name per row (example : .domain.org)";
|
878 |
richard |
86 |
$l_maj_rehabilitated="Domain names or URLs rehabilitated";
|
318 |
richard |
87 |
$l_rehabilitated_dns="Rehabilitated domain names";
|
878 |
richard |
88 |
$l_rehabilitated_dns_explain="Enter here domain names that are blocked by the blacklist <BR> and you want to rehabilitate.";
|
|
|
89 |
$l_add_to_bl="Domain names or URLs to add to blacklist";
|
1041 |
richard |
90 |
$l_add_to_wl="Domain names or URLs to add to whitelist";
|
318 |
richard |
91 |
$l_forbidden_url="Filtered URL";
|
441 |
franck |
92 |
$l_forbidden_url_explain="Enter one URL per row (example : www.domaine.org/perso/index.htm)";
|
1041 |
richard |
93 |
$l_allowed_url="Allowed URL";
|
318 |
richard |
94 |
$l_rehabilitated_url="Rehabilitated URL";
|
878 |
richard |
95 |
$l_rehabilitated_url_explain="Enter here URL that are blocked by the blacklist <BR> and you want to rehabilitate.";
|
441 |
franck |
96 |
$l_one_url="Enter one URL per row (example : www.domaine.org/perso/index.htm)";
|
318 |
richard |
97 |
$l_record="Save changes";
|
470 |
richard |
98 |
$l_wait="Once validated, 30 seconds is necessary to compute your modifications";
|
878 |
richard |
99 |
$l_ip_filtering="Filtering URLs that contain an IP address instead of a domain name (ie: http://25.56.58.59/index.htm)";
|
885 |
richard |
100 |
$l_safe_searching="Enabling school/parental control for the search engines google, yahoo, bing, metacrawler and Youtube.";
|
|
|
101 |
$l_safe_youtube="For Youtube, enter your ID here : ";
|
|
|
102 |
$l_youtube_id="(<a href='http://www.youtube.com/education_signup' target='cat_help' onclick=window.open('http://www.youtube.com/education_signup','cat_help','width=800,height=600,toolbar=no,scrollbars=yes,resizable=yes') title='Youtube for school'>link to create a Youtube Id</a>)";
|
1332 |
richard |
103 |
$l_error_open_file="Error opening file";
|
318 |
richard |
104 |
}
|
1041 |
richard |
105 |
$dir_etc="/usr/local/etc/";
|
|
|
106 |
$dir_dg="/etc/dansguardian/lists/";
|
|
|
107 |
$bl_categories=$dir_etc."alcasar-bl-categories";
|
|
|
108 |
$bl_categories_enabled=$dir_etc."alcasar-bl-categories-enabled";
|
|
|
109 |
$wl_categories=$dir_etc."alcasar-wl-categories";
|
|
|
110 |
$wl_categories_enabled=$dir_etc."alcasar-wl-categories-enabled";
|
|
|
111 |
$conf_file=$dir_etc."alcasar.conf";
|
|
|
112 |
$dir_blacklist=$dir_dg."blacklist/";
|
|
|
113 |
$urlregex_file=$dir_dg."urlregexplist";
|
|
|
114 |
$bannedsite_file=$dir_dg."bannedsitelist";
|
885 |
richard |
115 |
$dir_tmp="/tmp/blacklists";
|
|
|
116 |
# default values
|
|
|
117 |
if (is_file ($conf_file))
|
|
|
118 |
{
|
|
|
119 |
$tab=file($conf_file);
|
|
|
120 |
if ($tab)
|
|
|
121 |
{
|
|
|
122 |
foreach ($tab as $line)
|
|
|
123 |
{
|
|
|
124 |
$field=explode("=", $line);
|
|
|
125 |
if ($field[0] == "DNS_FILTERING") {$DNS_FILTERING=trim($field[1]);}
|
|
|
126 |
if ($field[0] == "YOUTUBE_ID") {$YOUTUBE_ID=trim($field[1]);}
|
|
|
127 |
}
|
|
|
128 |
}
|
|
|
129 |
}
|
|
|
130 |
else { echo "$l_error_open_file $conf_file";}
|
318 |
richard |
131 |
if (isset($_POST['choix'])){ $choix=$_POST['choix']; } else { $choix=""; }
|
|
|
132 |
switch ($choix)
|
|
|
133 |
{
|
|
|
134 |
case 'BL_On' :
|
389 |
franck |
135 |
exec ("sudo /usr/local/sbin/alcasar-bl.sh --on");
|
1031 |
richard |
136 |
$DNS_FILTERING="on";
|
318 |
richard |
137 |
break;
|
|
|
138 |
case 'BL_Off' :
|
389 |
franck |
139 |
exec ("sudo /usr/local/sbin/alcasar-bl.sh --off");
|
1031 |
richard |
140 |
$DNS_FILTERING="off";
|
318 |
richard |
141 |
break;
|
1041 |
richard |
142 |
case 'Download_list' :
|
389 |
franck |
143 |
exec ("sudo /usr/local/sbin/alcasar-bl.sh --download");
|
878 |
richard |
144 |
break;
|
1041 |
richard |
145 |
case 'Active_list' :
|
878 |
richard |
146 |
exec ("sudo /usr/local/sbin/alcasar-bl.sh --adapt");
|
389 |
franck |
147 |
exec ("sudo /usr/local/sbin/alcasar-bl.sh --reload");
|
318 |
richard |
148 |
break;
|
1041 |
richard |
149 |
case 'Reject_list' :
|
885 |
richard |
150 |
unlink ("$dir_tmp/blacklists.tar.gz"); unlink ("$dir_tmp/md5sum");
|
|
|
151 |
break;
|
1041 |
richard |
152 |
case 'MAJ_cat_bl' :
|
1332 |
richard |
153 |
$tab=file($bl_categories_enabled);
|
318 |
richard |
154 |
if ($tab)
|
|
|
155 |
{
|
|
|
156 |
$pointeur=fopen($bl_categories_enabled, "w+");
|
|
|
157 |
foreach ($_POST as $key => $value)
|
|
|
158 |
{
|
|
|
159 |
if (strstr($key,'chk-'))
|
|
|
160 |
{
|
|
|
161 |
$line=str_replace('chk-','',$key)."\n";
|
|
|
162 |
fwrite($pointeur,$line);
|
|
|
163 |
}
|
1332 |
richard |
164 |
echo "$key<br/>";
|
318 |
richard |
165 |
}
|
|
|
166 |
fclose($pointeur);
|
|
|
167 |
}
|
|
|
168 |
else {echo "$l_error_open_file $bl_categories_enabled";}
|
1041 |
richard |
169 |
$fichier=fopen($dir_dg."blacklists/ossi/domains","w+");
|
449 |
richard |
170 |
fputs($fichier, form_filter($_POST['OSSI_bl_domains']));
|
318 |
richard |
171 |
fclose($fichier);
|
|
|
172 |
unset($_POST['OSSI_bl_domains']);
|
1041 |
richard |
173 |
$fichier=fopen($dir_dg."exceptionsitelist","w+");
|
|
|
174 |
fputs($fichier, form_filter($_POST['BL_rehabilited_domains']));
|
318 |
richard |
175 |
fclose($fichier);
|
1041 |
richard |
176 |
unset($_POST['BL_rehabilited_domains']);
|
|
|
177 |
$fichier=fopen($dir_dg."blacklists/ossi/urls","w+");
|
449 |
richard |
178 |
fputs($fichier, form_filter($_POST['OSSI_bl_urls']));
|
318 |
richard |
179 |
fclose($fichier);
|
|
|
180 |
unset($_POST['OSSI_bl_urls']);
|
1041 |
richard |
181 |
$fichier=fopen($dir_dg."exceptionurllist","w+");
|
|
|
182 |
fputs($fichier, form_filter($_POST['BL_rehabilited_urls']));
|
|
|
183 |
fclose($fichier);
|
|
|
184 |
unset($_POST['BL_rehabilited_urls']);
|
|
|
185 |
exec ("sudo /usr/local/sbin/alcasar-bl.sh --reload");
|
|
|
186 |
break;
|
|
|
187 |
case 'MAJ_cat_wl' :
|
|
|
188 |
$tab=file($wl_categories_enabled);
|
|
|
189 |
if ($tab)
|
|
|
190 |
{
|
|
|
191 |
$pointeur=fopen($wl_categories_enabled, "w+");
|
|
|
192 |
foreach ($_POST as $key => $value)
|
|
|
193 |
{
|
|
|
194 |
if (strstr($key,'chk-'))
|
|
|
195 |
{
|
|
|
196 |
$line=str_replace('chk-','',$key)."\n";
|
|
|
197 |
fwrite($pointeur,$line);
|
|
|
198 |
}
|
|
|
199 |
}
|
|
|
200 |
fclose($pointeur);
|
|
|
201 |
}
|
|
|
202 |
else {echo "$l_error_open_file $wl_categories_enabled";}
|
|
|
203 |
$fichier=fopen($dir_dg."blacklists/ossi/domains_wl","w+");
|
|
|
204 |
fputs($fichier, form_filter($_POST['OSSI_wl_domains']));
|
|
|
205 |
fclose($fichier);
|
|
|
206 |
unset($_POST['OSSI_wl_domains']);
|
|
|
207 |
$fichier=fopen($dir_dg."blacklists/ossi/urls_wl","w+");
|
449 |
richard |
208 |
fputs($fichier, form_filter($_POST['OSSI_wl_urls']));
|
318 |
richard |
209 |
fclose($fichier);
|
|
|
210 |
unset($_POST['OSSI_wl_urls']);
|
1042 |
richard |
211 |
exec ("sudo /usr/local/sbin/alcasar-bl.sh --reload");
|
318 |
richard |
212 |
break;
|
878 |
richard |
213 |
case 'Specific_filtering' :
|
882 |
richard |
214 |
$pureip="-pureip_off"; $safesearch="-safesearch_off"; ;
|
|
|
215 |
foreach ($_POST as $key => $value)
|
|
|
216 |
{
|
|
|
217 |
if (strstr($key,'chk-ip')) $pureip="-pureip_on";
|
|
|
218 |
if (strstr($key,'chk-safesearch')) $safesearch="-safesearch_on";
|
|
|
219 |
}
|
885 |
richard |
220 |
if ($_POST['Youtube_ID'] == '') { $New_ID="ABCD1234567890abcdef";} // default ID (no action)
|
|
|
221 |
else {$New_ID=$_POST['Youtube_ID'];}
|
|
|
222 |
file_put_contents($conf_file, str_replace("YOUTUBE_ID=$YOUTUBE_ID", "YOUTUBE_ID=$New_ID", file_get_contents($conf_file)));
|
|
|
223 |
$YOUTUBE_ID=$New_ID;
|
|
|
224 |
exec ("sudo /usr/local/sbin/alcasar-url_filter.sh $safesearch $pureip");
|
|
|
225 |
break;
|
318 |
richard |
226 |
}
|
|
|
227 |
?>
|
|
|
228 |
<TABLE width="100%" border=0 cellspacing=0 cellpadding=0>
|
|
|
229 |
<tr><th><?php echo "$l_title1"; ?></th></tr>
|
|
|
230 |
<tr bgcolor="#FFCC66"><td><img src="/images/pix.gif" width=1 height=2></td></tr>
|
|
|
231 |
</TABLE>
|
|
|
232 |
<TABLE width="100%" border=1 cellspacing=0 cellpadding=0>
|
|
|
233 |
<tr><td valign="middle" align="left">
|
|
|
234 |
<?php
|
612 |
richard |
235 |
if ($DNS_FILTERING == "on")
|
318 |
richard |
236 |
{
|
|
|
237 |
echo "<CENTER><H3>$l_dnsfilter_on</H3></CENTER>";
|
|
|
238 |
echo "<FORM action='$_SERVER[PHP_SELF]' method=POST>";
|
|
|
239 |
echo "<input type=hidden name='choix' value=\"BL_Off\">";
|
|
|
240 |
echo "<input type=submit value=\"$l_switch_filtering_off\">";
|
|
|
241 |
}
|
|
|
242 |
else
|
|
|
243 |
{
|
|
|
244 |
echo "<CENTER><H3>$l_dnsfilter_off</H3></CENTER>";
|
|
|
245 |
echo "<FORM action='$_SERVER[PHP_SELF]' method=POST>";
|
|
|
246 |
echo "<input type=hidden name='choix' value=\"BL_On\">";
|
|
|
247 |
echo "<input type=submit value=\"$l_switch_filtering_on\">";
|
|
|
248 |
}
|
|
|
249 |
echo "</FORM>";
|
|
|
250 |
echo "</td></tr>";
|
|
|
251 |
echo "</TABLE>";
|
1015 |
richard |
252 |
if ($DNS_FILTERING == "on") require ('bl_filter2.php');
|
318 |
richard |
253 |
?>
|
|
|
254 |
</BODY>
|
|
|
255 |
</HTML>
|