Subversion Repositories ALCASAR

Rev

Rev 1867 | Rev 1873 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log

Rev 1867 Rev 1870
Line 130... Line 130...
130
  $l_nb_ip="Nombre d'IP";
130
  $l_nb_ip="Nombre d'IP";
131
  $l_nb_domain_names="Nombre de noms de domaine";
131
  $l_nb_domain_names="Nombre de noms de domaine";
132
  $l_nbDomainNames="Noms de domaine :";
132
  $l_nbDomainNames="Noms de domaine :";
133
  $l_nbUrl="Url :";
133
  $l_nbUrl="Url :";
134
  $l_nbIp="Ip :";
134
  $l_nbIp="Ip :";
-
 
135
  $l_update_cat="Mise a jour des catégories automatiquement?";
-
 
136
  $l_no_update_cat = "désactiver";
-
 
137
  $l_1_update_cat = "toutes les 12 heures";
-
 
138
  $l_2_update_cat = "toutes les semaines";
-
 
139
  $l_3_update_cat = "tous les mois";
135
}
140
}
136
else {
141
else {
137
  $l_bl="BlackList";
142
  $l_bl="BlackList";
138
  $l_load="Loading...";
143
  $l_load="Loading...";
139
  $l_list_version="List version : ";
144
  $l_list_version="List version : ";
Line 176... Line 181...
176
  $l_nb_ip="Number of IP";
181
  $l_nb_ip="Number of IP";
177
  $l_nb_domain_names="Number of domain names";
182
  $l_nb_domain_names="Number of domain names";
178
  $l_nbDomainNames="Domain names :";
183
  $l_nbDomainNames="Domain names :";
179
  $l_nbUrl="Url :";
184
  $l_nbUrl="Url :";
180
  $l_nbIp="Ip :";
185
  $l_nbIp="Ip :";
-
 
186
  $l_update_cat="Mise a jour des catégories automatiquement?";
-
 
187
  $l_no_update_cat = "Disable";
-
 
188
  $l_1_update_cat = "every 12 hours";
-
 
189
  $l_2_update_cat = "every weeks";
-
 
190
  $l_3_update_cat = "every month";
181
}
191
}
182
$dir_etc="/usr/local/etc/";
192
$dir_etc="/usr/local/etc/";
183
$dir_dg="/etc/dansguardian/lists/";
193
$dir_dg="/etc/dansguardian/lists/";
184
$dir_bl_ip="/usr/local/share/iptables-bl/";
194
$dir_bl_ip="/usr/local/share/iptables-bl/";
185
$bl_categories=$dir_etc."alcasar-bl-categories";
195
$bl_categories=$dir_etc."alcasar-bl-categories";
Line 190... Line 200...
190
$bannedsite_file=$dir_dg."bannedsitelist";
200
$bannedsite_file=$dir_dg."bannedsitelist";
191
$dir_tmp="/tmp/blacklists";
201
$dir_tmp="/tmp/blacklists";
192
$upload_dir_ip = "/usr/local/share/iptables-bl-enabled/";
202
$upload_dir_ip = "/usr/local/share/iptables-bl-enabled/";
193
$upload_dir_domain_names = "/usr/local/share/dnsmasq-bl-enabled/";
203
$upload_dir_domain_names = "/usr/local/share/dnsmasq-bl-enabled/";
194
$cron_apache = "/etc/cron.d/alcasar-update-cat";
204
$cron_apache = "/etc/cron.d/alcasar-update-cat";
-
 
205
$update_file_cat="/usr/local/etc/update_cat.conf";
-
 
206
if(isset($_POST['update_cat']))
-
 
207
{
-
 
208
 
-
 
209
	$fichier=fopen($cron_apache,"w+");
-
 
210
	$update_mode = $_POST['update_cat'];
-
 
211
	switch($update_mode){
-
 
212
		case 0:
-
 
213
			fputs($fichier, "#0 update with rsync categories is disabled\n");
-
 
214
			break;
-
 
215
		case 1:
-
 
216
			fputs($fichier, "#1 update with rsync every 12 hours\n");
-
 
217
			fputs($fichier, "0 0-23/12 * * * /usr/local/bin/alcasar-bl.sh --update_cat \n");
-
 
218
			break;
-
 
219
		case 2:
-
 
220
			fputs($fichier, "#2 update with rsync every week (Sunday) at 00:00\n");
-
 
221
			fputs($fichier, "0 0 * * 0 /usr/local/bin/alcasar-bl.sh --update_cat \n");
-
 
222
			break;
-
 
223
		case 3:
-
 
224
			fputs($fichier, "#3 update with rsync every month (1st) at 00:00\n");
-
 
225
			fputs($fichier, "0 0 1 * * /usr/local/bin/alcasar-bl.sh --update_cat \n");
-
 
226
			break;
-
 
227
	}
-
 
228
 
-
 
229
 
-
 
230
	fclose($fichier);
-
 
231
}
-
 
232
 
