Subversion Repositories ALCASAR

Rev

Rev 2662 | Rev 2817 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log

Rev 2662 Rev 2688
Line 74... Line 74...
74
	$l_load="Chargement...";
74
	$l_load="Chargement...";
75
	$l_list_version="Version de la liste : ";
75
	$l_list_version="Version de la liste : ";
76
	$l_wl_categories="Sélectionnez les catégories à autoriser";
76
	$l_wl_categories="Sélectionnez les catégories à autoriser";
77
	$l_specific_filtering="Filtrage special";
77
	$l_specific_filtering="Filtrage special";
78
	$l_add_to_wl="Noms de domaine ou adresses IP à ajouter à la liste blanche";
78
	$l_add_to_wl="Noms de domaine ou adresses IP à ajouter à la liste blanche";
79
	$l_one_dns_ip="Entrez un nom de domaine ou une adresse IP ou une adresse de réseau par ligne<br>exemple (domaine) : .domaine.org - exemple (ip) : 61.54.52.56 - exemple (réseau) : 172.16.0.0/16";
79
	$l_one_dns_ip="Entrez un nom de domaine ou une adresse IP ou une adresse de réseau par ligne<br>exemple (domaine) : domaine.org. - exemple (ip) : 61.54.52.56 - exemple (réseau) : 172.16.0.0/16";
80
	$l_record="Enregistrer les modifications";
80
	$l_record="Enregistrer les modifications";
81
	$l_wait="Une fois validées, 10 secondes sont nécessaires pour traiter vos modifications";
81
	$l_wait="Une fois validées, 10 secondes sont nécessaires pour traiter vos modifications";
82
	$l_safe_searching="Activer le contrôle scolaire/parental pour 'YouTube' et pour les moteurs de recherche 'Google', 'Bing' et 'Qwant'.";
82
	$l_safe_searching="Activer le contrôle scolaire/parental pour 'YouTube' et pour les moteurs de recherche 'Google', 'Bing' et 'Qwant'.";
83
	$l_error_open_file="Erreur d'ouverture du fichier";
83
	$l_error_open_file="Erreur d'ouverture du fichier";
84
	$l_additional_file_title="Fichiers de 'listes blanches' additionnels";
84
	$l_additional_file_title="Fichiers de 'listes blanches' additionnels";
Line 105... Line 105...
105
	$l_list_version="List version : ";
105
	$l_list_version="List version : ";
106
	$l_wl_categories="Select the allowed categories";
106
	$l_wl_categories="Select the allowed categories";
107
	$l_specific_filtering="Specific filtering";
107
	$l_specific_filtering="Specific filtering";
108
	$l_allowed_dns="Allowed domain names";
108
	$l_allowed_dns="Allowed domain names";
109
	$l_add_to_wl="Domain names or IP addresses to add to the whitelist";
109
	$l_add_to_wl="Domain names or IP addresses to add to the whitelist";
110
	$l_one_dns_ip="Enter one domain name or one IP address or one network address per row <br>example (domain): .domain.org - example (ip): 61.54.56.52 - example (network) : 172.16.0.0/16";
110
	$l_one_dns_ip="Enter one domain name or one IP address or one network address per row <br>example (domain): domain.org. - example (ip): 61.54.56.52 - example (network) : 172.16.0.0/16";
111
	$l_record="Save changes";
111
	$l_record="Save changes";
112
	$l_wait="Once validated, 10 seconds are necessary to compute your modifications";
112
	$l_wait="Once validated, 10 seconds are necessary to compute your modifications";
113
	$l_safe_searching="Enabling school/parental control for 'YouTube' and for the search engines 'Google', 'Bing' and 'Qwant'";
113
	$l_safe_searching="Enabling school/parental control for 'YouTube' and for the search engines 'Google', 'Bing' and 'Qwant'";
114
	$l_error_open_file="Error opening file";
114
	$l_error_open_file="Error opening file";
115
	$l_additional_file_title="Additional WhiteList files";
115
	$l_additional_file_title="Additional WhiteList files";
