/web/acc/admin/dns_filter.php |
---|
15,10 → 15,6 |
if ($list[strlen($list)-1] != "\n") { $list[strlen($list)]="\n";} ;} ; |
return $list; |
} |
$bl_categories="/usr/local/etc/alcasar-bl-categories"; |
$bl_categories_enabled="/usr/local/etc/alcasar-bl-categories-enabled"; |
$dir_blacklist="/etc/dansguardian/lists/blacklist/"; |
# Choice of language |
$Language = 'en'; |
if(isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])){ |
76,6 → 72,10 |
$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) |
{ |
136,23 → 136,21 |
<TABLE width="100%" border=1 cellspacing=0 cellpadding=0> |
<tr><td valign="middle" align="left"> |
<?php |
$pointeur = fopen("/etc/dansguardian/dansguardian.conf", "r"); |
$result_filter = false; $out=0; |
if ($pointeur) |
# default values |
if (is_file ($conf_file)) |
{ |
while (!feof($pointeur)) |
$tab=file($conf_file); |
if ($tab) |
{ |
$ligne = fgets($pointeur); |
if (preg_match("/^reportinglevel = 3/", $ligne, $r)) |
foreach ($tab as $line) |
{ |
$result_filter = true; |
$out++; |
$field=explode("=", $line); |
if ($field[0] == "DNS_FILTERING") {$DNS_FILTERING=trim($field[1]);} |
} |
if ($out == 2) break; |
} |
} |
fclose($pointeur); |
if ($result_filter) |
} |
} |
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>"; |
169,7 → 167,7 |
echo "</FORM>"; |
echo "</td></tr>"; |
echo "</TABLE>"; |
if ($result_filter) require ('dns_filter2.php'); |
if ($DNS_FILTERING == "on") require ('dns_filter2.php'); |
?> |
</BODY> |
</HTML> |
/web/acc/admin/network.php |
---|
79,7 → 79,7 |
define ("ALCASAR_CHILLI", "/etc/chilli.conf"); |
define ("ALCASAR_ETH0", "/etc/sysconfig/network-scripts/default-ifcfg-eth0"); |
define ("ALCASAR_ETH1", "/etc/sysconfig/network-scripts/ifcfg-eth1"); |
define ("ALCASAR_NETWORK", "/usr/local/etc/alcasar-network"); |
define ("CONF_FILE", "/usr/local/etc/alcasar.conf"); |
/******************************************************************** |
* TEST DES FICHIERS DE CONFIGURATION * |
*********************************************************************/ |
108,12 → 108,12 |
if ($service == "sshd"){ |
if ($action == "start"){ |
exec("sudo /sbin/chkconfig --add $service"); |
file_put_contents(ALCASAR_NETWORK, str_replace('SSH=off', 'SSH=on', file_get_contents(ALCASAR_NETWORK))); |
file_put_contents(CONF_FILE, str_replace('SSH=off', 'SSH=on', file_get_contents(CONF_FILE))); |
exec ("sudo /usr/local/bin/alcasar-iptables.sh"); |
} |
if ($action == "stop"){ |
exec("sudo /sbin/chkconfig --del $service"); |
file_put_contents(ALCASAR_NETWORK, str_replace('SSH=on', 'SSH=off', file_get_contents(ALCASAR_NETWORK))); |
file_put_contents(CONF_FILE, str_replace('SSH=on', 'SSH=off', file_get_contents(CONF_FILE))); |
exec ("sudo /usr/local/bin/alcasar-iptables.sh"); |
} |
} |
/web/acc/admin/net_filter.php |
---|
8,7 → 8,6 |
<body> |
<TABLE width="100%" border=0 cellspacing=0 cellpadding=0> |
<? |
$services_list="/usr/local/etc/alcasar-services"; |
# Choice of language |
$Language = 'en'; |
if(isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])){ |
56,10 → 55,8 |
$l_add_to_list="Add to the list"; |
$l_save_modif="Save modifications"; |
} |
echo " |
<tr><th>$l_title_antivir</th></tr> |
<tr bgcolor=\"#FFCC66\"><td><img src=\"/images/pix.gif\" width=1 height=2></td></tr> |
</TABLE>"; |
$services_list="/usr/local/etc/alcasar-services"; |
$conf_file="/usr/local/etc/alcasar.conf"; |
if (isset($_POST['choix'])){$choix=$_POST['choix'];} else {$choix="";} |
switch ($choix) |
{ |
147,33 → 144,30 |
exec ("sudo /usr/local/sbin/alcasar-nf.sh -on"); |
break; |
} |
# default values |
if (is_file ($conf_file)) |
{ |
$tab=file($conf_file); |
if ($tab) |
{ |
foreach ($tab as $line) |
{ |
$field=explode("=", $line); |
if ($field[0] == "PROTOCOLS_FILTERING") {$PROTOCOLS_FILTERING=trim($field[1]);} |
if ($field[0] == "WEB_ANTIVIRUS") {$WEB_ANTIVIRUS=trim($field[1]);} |
} |
} |
} |
else { echo "$l_error_open_file $conf_file";} |
echo "<tr><th>$l_title_antivir</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 |
$pointeur = fopen("/etc/dansguardian/dansguardian.conf", "r"); |
$antivir_filter = false; $DG_filter = false; $out=0; |
if ($pointeur) |
if ($WEB_ANTIVIRUS == "on") |
{ |
while (!feof($pointeur)) |
{ |
$ligne = fgets($pointeur); |
if (preg_match("/^proxyport = 8090/", $ligne, $r)) |
{ |
$antivir_filter = true; |
$out++; |
} |
if (preg_match("/^reportinglevel = 3/", $ligne, $r)) // non utilisé mais on garde pour l'exemple |
{ |
$DG_filter = true; |
$out++; |
} |
if ($out == 2) break; |
} |
} |
fclose($pointeur); |
if ($antivir_filter) |
{ |
echo "<CENTER><H3>$l_antivir_on</H3></CENTER>"; |
echo "<FORM action='$_SERVER[PHP_SELF]' method=POST>"; |
echo "<input type=hidden name='choix' value=\"AV_Off\">"; |
197,23 → 191,8 |
<TABLE width="100%" border=1 cellspacing=0 cellpadding=0> |
<tr><td valign="middle" align="left"> |
<? |
$pointeur = fopen("/usr/local/bin/alcasar-iptables.sh", "r"); |
$result = False ; |
if ($pointeur) |
if ($PROTOCOLS_FILTERING == "on") |
{ |
while (!feof($pointeur)) |
{ |
$ligne = fgets($pointeur); |
if (preg_match('/^PROTO_FILTERING="yes"/', $ligne, $r)) |
{ |
$result = True ; |
break; |
} |
} |
} |
fclose($pointeur); |
if ($result) |
{ |
echo "<CENTER><H3>$l_netfilter_on</H3>$l_comment_on</CENTER>"; |
echo "<FORM action='$_SERVER[PHP_SELF]' method=POST>"; |
echo "<input type=hidden name='choix' value=\"NF_Off\">"; |
229,7 → 208,7 |
echo "</FORM>"; |
echo "</td></tr>"; |
echo "</TABLE>"; |
if ($result) require ('net_filter2.php'); |
if ($PROTOCOLS_FILTERING == "on") require ('net_filter2.php'); |
?> |
</BODY> |
</HTML> |