Subversion Repositories ALCASAR

Rev

Rev 612 | Blame | Last modification | View Log

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><!-- written by Rexy -->
<HEAD>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<TITLE>ALCASAR DNS filtering</TITLE>
<link rel="stylesheet" href="/css/style.css" type="text/css">
</HEAD>
<body>
<?
function form_filter ($form_content)
{
// réencodage iso + format unix + rc fin de ligne (ouf...)
        $list = str_replace("\r\n", "\n", utf8_decode($form_content));
        if (strlen($list) != 0){
                if ($list[strlen($list)-1] != "\n") { $list[strlen($list)]="\n";} ;} ;
        return $list;
}
# Choice of language
$Language = 'en';
if(isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])){
  $Langue = explode(",",$_SERVER['HTTP_ACCEPT_LANGUAGE']);
  $Language = strtolower(substr(chop($Langue[0]),0,2)); }
if($Language == 'fr'){
  $l_title1 = "Filtrage de noms de domaine et d'URL";
  $l_error_open_file="Erreur d'ouverture du fichier";
  $l_dnsfilter_on="Le filtrage de noms de domaine et d'URL est actuellement activé";
  $l_dnsfilter_off="Le filtrage de noms de domaine et d'URL est actuellement désactivé";
  $l_switch_filtering_on="Activer le filtrage";
  $l_switch_filtering_off="Désactiver le filtrage";
  $l_main_bl="Liste noire principale";
  $l_bl_version="Version actuelle :";
  $l_bl_categories="Choix des catégories à filtrer";
  $l_download="Télécharger la dernière version";
  $l_warning="<B>Attention</B> : ce téléchargement peut durer plusieurs minutes.";
  $l_secondary_bl="Liste noire et liste blanche secondaires";
  $l_forbidden_dns="Noms de domaine filtrés";
  $l_forbidden_dns_explain="Entrez un nom de domaine par ligne (exemple : .domaine.org)";
  $l_one_dns="Entrez un nom de domaine par ligne (exemple : .domaine.org)";
  $l_rehabilitated_dns="Noms de domaine réhabilités";
  $l_rehabilitated_dns_explain="Entrez ici des noms de domaine bloqués par la liste noire principale <BR> que vous désirez réhabiliter.";
  $l_forbidden_url="URL filtrés";
  $l_forbidden_url_explain="Entrez une URL par ligne (exemple : www.domaine.org/perso/index.htm)";
  $l_rehabilitated_url="URL réhabilités";
  $l_rehabilitated_url_explain="Entrez ici des URL bloquées par la liste noire principale <BR> que vous désirez réhabiliter.";
  $l_one_url="Entrez une URL par ligne (exemple : www.domaine.org/perso/index.htm)";
  $l_record="Enregistrer les modifications";
  $l_wait="Une fois validées, 30 secondes sont nécessaires pour traiter vos modifications";
}
else {
  $l_title1 = "Domain names and URL filtering";
  $l_error_open_file="Error opening the file";
  $l_dnsfilter_on="Actually, the Domain name and URL filter is on";
  $l_dnsfilter_off="Actually, the Domain name and URL filter is off";
  $l_switch_filtering_on="Switch the Filter on";
  $l_switch_filtering_off="Switch the Filter off";
  $l_main_bl="Main blacklist";
  $l_bl_version="Current version : ";
  $l_bl_categories="Choice of filtered categories";
  $l_download="Download the last version";
  $l_warning="<B>Be carefull</B> : this download is estimate to fiew minutes.";
  $l_secondary_bl="Secondary blacklist and whitelist";
  $l_forbidden_dns="Filtered domain names";
  $l_forbidden_dns_explain="Enter one domain name per row (exemple : .domain.org)";
  $l_one_dns="Enter one domain name per row (example : .domain.org)";
  $l_rehabilitated_dns="Rehabilitated domain names";
  $l_rehabilitated_dns_explain="Enter here domain names that are blocked by the main blacklist <BR> and which you want to rehabilitate.";
  $l_forbidden_url="Filtered URL";
  $l_forbidden_url_explain="Enter one URL per row (example : www.domaine.org/perso/index.htm)";
  $l_rehabilitated_url="Rehabilitated URL";
  $l_rehabilitated_url_explain="Enter here URL that are blocked by the main blacklist <BR> and which you want to rehabilitate.";
  $l_one_url="Enter one URL per row (example : www.domaine.org/perso/index.htm)";
  $l_record="Save changes";
  $l_wait="Once validated, 30 seconds is necessary to compute your modifications";
}
$bl_categories="/usr/local/etc/alcasar-bl-categories";
$bl_categories_enabled="/usr/local/etc/alcasar-bl-categories-enabled";
$dir_blacklist="/etc/dansguardian/lists/blacklist/";
$conf_file="/usr/local/etc/alcasar.conf";
if (isset($_POST['choix'])){ $choix=$_POST['choix']; } else { $choix=""; }
switch ($choix)
{
case 'BL_On' :
        exec ("sudo /usr/local/sbin/alcasar-bl.sh --on");
        break;
case 'BL_Off' :
        exec ("sudo /usr/local/sbin/alcasar-bl.sh --off");
        break;
case 'MAJ_bl' :
        exec ("sudo /usr/local/sbin/alcasar-bl.sh --download");
        exec ("sudo /usr/local/sbin/alcasar-bl.sh --reload");
        break;
case 'MAJ_cat' :
        $tab=file($bl_categories_enabled);      
        if ($tab)
                {
                $pointeur=fopen($bl_categories_enabled, "w+");
                foreach ($_POST as $key => $value)
                        {
                        if (strstr($key,'chk-'))
                                {       
                                $line=str_replace('chk-','',$key)."\n";
                                fwrite($pointeur,$line);
                                }
                        }
                fclose($pointeur);
                }
        else {echo "$l_error_open_file $bl_categories_enabled";}
        exec ("sudo /usr/local/sbin/alcasar-bl.sh --reload");
        break;
case 'MAJ_OSSI' :
        $fichier=fopen("/etc/dansguardian/lists/blacklists/ossi/domains","w+");
        fputs($fichier, form_filter($_POST['OSSI_bl_domains']));
        fclose($fichier);
        unset($_POST['OSSI_bl_domains']);
        $fichier=fopen("/etc/dansguardian/lists/exceptionsitelist","w+");
        fputs($fichier, form_filter($_POST['OSSI_wl_domains']));
        fclose($fichier);
        unset($_POST['OSSI_wl_domains']);
        $fichier=fopen("/etc/dansguardian/lists/blacklists/ossi/urls","w+");
        fputs($fichier, form_filter($_POST['OSSI_bl_urls']));
        fclose($fichier);
        unset($_POST['OSSI_bl_urls']);
        $fichier=fopen("/etc/dansguardian/lists/exceptionurllist","w+");
        fputs($fichier, form_filter($_POST['OSSI_wl_urls']));
        fclose($fichier);
        unset($_POST['OSSI_wl_urls']);
        exec ("sudo /usr/local/sbin/alcasar-bl.sh --reload");
        break;
}
?>
</TABLE>
<TABLE width="100%" border=0 cellspacing=0 cellpadding=0>
<tr><th><?php echo "$l_title1"; ?></th></tr>
        <tr bgcolor="#FFCC66"><td><img src="/images/pix.gif" width=1 height=2></td></tr>
