From f1415041a0c45bd986772356dc72581fe716de99 Mon Sep 17 00:00:00 2001 From: marcelloc Date: Fri, 27 Jan 2012 17:08:33 -0200 Subject: dansguardian - fix some bugs and missing xml fields --- config/dansguardian/dansguardian.conf.template | 8 ++---- config/dansguardian/dansguardian.inc | 40 ++++++++++++++++++++------ config/dansguardian/dansguardian.xml | 21 ++++++++++++++ config/dansguardian/dansguardian_log.xml | 2 +- pkg_config.8.xml | 2 +- pkg_config.8.xml.amd64 | 2 +- 6 files changed, 58 insertions(+), 17 deletions(-) diff --git a/config/dansguardian/dansguardian.conf.template b/config/dansguardian/dansguardian.conf.template index 7b3fcc4c..993ea72e 100755 --- a/config/dansguardian/dansguardian.conf.template +++ b/config/dansguardian/dansguardian.conf.template @@ -126,10 +126,10 @@ statlocation = '/var/log/dansguardian/stats' {$filterports} # the ip of the proxy (default is the loopback - i.e. this server) -proxyip = 127.0.0.1 +proxyip = {$proxyip} # the port DansGuardian connects to proxy on -proxyport = 3128 +proxyport = {$proxyport} # Whether to retrieve the original destination IP in transparent proxy # setups and check it against the domain pulled from the HTTP headers. @@ -182,9 +182,7 @@ custombannedimagefile = '/usr/local/share/dansguardian/transparent1x1.gif' #Banned flash replacement usecustombannedflash = {$usecustombannedflash} -custombannedflashfile = '/usr/local/share/dansguardian/blockedflash.swf' - - +{$custombannedflashfile} # Filter groups options # filtergroups sets the number of filter groups. A filter group is a set of content diff --git a/config/dansguardian/dansguardian.inc b/config/dansguardian/dansguardian.inc index 343c38b9..ab25c7ae 100755 --- a/config/dansguardian/dansguardian.inc +++ b/config/dansguardian/dansguardian.inc @@ -79,6 +79,8 @@ function sync_package_dansguardian() { $maxagechildren=($dansguardian['maxagechildren']?$dansguardian['maxagechildren']:"500"); $maxips=($dansguardian['maxips']?$dansguardian['maxips']:"0"); $preforkchildren=($dansguardian['preforkchildren']?$dansguardian['preforkchildren']:"10"); + $proxyip=($dansguardian['proxyip']?$dansguardian['proxyip']:"127.0.0.1"); + $proxyport=($dansguardian['proxyport']?$dansguardian['proxyport']:"127.0.0.1"); #general options $urlcachenumber=($dansguardian_config['urlcachenumber']?$dansguardian_config['urlcachenumber']:"1000"); @@ -118,6 +120,8 @@ function sync_package_dansguardian() { $reportlanguage=($dansguardian_log['report_language']?$dansguardian_log['report_language']:"ukenglish"); $showweightedfound=(preg_match('/showweightedfound/',$dansguardian_log['report_options'])?"on":"off"); $usecustombannedflash=(preg_match('/usecustombannedflash/',$dansguardian_log['report_options'])?"on":"off"); + if (file_exists('/usr/local/share/dansguardian/blockedflash.swf')) + $custombannedflashfile="custombannedflashfile = '/usr/local/share/dansguardian/blockedflash.swf'"; $usecustombannedimage=(preg_match('/usecustombannedimage/',$dansguardian_log['report_options'])?"on":"off"); $nonstandarddelimiter=(preg_match('/nonstandarddelimiter/',$dansguardian_log['report_options'])?"on":"off"); @@ -621,6 +625,20 @@ EOF; $count++; } + if ($user_xml==""){ + $user_xml .=<< + Users + listtopic + + + Users + info_checkbox + checkbox + All unauthenticated users or unlisted uses will match first filter group.]]> + +EOF; + } #Create/update filtergroupslist file_put_contents($dansguardian_dir."/lists/filtergroupslist",$filtergroupslist,LOCK_EX); #Create/update userlist xml file @@ -671,8 +689,16 @@ EOF; conf_mount_rw(); write_config(); + + $dirs=array('/usr/local/etc/dansguardian/lists/bannedrooms/', + '/var/log/dansguardian'); + + foreach ($dirs as $dir) + if (!is_dir($dir)) + mkdir ($dir,0755,true); + #update file owner - mwexec("chown -R $daemonuser:$daemongroup /usr/loca/etc/dansguardian"); + mwexec("chown -R $daemonuser:$daemongroup /usr/local/etc/dansguardian"); mwexec("chown -R $daemonuser:$daemongroup /var/log/dansguardian"); #create config files @@ -695,8 +721,9 @@ EOF; #clamdscan.conf dansguardian file $cconf="/usr/local/etc/dansguardian/contentscanners/clamdscan.conf"; $cconf_file=file_get_contents($cconf); - if (!preg_match('/clamav/',$cconf_file)){ - file_put_contents($cconf, $cconf_file."\nclamdudsfile = '/var/run/clamav/clamd.sock'", LOCK_EX); + if (preg_match('/#clamdudsfile/',$cconf_file)){ + $cconf_file=preg_replace('/#clamdudsfile/','clamdudsfile',$cconf_file); + file_put_contents($cconf, $cconf_file, LOCK_EX); } #clamd conf file @@ -725,12 +752,7 @@ EOF; } } - $dirs=array('/usr/local/etc/dansguardian/lists/bannedrooms/', - '/var/log/dansguardian'); - foreach ($dirs as $dir) - if (!is_dir($dir)) - mkdir ($dir,0755,true); - + $script='/usr/local/etc/rc.d/dansguardian'; if($config['installedpackages']['dansguardian']['config'][0]['enable']){ $script_file=file_get_contents($script); diff --git a/config/dansguardian/dansguardian.xml b/config/dansguardian/dansguardian.xml index 42e2b37e..0870c91b 100644 --- a/config/dansguardian/dansguardian.xml +++ b/config/dansguardian/dansguardian.xml @@ -290,6 +290,27 @@ Use this to set a hard limit on the number of users allowed to concurrently
browse the web. Set to 0 for no limit, and to disable the IP cache process.]]> + + Listening Settings + listtopic + + + Proxy IP + proxyip + input + 20 + 127.0.0.1
+ Sets ip address for proxy server(usually squid).]]>
+
+ + Proxy Port + proxyport + input + 10 + 3128
+ Sets port number fro proxy server.]]>
+
+ dansguardian_php_install_command(); diff --git a/config/dansguardian/dansguardian_log.xml b/config/dansguardian/dansguardian_log.xml index ceb7ccb0..18e3db55 100644 --- a/config/dansguardian/dansguardian_log.xml +++ b/config/dansguardian/dansguardian_log.xml @@ -149,7 +149,7 @@ select - + diff --git a/pkg_config.8.xml b/pkg_config.8.xml index d54b1b59..4ae021a0 100644 --- a/pkg_config.8.xml +++ b/pkg_config.8.xml @@ -429,7 +429,7 @@ http://e-sac.siteseguro.ws/packages/8/All/ dansguardian-2.12.0.0_1.tbz clamav-0.97.3_1.tbz - 2.12.0.0 pkg v.0.1 + 2.12.0.0 pkg v.0.1.1 beta 2.0 dansguardian.xml diff --git a/pkg_config.8.xml.amd64 b/pkg_config.8.xml.amd64 index 93e0e1e5..d4e5bd56 100644 --- a/pkg_config.8.xml.amd64 +++ b/pkg_config.8.xml.amd64 @@ -541,7 +541,7 @@ http://e-sac.siteseguro.ws/packages/amd64/8/All/ dansguardian-2.12.0.0_1.tbz clamav-0.97.3_1.tbz - 2.12.0.0 pkg v.0.1 + 2.12.0.0 pkg v.0.1.1 beta 2.0 dansguardian.xml -- cgit v1.2.3