diff options
author | D. V. Serg <dvserg@pfsense.org> | 2007-12-20 10:28:57 +0000 |
---|---|---|
committer | D. V. Serg <dvserg@pfsense.org> | 2007-12-20 10:28:57 +0000 |
commit | 53772847dd7973f2f1337df9d33fb1954234b818 (patch) | |
tree | 5a715cc13b3a518de7c793355d846a73224072a6 /packages/squidGuard | |
parent | 2bf4c277cf2ce501d1a75f272084cffde50b6f7d (diff) | |
download | pfsense-packages-53772847dd7973f2f1337df9d33fb1954234b818.tar.gz pfsense-packages-53772847dd7973f2f1337df9d33fb1954234b818.tar.bz2 pfsense-packages-53772847dd7973f2f1337df9d33fb1954234b818.zip |
Change blacklist update method
Diffstat (limited to 'packages/squidGuard')
-rw-r--r-- | packages/squidGuard/.project | 11 | ||||
-rw-r--r-- | packages/squidGuard/squidguard.inc | 2 | ||||
-rw-r--r-- | packages/squidGuard/squidguard_configurator.inc | 49 |
3 files changed, 48 insertions, 14 deletions
diff --git a/packages/squidGuard/.project b/packages/squidGuard/.project new file mode 100644 index 00000000..49cdc3c9 --- /dev/null +++ b/packages/squidGuard/.project @@ -0,0 +1,11 @@ +<?xml version="1.0" encoding="UTF-8"?> +<projectDescription> + <name>squidGuard</name> + <comment></comment> + <projects> + </projects> + <buildSpec> + </buildSpec> + <natures> + </natures> +</projectDescription> diff --git a/packages/squidGuard/squidguard.inc b/packages/squidGuard/squidguard.inc index ae1b53db..a5b61644 100644 --- a/packages/squidGuard/squidguard.inc +++ b/packages/squidGuard/squidguard.inc @@ -1290,4 +1290,4 @@ function convert_pfxml_to_sgxml_default($pfconfig) { return $sgx; } -?> +?>
\ No newline at end of file diff --git a/packages/squidGuard/squidguard_configurator.inc b/packages/squidGuard/squidguard_configurator.inc index e300f29f..e32169a1 100644 --- a/packages/squidGuard/squidguard_configurator.inc +++ b/packages/squidGuard/squidguard_configurator.inc @@ -1,8 +1,8 @@ <?php # ------------------------------------------------------------------------------ -# squidguard_configurator.inc -# (C) 2006, 2007 Serg Dvoriancev -/* Redistribution and use in source and binary forms, with or without +/* squidguard_configurator.inc + (C)2006 Serg Dvoriancev + 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, @@ -221,6 +221,7 @@ define('SQUIDGUARD_WORKDIR_DEF', '/usr/local/etc/squidGuard'); define('SQUIDGUARD_BINPATH_DEF', '/usr/local/bin'); define('SQUIDGUARD_DBHOME_DEF', '/var/db/squidGuard'); define('BLK_LOCALFILE', '/tmp/sg_blacklists.tar'); +define('DB_REBUILD_SH', '/tmp/squidGuard_db_rebuild.sh'); # ------------------------------------------------------------------------------ // debug options @@ -598,9 +599,12 @@ function sg_reconfigure_user_db() { set_file_access($dbhome, OWNER_NAME, 0755); // 5. rebuild user db - //$dst_names + // $dst_names; create array of names + $db_names = Array(); foreach($dst_names as $dname) - sg_full_rebuild_db($dname); + $db_names[] = $dname; +# sg_full_rebuild_db($dname); + sg_full_rebuild_db($db_names); } else sg_addlog("sg_reconfigure_user_db: stopped - destinations list empty"); @@ -670,21 +674,40 @@ function sg_full_rebuild_db($dblist='') { // rebuild squidGuard DB (without waite) if (file_exists($sg_cfgfile)) { + + // rebuild via sh script + $sh_scr = Array(); + $sh_scr[] = "#!/bin/sh"; + $sh_scr[] = "cd /var/db/squidGuard"; + if (empty($dblist)) { // full rebuild $cmd = $squidguard_config[FLD_BINPATH] . '/squidGuard -c $sg_cfgfile -C all'; - mwexec_bg($cmd); +# mwexec_bg($cmd); // by sh script + $sh_scr[] = $cmd; sg_addlog("sg_rebuild_db: start full rebuild db"); } else { // partually rebuild - $cmd_domains = $squidguard_config[FLD_BINPATH] . "/squidGuard -c $sg_cfgfile -C $dblist/domains"; - $cmd_urls = $squidguard_config[FLD_BINPATH] . "/squidGuard -c $sg_cfgfile -C $dblist/urls"; - mwexec_bg($cmd_domains); - mwexec_bg($cmd_urls); - sg_addlog("sg_rebuild_db: start rebuild DB '$dblist'"); + if (is_array($dblist)) + foreach($dblist as $dbl) { + $sh_scr[] = $squidguard_config[FLD_BINPATH] . "/squidGuard -c $sg_cfgfile -C $dbl/domains"; + $sh_scr[] = $squidguard_config[FLD_BINPATH] . "/squidGuard -c $sg_cfgfile -C $dbl/urls"; + sg_addlog("sg_rebuild_db: start rebuild DB '$dbl'"); + } } // update .diff files -# mwexec_bg($squidguard_config[FLD_BINPATH] . '/squidGuard -c $sg_cfgfile -u')*/) +# mwexec_bg($squidguard_config[FLD_BINPATH] . '/squidGuard -c $sg_cfgfile -u')*/) // by sh script + + // change db owner's after rebuild + $sh_scr[] = "chown -R -v " . OWNER_NAME . " " . $squidguard_config[FLD_DBHOME]; + + // restart squid for take effects + $sh_scr[] = "/usr/local/sbin/squid -k reconfigure"; + + // store & exec ssh + $sh_scr = implode("\n", $sh_scr); + file_put_contents(DB_REBUILD_SH, $sh_scr); + mwexec_bg(DB_REBUILD_SH); } else { sg_addlog("sg_rebuild_db: error, config file '$sg_cfgfile' not found"); } @@ -1561,4 +1584,4 @@ function check_name ($name) { return $err; } -?> +?>
\ No newline at end of file |