Subversion Repositories ALCASAR

Rev

Rev 318 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log

Rev Author Line No. Line
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
<?
10
$bl_categories="/usr/local/etc/alcasar-bl-categories";
11
$bl_categories_enabled="/usr/local/etc/alcasar-bl-categories-enabled";
12
$dir_blacklist="/etc/dansguardian/lists/blacklist/";
13
# Choice of language
14
$Language = 'en';
15
if(isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])){
16
  $Langue = explode(",",$_SERVER['HTTP_ACCEPT_LANGUAGE']);
17
  $Language = strtolower(substr(chop($Langue[0]),0,2)); }
18
if($Language == 'fr'){
19
  $l_title1 = "Filtrage de noms de domaine et d'URL";
20
  $l_error_open_file="Erreur d'ouverture du fichier";
21
  $l_dnsfilter_on="Le filtrage de noms de domaine et d'URL est actuellement activé";
22
  $l_dnsfilter_off="Le filtrage de noms de domaine et d'URL est actuellement désactivé";
23
  $l_switch_filtering_on="Activer le filtrage";
24
  $l_switch_filtering_off="Désactiver le filtrage";
25
  $l_main_bl="Liste noire principale";
26
  $l_bl_version="Version actuelle :";
27
  $l_bl_categories="Choix des catégories à filtrer";
28
  $l_download="Télécharger la dernière version";
29
  $l_warning="<B>Attention</B> : ce téléchargement peut durer plusieurs minutes.";
30
  $l_secondary_bl="Liste noire et liste blanche secondaires";
31
  $l_forbidden_dns="Noms de domaine filtrés";
32
  $l_forbidden_dns_explain="Entrez un nom de domaine par ligne (exemple : domaine.org)";
33
  $l_one_dns="Entrez un nom de domaine par ligne (exemple : domaine.org)";
34
  $l_rehabilitated_dns="Noms de domaine réhabilités";
35
  $l_rehabilitated_dns_explain="Entrez ici des noms de domaine bloqués par la liste noire principale <BR> que vous désirez réhabiliter.";
36
  $l_forbidden_url="URL filtrés";
37
  $l_forbidden_url_explain="Entrez une URL par ligne (exemple : domaine.org/perso.index.htm)";
38
  $l_rehabilitated_url="URL réhabilités";
39
  $l_rehabilitated_url_explain="Entrez ici des URL bloquées par la liste noire principale <BR> que vous désirez réhabiliter.";
40
  $l_one_url="Entrez une URL par ligne (exemple : domaine.org/perso.index.htm)";
41
  $l_record="Enregistrer les modifications";
359 richard 42
  $l_wait="cette modification dure environ 30'";
318 richard 43
}
44
else {
45
  $l_title1 = "Domain names and URL filtering";
46
  $l_error_open_file="Error opening the file";
47
  $l_dnsfilter_on="Actually, the Domain name and URL filter is on";
48
  $l_dnsfilter_off="Actually, the Domain name and URL filter is off";
49
  $l_switch_filtering_on="Switch the Filter on";
50
  $l_switch_filtering_off="Switch the Filter off";
51
  $l_main_bl="Main blacklist";
52
  $l_bl_version="Current version : ";
53
  $l_bl_categories="Choice of filtered categories";
54
  $l_download="Download the last version";
55
  $l_warning="<B>Be carefull</B> : this download is estimate to fiew minutes.";
56
  $l_secondary_bl="Secondary blacklist and whitelist";
57
  $l_forbidden_dns="Filtered domain names";
58
  $l_forbidden_dns_explain="Enter one domain name per row (exemple : domain.org)";
59
  $l_one_dns="Enter one domain name per row (exemple : domain.org)";
60
  $l_rehabilitated_dns="Rehabilitated domain names";
61
  $l_rehabilitated_dns_explain="Enter here domain names that are blocked by the main blacklist <BR> and which you want to rehabilitate.";
62
  $l_forbidden_url="Filtered URL";
63
  $l_forbidden_url_explain="Enter one URL per row (exemple : www.domaine.org/perso/index.htm)";
64
  $l_rehabilitated_url="Rehabilitated URL";
65
  $l_rehabilitated_url_explain="Enter here URL that are blocked by the main blacklist <BR> and which you want to rehabilitate.";
66
  $l_one_url="Enter one URL per row (exemple : www.domaine.org/perso/index.htm)";
67
  $l_record="Save changes";
359 richard 68
  $l_wait="these changes take about 30'";
318 richard 69
}
70
if (isset($_POST['choix'])){ $choix=$_POST['choix']; } else { $choix=""; }
71
switch ($choix)
72
{
73
case 'BL_On' :
74
	exec ("sudo /usr/local/sbin/alcasar-bl.sh -on");
75
	break;
76
case 'BL_Off' :
77
	exec ("sudo /usr/local/sbin/alcasar-bl.sh -off");
78
	break;
79
case 'MAJ_bl' :
80
	exec ("sudo /usr/local/sbin/alcasar-bl.sh -download");
81
	exec ("sudo /usr/local/sbin/alcasar-bl.sh -reload");
82
	break;
83
case 'MAJ_cat' :
84
	$tab=file($bl_categories_enabled);	
85
	if ($tab)
86
		{
87
		$pointeur=fopen($bl_categories_enabled, "w+");
88
		foreach ($_POST as $key => $value)
89
			{
90
			if (strstr($key,'chk-'))
91
				{	
92
				$line=str_replace('chk-','',$key)."\n";
93
				fwrite($pointeur,$line);
94
				}
95
			}
96
		fclose($pointeur);
97
		}
98
	else {echo "$l_error_open_file $bl_categories_enabled";}
99
	exec ("sudo /usr/local/sbin/alcasar-bl.sh -reload");
100
	break;
101
case 'MAJ_OSSI' :
102
	$fichier=fopen("/etc/dansguardian/lists/blacklists/ossi/domains","w+");
103
	fputs($fichier, $_POST['OSSI_bl_domains']);
104
	fclose($fichier);
105
	unset($_POST['OSSI_bl_domains']);
106
	$fichier=fopen("/etc/dansguardian/lists/exceptionsitelist","w+");
107
	fputs($fichier, $_POST['OSSI_wl_domains']);
108
	fclose($fichier);
109
	unset($_POST['OSSI_wl_domains']);
110
	$fichier=fopen("/etc/dansguardian/lists/blacklists/ossi/urls","w+");
111
	fputs($fichier, $_POST['OSSI_bl_urls']);
112
	fclose($fichier);
113
	unset($_POST['OSSI_bl_urls']);
114
	$fichier=fopen("/etc/dansguardian/lists/exceptionurllist","w+");
115
	fputs($fichier, $_POST['OSSI_wl_urls']);
116
	fclose($fichier);
117
	unset($_POST['OSSI_wl_urls']);
118
	exec ("sudo /usr/local/sbin/alcasar-bl.sh -reload");
119
	break;
120
}
121
?>
122
</TABLE>
123
<TABLE width="100%" border=0 cellspacing=0 cellpadding=0>
124
<tr><th><?php echo "$l_title1"; ?></th></tr>
125
	<tr bgcolor="#FFCC66"><td><img src="/images/pix.gif" width=1 height=2></td></tr>