195
# default values
233
# default values
196
if (is_file ($conf_file))
234
if (is_file ($conf_file))
197
	{
235
	{
198
	$tab=file($conf_file);
236
	$tab=file($conf_file);
199
	if ($tab)
237
	if ($tab)
Line 225... Line 263...
225
	unlink ("$dir_tmp/blacklists.tar.gz"); unlink ("$dir_tmp/md5sum");
263
	unlink ("$dir_tmp/blacklists.tar.gz"); unlink ("$dir_tmp/md5sum");
226
	break;
264
	break;
227
case 'MAJ_cat_bl' :
265
case 'MAJ_cat_bl' :
228
	if (file_exists($bl_categories_enabled))
266
	if (file_exists($bl_categories_enabled))
229
	{
267
	{
230
		$cron_malware = 0;
-
 
231
		$pointeur=fopen($bl_categories_enabled, "w+");
268
		$pointeur=fopen($bl_categories_enabled, "w+");
232
		foreach ($_POST as $key => $value)
269
		foreach ($_POST as $key => $value)
233
			{
270
			{
234
			if (strstr($key,'chk-'))
271
			if (strstr($key,'chk-'))
235
			{	
272
			{	
236
				$line=str_replace('chk-','',$key)."\n";
273
				$line=str_replace('chk-','',$key)."\n";
237
				fwrite($pointeur,$line);
274
				fwrite($pointeur,$line);
238
				if(trim($line) == 'malware')
275
				if(trim($line) == 'malware' && $update_mode > 0)
239
				{
276
				{
240
					$cron_malware = 1;
-
 
241
					$fichier=fopen($cron_apache,"w+");
277
					$fichier=fopen($update_file_cat,"w+");
242
					fputs($fichier, "# update malware categories every 12 hours\n");
-
 
243
					fputs($fichier, "* 0-23/12 * * * /usr/local/bin/alcasar-bl.sh --update-cat malware rsync://ftp.ut-capitole.fr/blacklist/dest/malware\n");
278
					fputs($fichier, "malware rsync://ftp.ut-capitole.fr/blacklist/dest/malware\n");
244
				}
279
				}
245
			}
280
			}
246
			}
281
			}
247
			if(!$cron_malware)
-
 
248
			{
-
 
249
				$fichier=fopen($cron_apache,"w+");
-
 
250
				fputs($fichier, "# malware updates disabled\n");
-
 
251
			}
-
 
252
			
282
			
253
		fclose($pointeur);
283
		fclose($pointeur);
254
		}
284
		}
255
	else {echo "$l_error_open_file $bl_categories_enabled";}
285
	else {echo "$l_error_open_file $bl_categories_enabled";}
256
	$fichier=fopen($dir_dg."blacklists/ossi/domains","w+");
286
	$fichier=fopen($dir_dg."blacklists/ossi/domains","w+");
Line 407... Line 437...
407
		}
437
		}
408
	fclose($pointeur);
438
	fclose($pointeur);
409
	}
439
	}
410
else	{
440
else	{
411
	echo "$l_error_open_file $bl_categories";
441
	echo "$l_error_open_file $bl_categories";
412
	}
442
}
-
 
443
 
-
 
444
#update categories via rsync
-
 
445
$update_select = array();
-
 
446
$update_select[0] = "";
-
 
447
$update_select[1] = "";
-
 
448
$update_select[2] = "";
-
 
449
$update_select[3] = "";
-
 
450
 
-
 
451
$pointeur=fopen($cron_apache,'r');
-
 
452
while (!feof ($pointeur))
-
 
453
{
-
 
454
	$line=fgets($pointeur,1024);
-
 
455
	if(explode(' ',$line)[0] === "#0")
-
 
456
		$update_select[0]="checked";
-
 
457
	if(explode(' ',$line)[0] === "#1")
-
 
458
		$update_select[1]="checked";
-
 
459
	if(explode(' ',$line)[0] === "#2")
-
 
460
		$update_select[2]="checked";
-
 
461
	if(explode(' ',$line)[0] === "#3")
-
 
462
		$update_select[3]="checked";
-
 
463
}
-
 
464
fclose($pointeur);
-
 
465
 
-
 
466
echo "</td></tr>";
-
 
467
echo "<tr><td valign='middle' align='left' colspan=10>";
-
 
468
echo "<center>$l_update_cat 
-
 
469
	<input type='radio' name='update_cat' value=0 $update_select[0]> $l_no_update_cat 
-
 
470
	<input type='radio' name='update_cat' value=1 $update_select[1]> $l_1_update_cat 
-
 
471
	<input type='radio' name='update_cat' value=2 $update_select[2]> $l_2_update_cat 
-
 
472
	<input type='radio' name='update_cat' value=3 $update_select[3]> $l_3_update_cat 
-
 
473
	<input type='submit' value='$l_record'></center>";
413
echo "</td></tr>";
474
echo "</td></tr>";
414
echo "<tr><td valign='middle' align='left' colspan=10>";
475
echo "<tr><td valign='middle' align='left' colspan=10>";
415
echo "<center><b>$l_maj_rehabilitated</b></center></td></tr>";
476
echo "<center><b>$l_maj_rehabilitated</b></center></td></tr>";
416
echo "<tr><td width=50% colspan=5 align=center>";
477
echo "<tr><td width=50% colspan=5 align=center>";
417
echo "<H3>$l_rehabilitated_dns</H3>$l_rehabilitated_dns_explain<BR>$l_one_dns<BR>";
478
echo "<H3>$l_rehabilitated_dns</H3>$l_rehabilitated_dns_explain<BR>$l_one_dns<BR>";
Line 536... Line 597...
536
</FORM> 
597
</FORM> 
537
</TABLE>
598
</TABLE>
538
</BODY>
599
</BODY>
539
</HTML>
600
</HTML>
540
 
601
 
-
 
602