From 14c7eb8ab7fff868e2910e7112793f5d64bf6575 Mon Sep 17 00:00:00 2001 From: Marcello Coutinho Date: Wed, 4 Apr 2012 00:49:00 -0300 Subject: sarg - include squidguard report options --- config/sarg/sarg.inc | 27 ++++++++++++++++----------- config/sarg/sarg.template | 6 +++--- config/sarg/sarg.xml | 6 ------ 3 files changed, 19 insertions(+), 20 deletions(-) diff --git a/config/sarg/sarg.inc b/config/sarg/sarg.inc index 3d04ce15..519619b7 100644 --- a/config/sarg/sarg.inc +++ b/config/sarg/sarg.inc @@ -100,14 +100,19 @@ function run_sarg($id=-1) { mwexec('/usr/bin/killall -HUP dansguardian'); } break; - /*case "squidguard": - #todo - if ($action !="xnonex"){ - log_rotate('/var/log/dansguardian/access.log'); - mwexec('/usr/local/sbin/dansguardian -r'); + case "squidguard": + if ($action =="both" || $action=="rotate") { + mwexec('squid -k rotate'); + if (file_exists('/usr/local/etc/rc.d/squidGuard_logrotate')){ + mwexec('/usr/local/etc/rc.d/squidGuard_logrotate'); + } + } + if ($action =="both" || $action=="restart") { + if (file_exists('/usr/local/etc/rc.d/squid')){ + mwexec_bg('/usr/local/etc/rc.d/squid restart'); + } } break; - */ } #mount filesystem readonly conf_mount_ro(); @@ -123,23 +128,23 @@ function sync_package_sarg() { 'user_sort_field'=>'BYTES', 'report_type'=>'topusers,topsites,sites_users,users_sites,date_time,denied,auth_failures,site_user_time_date,downloads'); $sarg=$config['installedpackages']['sarg']['config'][0]; - switch ($sarg['proxy_server']){ case 'dansguardian': $access_log='/var/log/dansguardian/access.log'; $dansguardian_conf='/usr/local/etc/dansguardian/dansguardian.conf'; $dansguardian_filter_out_date="dansguardian_filter_out_date on"; - $squidguard_conf='none'; + $squidguard_conf='squidguard_conf none'; break; + case 'squidguard': + $squidguard_conf='squidguard_conf /usr/local/etc/squidGuard/squidGuard.conf'; + $redirector_log_format='redirector_log_format #year#-#mon#-#day# #hour# #tmp#/#list#/#tmp#/#tmp#/#url#/#tmp# #ip#/#tmp# #user# #end#'; + #Leve this case without break to include squid log file on squidguard option case 'squid': $access_log='/var/squid/logs/access.log'; if (is_array($config['installedpackages']['squid']['config'])) if (file_exists($config['installedpackages']['squid']['config'][0]['log_dir']. '/access.log')) $access_log = $config['installedpackages']['squid']['config'][0]['log_dir']. '/access.log'; break; - case 'squidguard': - $access_log='/var/squid/logs/access.log'; - break; } if (!file_exists($access_log)){ $error="Sarg config error: ".$sarg['proxy_server']." log file ($access_log) does not exists"; diff --git a/config/sarg/sarg.template b/config/sarg/sarg.template index b5676834..67a96fb0 100644 --- a/config/sarg/sarg.template +++ b/config/sarg/sarg.template @@ -543,7 +543,7 @@ dansguardian_conf {$dansguardian_conf} # 'off' use the record even if its date is outside of the range found in the input log file. # 'on' use the record only if its date is in the range found in the input log file. # -${dansguardian_filter_out_date} +{$dansguardian_filter_out_date} # TAG: squidguard_conf file # path to squidGuard.conf file @@ -552,7 +552,7 @@ ${dansguardian_filter_out_date} # You can use sarg -L filename to use an alternate squidGuard log. # squidguard_conf /usr/local/squidGuard/squidGuard.conf # -squidguard_conf {$squidguard_conf} +{$squidguard_conf} # TAG: redirector_log file # the location of the web proxy redirector log such as one created by squidGuard or Rejik. The option @@ -577,7 +577,7 @@ squidguard_conf {$squidguard_conf} # REJIK #year#-#mon#-#day# #hour# #list#:#tmp# #ip# #user# #tmp#/#tmp#/#url#/#end# # SQUIDGUARD #year#-#mon#-#day# #hour# #tmp#/#list#/#tmp#/#tmp#/#url#/#tmp# #ip#/#tmp# #user# #end# #redirector_log_format #year#-#mon#-#day# #hour# #tmp#/#list#/#tmp#/#tmp#/#url#/#tmp# #ip#/#tmp# #user# #end# - +{$redirector_log_format} # TAG: show_sarg_info yes|no # shows sarg information and site path on each report bottom # diff --git a/config/sarg/sarg.xml b/config/sarg/sarg.xml index aff3e7ff..d406b68d 100644 --- a/config/sarg/sarg.xml +++ b/config/sarg/sarg.xml @@ -52,12 +52,6 @@
Status
/pkg_edit.php?xml=sarg.xml - - sarg - sarg - sarg - - http://www.pfsense.org/packages/config/sarg/sarg.inc /usr/local/pkg/ -- cgit v1.2.3