120 lines
3.1 KiB
PHP
120 lines
3.1 KiB
PHP
|
|
<?php
|
||
|
|
|
||
|
|
# ver. 20120623-01
|
||
|
|
|
||
|
|
|
||
|
|
include_once("./include/cfg-petar.php");
|
||
|
|
include_once("./include/layout.php");
|
||
|
|
include_once("./include/users.php");
|
||
|
|
include_once("./include/cfg-squid.php");
|
||
|
|
|
||
|
|
?>
|
||
|
|
|
||
|
|
|
||
|
|
<!-- ------------------------------------------------------------------------ -->
|
||
|
|
|
||
|
|
<?php require 'include/inc-header.php';?>
|
||
|
|
|
||
|
|
<!-- ------------------------------------------------------------------------ -->
|
||
|
|
|
||
|
|
<?php require 'include/inc-top.php';?>
|
||
|
|
|
||
|
|
<!-- ------------------------------------------------------------------------ -->
|
||
|
|
|
||
|
|
<tr bgcolor=navy align=center>
|
||
|
|
<td colspan=4><font color=yellow><b>SquidGuard Acl</b></font></td>
|
||
|
|
|
||
|
|
|
||
|
|
<?php
|
||
|
|
|
||
|
|
if ($check_pkg_install == true ) {
|
||
|
|
|
||
|
|
$result = shell_exec("pkg_info | grep squidguard ");
|
||
|
|
if ( $result == "" ) {
|
||
|
|
$errore .= "- squidguard non e' installato<br>";
|
||
|
|
}
|
||
|
|
|
||
|
|
$result = shell_exec("grep squidguard /usr/local/etc/squid.conf ");
|
||
|
|
if ( $result == "" ) {
|
||
|
|
$errore .= "- squidguard non e' configurato in squid.conf <br>";
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
if (is_dir($sguard_liste_locali."_autorizzati") !== true){
|
||
|
|
$errore .= "- la directory ".$sguard_liste_locali."_autorizzati e' inesistente <br>";
|
||
|
|
}
|
||
|
|
|
||
|
|
if (is_dir($sguard_liste_locali."_bloccati") !== true){
|
||
|
|
$errore .= "- la directory ".$sguard_liste_locali."_bloccati e' inesistente <br>";
|
||
|
|
}
|
||
|
|
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
if ($errore) {
|
||
|
|
|
||
|
|
echo "<tr><td colspan=4><font color=red><b>Errori rilevati:<br>".$errore."</b></font></td></tr>".
|
||
|
|
"<tr><td colspan=4>questo check puo' essere evitato settando la variabile <b>check_pkg_install=false</b> ".
|
||
|
|
"in <b>include/cfg-squid.php</b></td></tr>";
|
||
|
|
"</table>";
|
||
|
|
|
||
|
|
exit;
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
if ( !$_REQUEST["step"] ){
|
||
|
|
|
||
|
|
|
||
|
|
echo "<FORM NAME=writeme ACTION=".$_SERVER["PHP_SELF"]." METHOD=POST>";
|
||
|
|
|
||
|
|
echo "<tr>".
|
||
|
|
"<td><font color=green>domini abilitati da liste locali:<p>".
|
||
|
|
"<textarea name=sguard_auth rows=20 cols=45>".
|
||
|
|
file_get_contents($sguard_auth_file).
|
||
|
|
"</textarea>".
|
||
|
|
"<td><font color=red>domini bloccati da liste locali:<p>".
|
||
|
|
"<textarea name=sguard_bloc rows=20 cols=45>".
|
||
|
|
file_get_contents($sguard_bloc_file).
|
||
|
|
"</textarea>";
|
||
|
|
|
||
|
|
echo "<tr><font color=green><td align=center colspan=4>".
|
||
|
|
"[ <a href='javascript:document.writeme.submit();'>Riscrivi ACL</a> ]".
|
||
|
|
"<input type=hidden name=step value=2>".
|
||
|
|
"</table><p></FORM>";
|
||
|
|
}
|
||
|
|
|
||
|
|
if ( $_REQUEST["step"] == "2" ){
|
||
|
|
|
||
|
|
|
||
|
|
$handle = fopen($sguard_auth_file, "w");
|
||
|
|
fwrite($handle,$_REQUEST["sguard_auth"]);
|
||
|
|
fclose($handle);
|
||
|
|
|
||
|
|
$handle = fopen($sguard_bloc_file, "w");
|
||
|
|
fwrite($handle,$_REQUEST["sguard_bloc"]);
|
||
|
|
fclose($handle);
|
||
|
|
|
||
|
|
passthru("/usr/local/bin/sudo ".$sync_sguard_prg, $retval);
|
||
|
|
|
||
|
|
if ($retval != "0"){
|
||
|
|
|
||
|
|
echo "<tr><td>Execution exited with status code:".$retval;
|
||
|
|
|
||
|
|
} else {
|
||
|
|
|
||
|
|
echo "<tr><td>Scrittura Completata. Premi <a href=squid-guard.php>qui</a><br>";
|
||
|
|
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
?>
|
||
|
|
|
||
|
|
|
||
|
|
<!-- ------------------------------------------------------------------------ -->
|
||
|
|
|
||
|
|
<?php require 'include/inc-footer.php';?>
|
||
|
|
|
||
|
|
<!-- ------------------------------------------------------------------------ -->
|