Line 133... Line 133...
133
$dir_etc="/usr/local/etc/";
133
$dir_etc="/usr/local/etc/";
134
$dir_dg="/etc/e2guardian/lists/";
134
$dir_dg="/etc/e2guardian/lists/";
135
$dir_blacklist=$dir_dg."blacklists/";
135
$dir_blacklist=$dir_dg."blacklists/";
136
$dir_wl_ip="/usr/local/share/iptables-wl/";
136
$dir_wl_ip="/usr/local/share/iptables-wl/";
137
$dir_wl_ip_enabled= "/usr/local/share/iptables-wl-enabled/";
137
$dir_wl_ip_enabled= "/usr/local/share/iptables-wl-enabled/";
138
$dir_wl_domain_names= "/usr/local/share/dnsmasq-wl/";
138
$dir_wl_domain_names= "/usr/local/share/unbound-wl/";
139
$dir_wl_domain_names_enabled= "/usr/local/share/dnsmasq-wl-enabled/";
139
$dir_wl_domain_names_enabled= "/usr/local/share/unbound-wl-enabled/";
140
$wl_categories=$dir_etc."alcasar-wl-categories";
140
$wl_categories=$dir_etc."alcasar-wl-categories";
141
$wl_categories_enabled=$dir_etc."alcasar-wl-categories-enabled";
141
$wl_categories_enabled=$dir_etc."alcasar-wl-categories-enabled";
142
$conf_file=$dir_etc."alcasar.conf";
142
$conf_file=$dir_etc."alcasar.conf";
143
$iptables_safesearch_file=$dir_wl_ip_enabled."ossi-ip-safesearch";
143
$domainfilter_file="/etc/unbound/conf.d/whitelist/domainfilter.conf";
144
$bannedsite_file=$dir_dg."bannedsitelist";
144
$bannedsite_file=$dir_dg."bannedsitelist";
145
$dir_tmp="/tmp/blacklists";
145
$dir_tmp="/tmp/blacklists";
146
 
146
 
-
 
147
$wl_safesearch="off";
147
 
148
 
148
# default values
149
# default values
149
if (is_file ($conf_file))
150
if (is_file ($conf_file))
150
	{
151
{
151
	$tab=file($conf_file);
152
	$tab=file($conf_file);
152
	if ($tab)
153
	if ($tab)
153
		{
154
	{
154
		foreach ($tab as $line)
155
		foreach ($tab as $line)
155
			{
156
		{
156
			$field=explode("=", $line);
157
			$field=explode("=", $line);
157
			if ($field[0] == "PRIVATE_IP")
158
			switch ($field[0]) {
158
				{
159
				case 'PRIVATE_IP':
159
				$PRIVATE_IP_MASK=trim($field[1]);
160
					$PRIVATE_IP_MASK=trim($field[1]);
160
				$tmp = explode("/",$PRIVATE_IP_MASK);
161
					$tmp = explode("/",$PRIVATE_IP_MASK);
161
				$PRIVATE_IP=$tmp[0];
162
					$PRIVATE_IP=$tmp[0];
-
 
163
					break;
-
 
164
 
-
 
165
				case 'WL_SAFESEARCH':
-
 
166
					if (strtolower(trim($field[1])) == 'on') {
-
 
167
						$wl_safesearch='on';
-
 
168
					}
-
 
169
					break;
162
				}
170
			}
163
			}
171
		}
164
		}
172
	}
165
	}
173
}
166
else { echo "$l_error_open_file $conf_file";}
174
else { echo "$l_error_open_file $conf_file";}
Line 199... Line 207...
199
	fclose($fichier);
207
		fclose($fichier);
200
	unset($_POST['OSSI_wl']);
208
		unset($_POST['OSSI_wl']);
201
	exec ("sudo /usr/local/bin/alcasar-bl.sh --reload");
209
		exec ("sudo /usr/local/bin/alcasar-bl.sh --reload");
202
	break;
210
		break;
203
case 'Specific_filtering' :
211
	case 'Specific_filtering' :
204
	$safesearch="-safesearch_off"; ;
212
		$wl_safesearch='off';
205
	foreach ($_POST as $key => $value)
213
		foreach ($_POST as $key => $value)
206
	{
214
		{
207
		if (strstr($key,'chk-safesearch')) $safesearch="-safesearch_on";
215
			if (strstr($key,'chk-safesearch')) {
-
 
216
				$wl_safesearch='on';
-
 
217
			}
208
	}
218
		}
209
	exec ("sudo /usr/local/bin/alcasar-url_filter_wl.sh $safesearch");