</TABLE>
<TABLE width="100%" border=1 cellspacing=0 cellpadding=0>
        <tr><td valign="middle" align="left">
<?php
# default values
if (is_file ($conf_file))
        {
        $tab=file($conf_file);
        if ($tab)
                {
                foreach ($tab as $line)
                        {
                        $field=explode("=", $line);
                        if ($field[0] == "DNS_FILTERING")       {$DNS_FILTERING=trim($field[1]);}
                        }
                }
        }
else { echo "$l_error_open_file $conf_file";}
if ($DNS_FILTERING == "on")
        {
        echo "<CENTER><H3>$l_dnsfilter_on</H3></CENTER>";
        echo "<FORM action='$_SERVER[PHP_SELF]' method=POST>";
        echo "<input type=hidden name='choix' value=\"BL_Off\">";
        echo "<input type=submit value=\"$l_switch_filtering_off\">";
}
else
        {
        echo "<CENTER><H3>$l_dnsfilter_off</H3></CENTER>";
        echo "<FORM action='$_SERVER[PHP_SELF]' method=POST>";
        echo "<input type=hidden name='choix' value=\"BL_On\">";
        echo "<input type=submit value=\"$l_switch_filtering_on\">";
        }
echo "</FORM>";
echo "</td></tr>";
echo "</TABLE>";
if ($DNS_FILTERING == "on") require ('dns_filter2.php');
?>
</BODY>
</HTML>