X-Git-Url: http://git.ipfire.org/?a=blobdiff_plain;f=html%2Fcgi-bin%2Fproxy.cgi;h=e349dfd1428c55a5fd3a5c494a24d3eadae361c9;hb=7e7f3b5d542848351d1527b235eca29aa73d0837;hp=639a700e3c8fa82978dafb6bb4e9e7d3e18c0fa9;hpb=4e17adadcd3c3942e7c2222485fbf88608a4477f;p=people%2Fpmueller%2Fipfire-2.x.git diff --git a/html/cgi-bin/proxy.cgi b/html/cgi-bin/proxy.cgi index 639a700e3c..e349dfd142 100644 --- a/html/cgi-bin/proxy.cgi +++ b/html/cgi-bin/proxy.cgi @@ -1,17 +1,29 @@ #!/usr/bin/perl -# -# (c) 2004-2007 marco.s - http://www.advproxy.net -# -# This code is distributed under the terms of the GPL -# -# $Id: advproxy.cgi,v 2.1.0 2007/03/06 00:00:00 marco.s Exp $ -# +############################################################################### +# # +# IPFire.org - A linux based firewall # +# Copyright (C) 2007 Michael Tremer & Christian Schmidt # +# # +# This program is free software: you can redistribute it and/or modify # +# it under the terms of the GNU General Public License as published by # +# the Free Software Foundation, either version 3 of the License, or # +# (at your option) any later version. # +# # +# This program is distributed in the hope that it will be useful, # +# but WITHOUT ANY WARRANTY; without even the implied warranty of # +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # +# GNU General Public License for more details. # +# # +# You should have received a copy of the GNU General Public License # +# along with this program. If not, see . # +# # +############################################################################### use strict; # enable only the following on debugging purpose -use warnings; -use CGI::Carp 'fatalsToBrowser'; +#use warnings; +#use CGI::Carp 'fatalsToBrowser'; require '/var/ipfire/general-functions.pl'; require "${General::swroot}/lang.pl"; @@ -21,6 +33,11 @@ my @squidversion = `/usr/sbin/squid -v`; my $http_port='81'; my $https_port='444'; +my %color = (); +my %mainsettings = (); +&General::readhash("${General::swroot}/main/settings", \%mainsettings); +&General::readhash("/srv/web/ipfire/html/themes/".$mainsettings{'THEME'}."/include/colors.txt", \%color); + my %proxysettings=(); my %netsettings=(); my %filtersettings=(); @@ -85,7 +102,7 @@ my $cre_svhosts = "${General::swroot}/proxy/advanced/cre/supervisors"; my $identhosts = "$identdir/hosts"; -my $authdir = "/usr/lib/squid/auth"; +my $authdir = "/usr/lib/squid/"; my $errordir = "/usr/lib/squid/errors"; my $acl_src_subnets = "$acldir/src_subnets.acl"; @@ -144,16 +161,6 @@ close(FILE); &General::readhash("${General::swroot}/ethernet/settings", \%netsettings); &General::readhash("${General::swroot}/main/settings", \%mainsettings); -$filtersettings{'CHILDREN'} = '5'; -if (-e "${General::swroot}/urlfilter/settings") { - &General::readhash("${General::swroot}/urlfilter/settings", \%filtersettings); -} - -$xlratorsettings{'CHILDREN'} = '5'; -if (-e "${General::swroot}/updatexlrator/settings") { - &General::readhash("${General::swroot}/updatexlrator/settings", \%xlratorsettings); -} - &Header::showhttpheaders(); $proxysettings{'ACTION'} = ''; @@ -245,6 +252,8 @@ $proxysettings{'IDENT_ENABLE_ACL'} = 'off'; $proxysettings{'IDENT_USER_ACL'} = 'positive'; $proxysettings{'ENABLE_FILTER'} = 'off'; $proxysettings{'ENABLE_UPDXLRATOR'} = 'off'; +$proxysettings{'ENABLE_CLAMAV'} = 'off'; +$proxysettings{'CHILDREN'} = '5'; $ncsa_buttontext = $Lang::tr{'advproxy NCSA create user'}; @@ -359,6 +368,11 @@ if (($proxysettings{'ACTION'} eq $Lang::tr{'save'}) || ($proxysettings{'ACTION'} { $errormessage = $Lang::tr{'invalid maximum incoming size'}; goto ERROR; + } + if (!($proxysettings{'CHILDREN'} =~ /^\d+$/) || ($proxysettings{'CHILDREN'} < 1)) + { + $errormessage = $Lang::tr{'advproxy invalid num of children'}; + goto ERROR; } if ($proxysettings{'ENABLE_BROWSER_CHECK'} eq 'on') { @@ -576,6 +590,7 @@ ERROR: $stdproxysettings{'PROXY_PORT'} = $proxysettings{'PROXY_PORT'}; $stdproxysettings{'ENABLE_FILTER'} = $proxysettings{'ENABLE_FILTER'}; $stdproxysettings{'ENABLE_UPDXLRATOR'} = $proxysettings{'ENABLE_UPDXLRATOR'}; + $stdproxysettings{'ENABLE_CLAMAV'} = $proxysettings{'ENABLE_CLAMAV'}; &General::writehash("${General::swroot}/proxy/settings", \%stdproxysettings); &writeconfig; @@ -590,12 +605,12 @@ ERROR: if ($proxysettings{'ENABLE'} eq 'on') { system ('/usr/bin/touch', "${General::swroot}/proxy/enable"); system ('/usr/local/bin/squidctrl', 'enable'); } - if ($proxysettings{'TRANSPARENT'} eq 'on') { + if ($proxysettings{'TRANSPARENT'} eq 'on' && $proxysettings{'ENABLE'} eq 'on') { system ('/usr/bin/touch', "${General::swroot}/proxy/transparent"); } if ($proxysettings{'ENABLE_BLUE'} eq 'on') { system ('/usr/bin/touch', "${General::swroot}/proxy/enable_blue"); system ('/usr/local/bin/squidctrl', 'enable'); } - if ($proxysettings{'TRANSPARENT_BLUE'} eq 'on') { + if ($proxysettings{'TRANSPARENT_BLUE'} eq 'on' && $proxysettings{'ENABLE_BLUE'} eq 'on') { system ('/usr/bin/touch', "${General::swroot}/proxy/transparent_blue"); } if ($proxysettings{'ACTION'} eq $Lang::tr{'advproxy save and restart'}) { system('/usr/local/bin/squidctrl restart >/dev/null 2>&1'); } @@ -811,6 +826,10 @@ $checked{'ENABLE_UPDXLRATOR'}{'off'} = ''; $checked{'ENABLE_UPDXLRATOR'}{'on'} = ''; $checked{'ENABLE_UPDXLRATOR'}{$proxysettings{'ENABLE_UPDXLRATOR'}} = "checked='checked'"; +$checked{'ENABLE_CLAMAV'}{'off'} = ''; +$checked{'ENABLE_CLAMAV'}{'on'} = ''; +$checked{'ENABLE_CLAMAV'}{$proxysettings{'ENABLE_CLAMAV'}} = "checked='checked'"; + &Header::openpage($Lang::tr{'advproxy advanced web proxy configuration'}, 1, ''); &Header::openbigbox('100%', 'left', '', $errormessage); @@ -913,10 +932,20 @@ print <
- - - + +END +; +if ( -e "/usr/bin/squidclamav" ) { + print ""; +} +else +{ + print ""; +} +print < + +
$Lang::tr{'advproxy url filter'} $Lang::tr{'advproxy enabled'}$Lang::tr{'advproxy update accelerator'} $Lang::tr{'advproxy enabled'}
$Lang::tr{'advproxy redirector children'}$Lang::tr{'advproxy squidclamav'} $Lang::tr{'advproxy enabled'}
$Lang::tr{'advproxy url filter'} $Lang::tr{'advproxy enabled'}$Lang::tr{'advproxy update accelerator'} $Lang::tr{'advproxy enabled'}