126
</TABLE>
127
<TABLE width="100%" border=1 cellspacing=0 cellpadding=0>
128
	<tr><td valign="middle" align="left">
129
<?php
130
$pointeur = fopen("/etc/dansguardian/dansguardian.conf", "r");
131
$result_filter = false; $out=0;
132
if ($pointeur)
133
	{
134
  	while (!feof($pointeur))
135
		{
136
    		$ligne = fgets($pointeur);
137
    		if (preg_match("/^reportinglevel = 3/", $ligne, $r))
138
			{
139
			$result_filter = true;
140
			$out++;
141
			}
142
		if ($out == 2) break;
143
    		}
144
  	}
145
fclose($pointeur);
146
if ($result_filter)
147
	{
148
	echo "<CENTER><H3>$l_dnsfilter_on</H3></CENTER>";
149
 	echo "<FORM action='$_SERVER[PHP_SELF]' method=POST>";
150
	echo "<input type=hidden name='choix' value=\"BL_Off\">";
151
	echo "<input type=submit value=\"$l_switch_filtering_off\">";
152
}
153
else
154
	{
155
	echo "<CENTER><H3>$l_dnsfilter_off</H3></CENTER>";
156
 	echo "<FORM action='$_SERVER[PHP_SELF]' method=POST>";
157
	echo "<input type=hidden name='choix' value=\"BL_On\">";
158
	echo "<input type=submit value=\"$l_switch_filtering_on\">";
159
	}
160
echo "</FORM>";
161
echo "</td></tr>";
162
echo "</TABLE>";
163
if ($result_filter) require ('dns_filter2.php');
164
?>
165
</BODY>
166
</HTML>