Subversion Repositories ALCASAR

Rev

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

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