From 5d3183341f3289c5a7d70a1f584e5e6b5364736b Mon Sep 17 00:00:00 2001 From: Marcello Coutinho Date: Tue, 29 Jan 2013 15:58:04 -0200 Subject: dansguardian - package version 0.1.7. Gui improvements, 2.1 support, pcre fix ,dansguardian 2.12.0.3 and more --- config/dansguardian/dansguardian.inc | 81 ++++++++++++++++++++---------------- 1 file changed, 44 insertions(+), 37 deletions(-) (limited to 'config/dansguardian/dansguardian.inc') diff --git a/config/dansguardian/dansguardian.inc b/config/dansguardian/dansguardian.inc index c897f944..ae2b3264 100755 --- a/config/dansguardian/dansguardian.inc +++ b/config/dansguardian/dansguardian.inc @@ -2,13 +2,13 @@ /* dansguardian.inc part of the Dansguardian package for pfSense - Copyright (C) 2012 Marcello Coutinho + Copyright (C) 2012-2013 Marcello Coutinho 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, + 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 @@ -90,7 +90,7 @@ function check_ca_hashes(){ } } -function sync_package_dansguardian($via_rpc=false) { +function sync_package_dansguardian($via_rpc=false,$install_process=false) { global $config,$g; # detect boot process @@ -136,7 +136,7 @@ function sync_package_dansguardian($via_rpc=false) { #daemon options $dansguardian_enabled=$dansguardian['enable_dg']; $filterport=($dansguardian['filterports']?$dansguardian['filterports']:"8080"); - $softrestart=(preg_match('/softrestart/',$dansguardian['daemon_options'])?"yes":"no"); + $softrestart=(preg_match('/softrestart/',$dansguardian['daemon_options'])?"on":"off"); $nodaemon=(preg_match('/nodaemon/',$dansguardian['daemon_options'])?"yes":"off"); if (preg_match("/(\d+)\/(\d+)/",$dansguardian['children'],$matches)){ $minchildren=$matches[1]; @@ -159,6 +159,7 @@ function sync_package_dansguardian($via_rpc=false) { $preforkchildren=($dansguardian['preforkchildren']?$dansguardian['preforkchildren']:"10"); $proxyip=($dansguardian['proxyip']?$dansguardian['proxyip']:"127.0.0.1"); $proxyport=($dansguardian['proxyport']?$dansguardian['proxyport']:"127.0.0.1"); + $proxytimeout=($dansguardian['proxytimeout']?$dansguardian['proxytimeout']:"30"); #general options $urlcachenumber=($dansguardian_config['urlcachenumber']?$dansguardian_config['urlcachenumber']:"1000"); @@ -184,13 +185,14 @@ function sync_package_dansguardian($via_rpc=false) { $recheckreplacedurls=(preg_match('/icapscan/',$dansguardian_config['misc_options'])?"on":"off"); $usexforwardedfor=(preg_match('/usexforwardedfor/',$dansguardian_config['misc_options'])?"on":"off"); $authplugin=(preg_match('/usr/',$dansguardian_config['auth_plugin'])?"authplugin = '".$dansguardian_config['auth_plugin']."'":""); - /*if ($dansguardian_config['auth_plugin']!=""){ + if ($dansguardian_config['auth_plugin']!=""){ $auth_plugins=explode(",",$dansguardian_config['auth_plugin']); $authplugin=""; foreach ($auth_plugins as $auth_selected) - $authplugin.="authplugin = '".$auth_selected."'\n"; + if ($auth_selected != "none") + $authplugin.="authplugin = '".preg_replace("@/usr/local@",DANSGUARDIAN_DIR,$auth_selected)."'\n"; } - */ + #limits $maxuploadsize=($dansguardian_limits['maxuploadsize']?$dansguardian_limits['maxuploadsize']:"-1"); $maxcontentfiltersize=($dansguardian_limits['maxcontentfiltersize']?$dansguardian_limits['maxcontentfiltersize']:"256"); @@ -214,8 +216,8 @@ function sync_package_dansguardian($via_rpc=false) { $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'"; + if (file_exists(DANSGUARDIAN_DIR.'/share/dansguardian/blockedflash.swf')) + $custombannedflashfile="custombannedflashfile = '".DANSGUARDIAN_DIR."/share/dansguardian/blockedflash.swf'"; $usecustombannedimage=(preg_match('/usecustombannedimage/',$dansguardian_log['report_options'])?"on":"off"); $nonstandarddelimiter=(preg_match('/nonstandarddelimiter/',$dansguardian_log['report_options'])?"on":"off"); @@ -317,7 +319,7 @@ function sync_package_dansguardian($via_rpc=false) { $match[1]="/(\/usr.local)/"; $match[2]="/,/"; $replace[0]="$1'"; - $replace[1]="contentscanner = '$1"; + $replace[1]="contentscanner = '".DANSGUARDIAN_DIR; $replace[2]="\n"; $contentscanners=preg_replace($match,$replace,$dansguardian_config['content_scanners']); @@ -327,7 +329,7 @@ function sync_package_dansguardian($via_rpc=false) { $match[1]="/\/usr.local/"; $match[2]="/,/"; $replace[0]="$1>\n"; - $replace[1]="\n.Include