219
		exec ("sudo /usr/local/bin/alcasar-url_filter_wl.sh -safesearch_$wl_safesearch");
210
	break;
220
		break;
211
case 'MAJ_ossi_file' :
221
	case 'MAJ_ossi_file' :
212
	foreach($_POST as $fichier => $value)
222
		foreach($_POST as $fichier => $value)
213
	{
223
		{
214
		if($fichier != "choix")
224
			if($fichier != "choix")
Line 267... Line 277...
267
<FORM action='wl_filter.php' method=POST>
277
<FORM action='wl_filter.php' method=POST>
268
<input type='hidden' name='choix' value='MAJ_cat_wl'>
278
<input type='hidden' name='choix' value='MAJ_cat_wl'>
269
<?php
279
<?php
270
echo "<center>";
280
echo "<center>";
271
// total number of IP, DNS & URLs
281
// total number of IP, DNS & URLs
272
$nbDomainNames = exec("wc -l /usr/local/share/dnsmasq-wl/* | tail -n 1 | awk '{print $1}'");
282
$nbDomainNames = exec("wc -l $dir_wl_domain_names* | tail -n 1 | awk '{print $1}'");
273
$nbUrl = "0";
283
$nbUrl = "0";
274
$nbIp = exec("wc -l /usr/local/share/iptables-wl/* | tail -n 1 | awk '{print $1}'");
284
$nbIp = exec("wc -l $dir_wl_ip* | tail -n 1 | awk '{print $1}'");
275
echo "<b>$l_nbDomainNames</b> $nbDomainNames, <b>$l_nbUrl</b> $nbUrl, <b>$l_nbIp</b> $nbIp<br/>";
285
echo "<b>$l_nbDomainNames</b> $nbDomainNames, <b>$l_nbUrl</b> $nbUrl, <b>$l_nbIp</b> $nbIp<br/>";
276
echo "$l_wl_categories</center></td></tr>";
286
echo "$l_wl_categories</center></td></tr>";
277
//read & display all WL categories (checked or not)
287
//read & display all WL categories (checked or not)
278
$cols=1;
288
$cols=1;
279
if (file_exists($wl_categories))
289
if (file_exists($wl_categories))
Line 291... Line 301...
291
		else { echo "checked>"; }
301
		else { echo "checked>"; }
292
		echo "</td>";
302
		echo "</td>";
293
		$cols++;
303
		$cols++;
294
		if ($cols > 10) {
304
		if ($cols > 10) {
295
			echo "</tr>";
305
			echo "</tr>";
296
			$cols=1; }
306
			$cols=1;
-
 
307
		}
297
		}
308
	}
298
	}
309
}
299
else	{
310
else {
300
	echo "$l_error_open_file $wl_categories";
311
	echo "$l_error_open_file $wl_categories";
301
}
312
}
Line 348... Line 359...
348
</table>
359
</table>
349
<TABLE width="100%" border=1 cellspacing=0 cellpadding=1>
360
<TABLE width="100%" border=1 cellspacing=0 cellpadding=1>
350
<FORM action='wl_filter.php' method='POST'>
361
<FORM action='wl_filter.php' method='POST'>
351
<input type='hidden' name='choix' value='Specific_filtering'>
362
<input type='hidden' name='choix' value='Specific_filtering'>
352
<tr><td>
363
<tr><td>
353
<input type='checkbox' name='chk-safesearch'
364
<input type='checkbox' name='chk-safesearch' <?= $wl_safesearch == 'on' ? 'checked' : ''; ?>><?= $l_safe_searching; ?>
354
<?php
365
</tr></td>
355
// verify "safesearch" filtering state
-
 
356
if (file_exists($iptables_safesearch_file))
-
 
357
{
-
 
358
	echo " checked";
366
<tr><td>
359
}
-
 
360
echo "> $l_safe_searching<tr><td>";
-
 
361
echo "<input type='submit' onClick=\"this.disabled=true; this.value='$l_load';submit();\" value='$l_record'></td></tr>";
367
<?= "<input type='submit' onClick=\"this.disabled=true; this.value='$l_load';submit();\" value='$l_record'>"; ?>
362
?>
-
 
363
</FORM>
368
</td></tr></FORM>
364
</TABLE>
369
</TABLE>
365
</BODY>
370
</BODY>
366
</HTML>
371
</HTML>