#!/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 <http://www.gnu.org/licenses/>. #
+# #
+###############################################################################
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";
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=();
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";
&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'} = '';
$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'};
{
$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')
{
$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;
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'); }
$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);
</table>
<hr size='1'>
<table width='100%'>
-<tr>
- <td class='base' width='50%'><b>$Lang::tr{'advproxy url filter'}</b> $Lang::tr{'advproxy enabled'}<input type='checkbox' name='ENABLE_FILTER' $checked{'ENABLE_FILTER'}{'on'} /></td>
- <td class='base' width='50%'><b>$Lang::tr{'advproxy update accelerator'}</b> $Lang::tr{'advproxy enabled'}<input type='checkbox' name='ENABLE_UPDXLRATOR' $checked{'ENABLE_UPDXLRATOR'}{'on'} /></td>
+<tr><td class='base' width='50%' ><b>$Lang::tr{'advproxy redirector children'}</b><input type='text' name='CHILDREN' value='$proxysettings{'CHILDREN'}' size='5' /></td>
+END
+;
+if ( -e "/usr/bin/squidclamav" ) {
+ print "<td class='base' width='33%'><b>$Lang::tr{'advproxy squidclamav'}</b> $Lang::tr{'advproxy enabled'}<input type='checkbox' name='ENABLE_CLAMAV' $checked{'ENABLE_CLAMAV'}{'on'} /></td></tr>";
+}
+else
+{
+ print "<td class='base' width='33%'></td></tr>";
+}
+print <<END
</tr>
+<tr><td class='base' width='50%'><b>$Lang::tr{'advproxy url filter'}</b> $Lang::tr{'advproxy enabled'}<input type='checkbox' name='ENABLE_FILTER' $checked{'ENABLE_FILTER'}{'on'} /></td>
+<td class='base' width='50%'><b>$Lang::tr{'advproxy update accelerator'}</b> $Lang::tr{'advproxy enabled'}<input type='checkbox' name='ENABLE_UPDXLRATOR' $checked{'ENABLE_UPDXLRATOR'}{'on'} /></td></tr>
</table>
<hr size='1'>
<table width='100%'>
if ($proxysettings{'AUTH_REALM'} eq '')
{
- $authrealm = "IPCop Advanced Proxy Server";
+ $authrealm = "IPFire Advanced Proxy Server";
} else {
$authrealm = $proxysettings{'AUTH_REALM'};
}
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 <<END
-url_rewrite_program /usr/bin/squidGuard
-url_rewrite_children $filtersettings{'CHILDREN'}
-
-END
- ;
- }
- if ($proxysettings{'ENABLE_UPDXLRATOR'} eq 'on')
- {
- print FILE <<END
-url_rewrite_program /usr/sbin/updxlrator
-url_rewrite_children $xlratorsettings{'CHILDREN'}
-
-END
- ;
- }
+ print FILE "url_rewrite_children $proxysettings{'CHILDREN'}\n\n";
}
close FILE;
}
close(FILE);
} else {
&deluser($str_user);
- system("/usr/bin/htpasswd -b $userdb $str_user $str_pass");
+ system("/usr/sbin/htpasswd -b $userdb $str_user $str_pass");
}
if ($str_group eq 'standard') { open(FILE, ">>$stdgrp");