@@ -2796,7 +2825,7 @@ sub writeconfig if ($proxysettings{'AUTH_REALM'} eq '') { - $authrealm = "IPCop Advanced Proxy Server"; + $authrealm = "IPFire Advanced Proxy Server"; } else { $authrealm = $proxysettings{'AUTH_REALM'}; } @@ -3652,36 +3681,10 @@ END print FILE "\nnever_direct allow all\n\n"; } - if (($proxysettings{'ENABLE_FILTER'} eq 'on') && ($proxysettings{'ENABLE_UPDXLRATOR'} eq 'on')) + if (($proxysettings{'ENABLE_FILTER'} eq 'on') || ($proxysettings{'ENABLE_UPDXLRATOR'} eq 'on') || ($proxysettings{'ENABLE_CLAMAV'} eq 'on')) { print FILE "url_rewrite_program /usr/sbin/redirect_wrapper\n"; - if ($filtersettings{'CHILDREN'} > $xlratorsettings{'CHILDREN'}) - { - print FILE "url_rewrite_children $filtersettings{'CHILDREN'}\n\n"; - } else { - print FILE "url_rewrite_children $xlratorsettings{'CHILDREN'}\n\n"; - } - } else - { - - if ($proxysettings{'ENABLE_FILTER'} eq 'on') - { - print FILE <>$stdgrp");