diff options
author | dvserg <dv_serg@mail.ru> | 2011-02-11 07:58:01 +0300 |
---|---|---|
committer | dvserg <dv_serg@mail.ru> | 2011-02-11 07:58:01 +0300 |
commit | c55a0f6a758e7fd13dcee2e3627395fe0a6e3d4f (patch) | |
tree | 80172223e17fbc046e74f9586be32be8851b8f02 /config/squidGuard | |
parent | 339ebaee41cbd13e14d5f02c3adfb30229031ff4 (diff) | |
download | pfsense-packages-c55a0f6a758e7fd13dcee2e3627395fe0a6e3d4f.tar.gz pfsense-packages-c55a0f6a758e7fd13dcee2e3627395fe0a6e3d4f.tar.bz2 pfsense-packages-c55a0f6a758e7fd13dcee2e3627395fe0a6e3d4f.zip |
Blacklist modification and bug fixes
Diffstat (limited to 'config/squidGuard')
-rw-r--r-- | config/squidGuard/squidguard.inc | 20 | ||||
-rw-r--r-- | config/squidGuard/squidguard.php | 109 | ||||
-rw-r--r-- | config/squidGuard/squidguard.xml | 2 | ||||
-rw-r--r-- | config/squidGuard/squidguard_acl.xml | 8 | ||||
-rw-r--r-- | config/squidGuard/squidguard_blacklist.php | 33 | ||||
-rw-r--r-- | config/squidGuard/squidguard_configurator.inc | 24 | ||||
-rw-r--r-- | config/squidGuard/squidguard_default.xml | 6 | ||||
-rw-r--r-- | config/squidGuard/squidguard_dest.xml | 2 | ||||
-rw-r--r-- | config/squidGuard/squidguard_log.php | 8 | ||||
-rw-r--r-- | config/squidGuard/squidguard_log.xml | 2 | ||||
-rw-r--r-- | config/squidGuard/squidguard_rewr.xml | 2 | ||||
-rw-r--r-- | config/squidGuard/squidguard_time.xml | 2 |
12 files changed, 179 insertions, 39 deletions
diff --git a/config/squidGuard/squidguard.inc b/config/squidGuard/squidguard.inc index d4fd5ea3..fe903b39 100644 --- a/config/squidGuard/squidguard.inc +++ b/config/squidGuard/squidguard.inc @@ -1,7 +1,10 @@ <?php # ------------------------------------------------------------------------------ /* squidguard.inc - (C)2006-2011 Serg Dvoriancev + 2006-2011 Serg Dvoriancev + + part of pfSense (www.pfSense.com) + Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: @@ -747,13 +750,13 @@ function make_grid_controls($type, $items, $enable_overtime = true) { $res .= "<table cellspacing='0' width='100%'> $thdr $tbl </table>"; $rstyle = ""; - $ha = "<div $color>" . + $ha = "<div class='listtopic'>" . "<span onClick='document.getElementById(\"destrules\").style.display = \"block\";' style=\"cursor: pointer;\">" . "<font size='-12'><big>Target Rules List (click here)</big> " . - "<img src='./themes/{$g['theme']}/images/icons/icon_pass.gif' title='Show rules'> " . + "<img src='/themes/{$g['theme']}/images/icons/icon_pass.gif' title='Show rules'> " . "</span>" . "<span style=\"cursor: pointer;\">" . - "<img src='./themes/{$g['theme']}/images/icons/icon_block.gif' title='Hide rules' onClick='document.getElementById(\"destrules\").style.display = \"none\";'>" . + "<img src='/themes/{$g['theme']}/images/icons/icon_block.gif' title='Hide rules' onClick='document.getElementById(\"destrules\").style.display = \"none\";'>" . "</span>" . "</div>"; $res = "<hr>$ha<div id=\"destrules\" style='DISPLAY: none'>$res</div>"; @@ -1244,11 +1247,12 @@ function squidguard_adt_safesrch_add($rewrite_item) $rewrite_item[] = array(F_TARGETURL => '(yandex\..*/yandsearch?.*text=.*)', F_REPLACETO => '\1\&fyandex=1', F_MODE => 'i'); # Yahoo - $rewrite_item[] = array(F_TARGETURL => '(search\.yahoo\..*/search.*p=.*)', F_REPLACETO => '\1\&vm=r', F_MODE => 'i'); + $rewrite_item[] = array(F_TARGETURL => '(search\.yahoo\..*/search.*p=.*)', F_REPLACETO => '\1\&vm=r&v=1', F_MODE => 'i'); - # MSN Live search - $rewrite_item[] = array(F_TARGETURL => '(search\.live\..*/.*q=.*)', F_REPLACETO => '\1\&adlt=strict', F_MODE => 'i'); - $rewrite_item[] = array(F_TARGETURL => '(search\.msn\..*/.*q=.*)', F_REPLACETO => '\1\&adlt=strict', F_MODE => 'i'); + # MSN Live search, Bing + $rewrite_item[] = array(F_TARGETURL => '(search\.live\..*/.*q=.*)', F_REPLACETO => '\1\&adlt=strict', F_MODE => 'i'); + $rewrite_item[] = array(F_TARGETURL => '(search\.msn\..*/.*q=.*)', F_REPLACETO => '\1\&adlt=strict', F_MODE => 'i'); + $rewrite_item[] = array(F_TARGETURL => '(\.bing\..*/.*q=.*)', F_REPLACETO => '\1\&adlt=strict', F_MODE => 'i'); return $rewrite_item; } diff --git a/config/squidGuard/squidguard.php b/config/squidGuard/squidguard.php new file mode 100644 index 00000000..b6c36a87 --- /dev/null +++ b/config/squidGuard/squidguard.php @@ -0,0 +1,109 @@ +<?php +/* $Id$ */ +/* + sg_log.inc + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, + INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, + OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. +*/ + +$pgtitle = "Proxy filter SquidGuard"; + +require_once('globals.inc'); +require_once('config.inc'); +require_once("guiconfig.inc"); +require_once('util.inc'); +require_once('pfsense-utils.inc'); +require_once('pkg-utils.inc'); +require_once('service-utils.inc'); + +include("head.inc"); + +if (file_exists("/usr/local/pkg/squidguard.inc")) { + require_once("/usr/local/pkg/squidguard.inc"); +} + +$selfpath = "/squidGuard/squidguard.php"; + +?> + +<!-- HTML --> +<body link="#0000CC" vlink="#0000CC" alink="#0000CC"> +<?php include("fbegin.inc"); ?> +<form action="sg_log.php" method="post"> +<table width="100%" border="0" cellpadding="0" cellspacing="0"> +<!-- Tabs --> + <tr> + <td> +<?php +/* $tab_array = array(); + $tab_array[] = array(gettext("Proxy Filter"), true, "$selfpath"); + $tab_array[] = array(gettext("General settings"), false, "/pkg_edit.php?xml=squidguard.xml&id=0"); + $tab_array[] = array(gettext("Default"), false, "/pkg_edit.php?xml=squidguard_default.xml&id=0"); + $tab_array[] = array(gettext("ACL"), false, "/pkg.php?xml=squidguard_acl.xml"); + $tab_array[] = array(gettext("Destinations"), false, "/pkg.php?xml=squidguard_dest.xml"); + $tab_array[] = array(gettext("Times"), false, "/pkg.php?xml=squidguard_time.xml"); + $tab_array[] = array(gettext("Rewrites"), false, "/pkg.php?xml=squidguard_rewr.xml"); + display_top_tabs($tab_array); +*/ + require_once("/usr/local/www/squidGuard/squidguard_tabs.inc"); + squidguard_tabs_show( 0 ); +?> + </td> + </tr> + <tr> + <td> + <div id="mainarea"> + <table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td> +<table width="100%" border="0" cellpadding="0" cellspacing="0"> +<!-- Service --> + <tr> + <td class="listhdrr">Service</td> + <td class="listhdrr">Status </td> + <td class="listhdrr"> </td> + <td class="listhdrr">Version</td> + </tr> +</table> + + </td> + </tr> + <tr> + <td> + </td> + </tr> + </table> + </div> + </td> + </tr> +</table> +</form> + +<?php include("fend.inc"); ?> + +<script type="text/javascript"> + NiftyCheck(); + Rounded("div#mainarea","bl br","#FFF","#eeeeee","smooth"); +</script> +</body> +</html>
\ No newline at end of file diff --git a/config/squidGuard/squidguard.xml b/config/squidGuard/squidguard.xml index 0616c814..9c979c3d 100644 --- a/config/squidGuard/squidguard.xml +++ b/config/squidGuard/squidguard.xml @@ -27,7 +27,7 @@ <url>/pkg_edit.php?xml=squidguard_default.xml&id=0</url> </tab> <tab> - <text>Special ACL</text> + <text>Groups ACL</text> <url>/pkg.php?xml=squidguard_acl.xml</url> </tab> <tab> diff --git a/config/squidGuard/squidguard_acl.xml b/config/squidGuard/squidguard_acl.xml index ddff1fcb..1b631ca3 100644 --- a/config/squidGuard/squidguard_acl.xml +++ b/config/squidGuard/squidguard_acl.xml @@ -7,7 +7,7 @@ <faq>Currently there are no FAQ items provided.</faq> <name>squidguardacl</name> <version>none</version> - <title>Proxy filter SquidGuard: Special Access Control List (ACL)</title> + <title>Proxy filter SquidGuard: Groups Access Control List (ACL)</title> <include_file>/usr/local/pkg/squidguard.inc</include_file> <delete_string>A proxy server user has been deleted.</delete_string> <addedit_string>A proxy server user has been created/modified.</addedit_string> @@ -21,7 +21,7 @@ <url>/pkg_edit.php?xml=squidguard_default.xml&id=0</url> </tab> <tab> - <text>Special ACL</text> + <text>Groups ACL</text> <url>/pkg.php?xml=squidguard_acl.xml</url> <active/> </tab> @@ -188,11 +188,11 @@ </field> --> <field> - <fielddescr>Spec: Use safe search engine</fielddescr> + <fielddescr>Use SafeSearch engine</fielddescr> <fieldname>safesearch</fieldname> <description> To protect your children from adult content, you can use the protected mode of search engines. - Now it is supported by Google, Yandex, Yahoo, MSN, Live Search. Make sure that the search engines can, and others, it is recommended to prohibit. + Now it is supported by Google, Yandex, Yahoo, MSN, Live Search, Bing. Make sure that the search engines can, and others, it is recommended to prohibit. <br>Note: ! This option overrides 'Rewrite' setting. ! </description> <type>checkbox</type> diff --git a/config/squidGuard/squidguard_blacklist.php b/config/squidGuard/squidguard_blacklist.php index a5f95379..3bf4d17b 100644 --- a/config/squidGuard/squidguard_blacklist.php +++ b/config/squidGuard/squidguard_blacklist.php @@ -1,8 +1,10 @@ <?php /* $Id$ */ /* - sg_log.inc - All rights reserved. + squidguard_blacklist.php + 2006-2011 Serg Dvoriancev + + part of pfSense (www.pfSense.com) Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: @@ -63,7 +65,8 @@ function squidguard_blacklist_AJAX_response( $request ) if ($request['blacklist_download_start']) squidguard_blacklist_update_start( $request['blacklist_url'] ); # update start elseif ($request['blacklist_download_cancel']) squidguard_blacklist_update_cancel(); # update cancel elseif ($request['blacklist_restore_default']) squidguard_blacklist_restore_arcdb(); # restore default db - + elseif ($request['blacklist_clear_log']) squidguard_blacklist_update_clearlog(); # clear log + # Activity # Rebuild progress /check SG rebuild process/ if (is_squidGuardProcess_rebuild_started()) { @@ -92,13 +95,16 @@ function squidguard_blacklist_AJAX_response( $request ) $status = ''; if (file_exists(SGUPD_STATFILE)) { $status = file_get_contents(SGUPD_STATFILE); + if ($sz && $sz != 100) $status .= "Completed {$sz} %"; } if ($status) { $status = str_replace("\n", "\\r\\n", trim($status)); $res .= "el('update_state').innerHTML = '{$status}';"; + $res .= "el('update_state_cls').style.display='';"; $res .= "el('update_state_row').style.display='';"; } else { $res .= "el('update_state').innerHTML = '';"; + $res .= "el('update_state_cls').style.display='none';"; $res .= "el('update_state_row').style.display='none';"; } @@ -147,12 +153,7 @@ function is_squidGuardProcess_rebuild_started() # if cmd more then 132 need use 'ww..' key return exec("ps -auxwwww | grep 'squidGuard -c .* -C all' | grep -v grep | awk '{print $2}' | wc -l | awk '{ print $1 }'"); } -/* -function squidguard_blacklist_update_IsStarted() -{ - return exec("ps auxwwww | grep '" . SCR_NAME_BLKUPDATE . "' | grep -v 'grep' | awk '{print $2}' | wc -l | awk '{ print $1 }'"); -} -*/ + # ------------------------------------------------------------------------------ # HTML Page # ------------------------------------------------------------------------------ @@ -187,6 +188,7 @@ function getactivity(action) { if (action == 'download') pars = pars + '&blacklist_download_start=yes&blacklist_url=' + el('blacklist_url').value; if (action == 'cancel') pars = pars + '&blacklist_download_cancel=yes'; if (action == 'restore_default') pars = pars + '&blacklist_restore_default=yes'; + if (action == 'clear_log') pars = pars + '&blacklist_clear_log=yes'; var myAjax = new Ajax.Request( url, { @@ -244,7 +246,7 @@ window.setTimeout('getactivity()', 150); $tab_array = array(); $tab_array[] = array(gettext("General settings"), false, "/pkg_edit.php?xml=squidguard.xml&id=0"); $tab_array[] = array(gettext("Common ACL"), false, "/pkg_edit.php?xml=squidguard_default.xml&id=0"); - $tab_array[] = array(gettext("Special ACL"), false, "/pkg.php?xml=squidguard_acl.xml"); + $tab_array[] = array(gettext("Groups ACL"), false, "/pkg.php?xml=squidguard_acl.xml"); $tab_array[] = array(gettext("Target categories"),false, "/pkg.php?xml=squidguard_dest.xml"); $tab_array[] = array(gettext("Times"), false, "/pkg.php?xml=squidguard_time.xml"); $tab_array[] = array(gettext("Rewrites"), false, "/pkg.php?xml=squidguard_rewr.xml"); @@ -274,7 +276,7 @@ window.setTimeout('getactivity()', 150); echo " <u id='progress_text' name='progress_text'>0 %</u>"; echo "</nobr>"; echo "<br><br>"; - ?> +?> <nobr> <input class="formfld unknown" size="70" id="blacklist_url" name="blacklist_url" value= '<?php echo "$blacklist_url"; ?>' >   <!--input size='70' id='blacklist_download_start' name='blacklist_download_start' value='Download' type='button' onclick="getactivity('download');">  @@ -289,6 +291,15 @@ window.setTimeout('getactivity()', 150); <br><br> </td> </tr> + <tr id='update_state_cls' name='update_state_cls' style='display:none;'> + <td> </td> + <td> + <span style="cursor: pointer;"> + <img src=<?php echo "'/themes/{$g['theme']}/images/icons/icon_block.gif'" ?> onClick="getactivity('clear_log');" title='Clear Log and Close'> + </span> + <big><b>Blacklist update Log</b></big> + </td> + </tr> <tr id='update_state_row' name='update_state_row' style='display:none;'> <td> </td> <td> diff --git a/config/squidGuard/squidguard_configurator.inc b/config/squidGuard/squidguard_configurator.inc index c57728e4..5315d508 100644 --- a/config/squidGuard/squidguard_configurator.inc +++ b/config/squidGuard/squidguard_configurator.inc @@ -1,7 +1,10 @@ <?php # ------------------------------------------------------------------------------ /* squidguard_configurator.inc - (C)2006-2011 Serg Dvoriancev + 2006-2011 Serg Dvoriancev + + part of pfSense (www.pfSense.com) + Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: @@ -1857,7 +1860,8 @@ function sg_script_logrotate() # # This file generated automaticly with SquidGuard configurator rm -f {$sglogname}.0 -mv -f {$sglogname} {$sglogname}.0 +cp -f {$sglogname} {$sglogname}.0 +echo '' > {$sglogname} EOD; return $res; } @@ -1989,7 +1993,7 @@ function squidguard_blacklist_update_start($url_filename) } # ----------------------------------------------------------------------------- -# squidguard_blacklist_update_cancel() +# squidguard_blacklist_update_cancel # ----------------------------------------------------------------------------- function squidguard_blacklist_update_cancel() { @@ -2002,6 +2006,15 @@ function squidguard_blacklist_update_cancel() } # ----------------------------------------------------------------------------- +# squidguard_blacklist_update_clearlog +# ----------------------------------------------------------------------------- +function squidguard_blacklist_update_clearlog() +{ + # zero file + file_put_contents(SG_UPDATE_STATFILE, ""); +} + +# ----------------------------------------------------------------------------- # squidguard_blacklist_update_IsStarted() # ----------------------------------------------------------------------------- function squidguard_blacklist_update_IsStarted() @@ -2089,8 +2102,8 @@ function sg_update_blacklist($from_file) if (file_exists($squidguard_config[F_WORKDIR])) $workdir = $squidguard_config[F_WORKDIR]; # delete old tmp dir's - if (file_exists($tmp_unpack_dir)) mwexec("rm -R . $tmp_unpack_dir"); - if (file_exists($arc_db_dir)) mwexec("rm -R . $arc_db_dir"); + if (file_exists($tmp_unpack_dir)) mwexec("rm -R $tmp_unpack_dir"); + if (file_exists($arc_db_dir)) mwexec("rm -R $arc_db_dir"); squidguard_ramdisk(false); # create new tmp/arc dir's, use ramdisk for quick operations @@ -2155,6 +2168,7 @@ function sg_update_blacklist($from_file) squidguard_rebuild_db("blk_", $arc_db_dir, $blk_list); squidguard_update_log("Copy DB to workdir."); + $blklist_file = $arc_db_dir . SQUIDGUARD_BLK_FILELIST; mwexec("cp -R -p $arc_db_dir/ $dbhome"); mwexec("cp -f -p $blklist_file " . SQUIDGUARD_WORKDIR); set_file_access($dbhome, OWNER_NAME, 0755); diff --git a/config/squidGuard/squidguard_default.xml b/config/squidGuard/squidguard_default.xml index 3d99259d..6fae67c6 100644 --- a/config/squidGuard/squidguard_default.xml +++ b/config/squidGuard/squidguard_default.xml @@ -20,7 +20,7 @@ <active/> </tab> <tab> - <text>Special ACL</text> + <text>Groups ACL</text> <url>/pkg.php?xml=squidguard_acl.xml</url> </tab> <tab> @@ -105,11 +105,11 @@ <rows>2</rows> </field> <field> - <fielddescr>Spec: Use safe search engine</fielddescr> + <fielddescr>Use SafeSearch engine</fielddescr> <fieldname>safesearch</fieldname> <description> To protect your children from adult content, you can use the protected mode of search engines. - Now it is supported by Google, Yandex, Yahoo, MSN, Live Search. Make sure that the search engines can, and others, it is recommended to prohibit. + Now it is supported by Google, Yandex, Yahoo, MSN, Live Search, Bing. Make sure that the search engines can, and others, it is recommended to prohibit. <br>Note: ! This option overrides 'Rewrite' setting. ! </description> <type>checkbox</type> diff --git a/config/squidGuard/squidguard_dest.xml b/config/squidGuard/squidguard_dest.xml index 9d92a2fa..9c425816 100644 --- a/config/squidGuard/squidguard_dest.xml +++ b/config/squidGuard/squidguard_dest.xml @@ -21,7 +21,7 @@ <url>/pkg_edit.php?xml=squidguard_default.xml&id=0</url> </tab> <tab> - <text>Special ACL</text> + <text>Groups ACL</text> <url>/pkg.php?xml=squidguard_acl.xml</url> </tab> <tab> diff --git a/config/squidGuard/squidguard_log.php b/config/squidGuard/squidguard_log.php index ddcea9ce..9532c44d 100644 --- a/config/squidGuard/squidguard_log.php +++ b/config/squidGuard/squidguard_log.php @@ -1,9 +1,11 @@ <?php /* $Id$ */ /* - sg_log.inc - All rights reserved. + squidguard_log.php + 2006-2011 Serg Dvoriancev + part of pfSense (www.pfSense.com) + Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: @@ -61,7 +63,7 @@ if (!in_array( $mode, array("blocked", "fgui", "flog", "pconf", "fconf"))) $mode $tab_array = array(); $tab_array[] = array(gettext("General settings"), false, "/pkg_edit.php?xml=squidguard.xml&id=0"); $tab_array[] = array(gettext("Common ACL"), false, "/pkg_edit.php?xml=squidguard_default.xml&id=0"); - $tab_array[] = array(gettext("Special ACL"), false, "/pkg.php?xml=squidguard_acl.xml"); + $tab_array[] = array(gettext("Groups ACL"), false, "/pkg.php?xml=squidguard_acl.xml"); $tab_array[] = array(gettext("Target categories"),false, "/pkg.php?xml=squidguard_dest.xml"); $tab_array[] = array(gettext("Times"), false, "/pkg.php?xml=squidguard_time.xml"); $tab_array[] = array(gettext("Rewrites"), false, "/pkg.php?xml=squidguard_rewr.xml"); diff --git a/config/squidGuard/squidguard_log.xml b/config/squidGuard/squidguard_log.xml index a01008fa..13477bed 100644 --- a/config/squidGuard/squidguard_log.xml +++ b/config/squidGuard/squidguard_log.xml @@ -21,7 +21,7 @@ <url>/pkg_edit.php?xml=squidguard_default.xml&id=0</url> </tab> <tab> - <text>Special ACL</text> + <text>Groups ACL</text> <url>/pkg.php?xml=squidguard_acl.xml</url> </tab> <tab> diff --git a/config/squidGuard/squidguard_rewr.xml b/config/squidGuard/squidguard_rewr.xml index 52233133..8a3f801f 100644 --- a/config/squidGuard/squidguard_rewr.xml +++ b/config/squidGuard/squidguard_rewr.xml @@ -19,7 +19,7 @@ <url>/pkg_edit.php?xml=squidguard_default.xml&id=0</url> </tab> <tab> - <text>Special ACL</text> + <text>Groups ACL</text> <url>/pkg.php?xml=squidguard_acl.xml</url> </tab> <tab> diff --git a/config/squidGuard/squidguard_time.xml b/config/squidGuard/squidguard_time.xml index c62635fa..c27de273 100644 --- a/config/squidGuard/squidguard_time.xml +++ b/config/squidGuard/squidguard_time.xml @@ -21,7 +21,7 @@ <url>/pkg_edit.php?xml=squidguard_default.xml&id=0</url> </tab> <tab> - <text>Special ACL</text> + <text>Groups ACL</text> <url>/pkg.php?xml=squidguard_acl.xml</url> </tab> <tab> |