X-Git-Url: http://git.ipfire.org/?p=people%2Fteissler%2Fipfire-2.x.git;a=blobdiff_plain;f=html%2Fcgi-bin%2Fproxy.cgi;h=2a9d49394276a83233b4928b5737b1facb5141e9;hp=901ed7250466d84a2aa6a0c043a3b3745d5e6098;hb=dd58c50c3e55749903369c2b3258de7cc307c8ce;hpb=6bea848d3476dd042d0a4f0f9eca63f7773e503c diff --git a/html/cgi-bin/proxy.cgi b/html/cgi-bin/proxy.cgi index 901ed7250..2a9d49394 100644 --- a/html/cgi-bin/proxy.cgi +++ b/html/cgi-bin/proxy.cgi @@ -180,8 +180,8 @@ close(FILE); &General::readhash("${General::swroot}/main/settings", \%mainsettings); my $green_cidr = &General::ipcidr("$netsettings{'GREEN_NETADDRESS'}\/$netsettings{'GREEN_NETMASK'}"); -my $blue_cidr = "# Blue not defined"; -if ($netsettings{'BLUE_DEV'}) { +my $blue_cidr = ""; +if (&Header::blue_used() && $netsettings{'BLUE_DEV'}) { $blue_cidr = &General::ipcidr("$netsettings{'BLUE_NETADDRESS'}\/$netsettings{'BLUE_NETMASK'}"); } @@ -195,6 +195,7 @@ $proxysettings{'ENABLE_BLUE'} = 'off'; $proxysettings{'TRANSPARENT'} = 'off'; $proxysettings{'TRANSPARENT_BLUE'} = 'off'; $proxysettings{'PROXY_PORT'} = '800'; +$proxysettings{'TRANSPARENT_PORT'} = '3128'; $proxysettings{'VISIBLE_HOSTNAME'} = ''; $proxysettings{'ADMIN_MAIL_ADDRESS'} = ''; $proxysettings{'ADMIN_PASSWORD'} = ''; @@ -212,7 +213,7 @@ $proxysettings{'LOGGING'} = 'off'; $proxysettings{'CACHEMGR'} = 'off'; $proxysettings{'LOGQUERY'} = 'off'; $proxysettings{'LOGUSERAGENT'} = 'off'; -$proxysettings{'FILEDESCRIPTORS'} = '4096'; +$proxysettings{'FILEDESCRIPTORS'} = '16384'; $proxysettings{'CACHE_MEM'} = '2'; $proxysettings{'CACHE_SIZE'} = '50'; $proxysettings{'MAX_SIZE'} = '4096'; @@ -359,6 +360,15 @@ if (($proxysettings{'ACTION'} eq $Lang::tr{'save'}) || ($proxysettings{'ACTION'} $errormessage = $Lang::tr{'advproxy errmsg invalid proxy port'}; goto ERROR; } + if (!(&General::validport($proxysettings{'TRANSPARENT_PORT'}))) + { + $errormessage = $Lang::tr{'advproxy errmsg invalid proxy port'}; + goto ERROR; + } + if ($proxysettings{'PROXY_PORT'} eq $proxysettings{'TRANSPARENT_PORT'}) { + $errormessage = $Lang::tr{'advproxy errmsg proxy ports equal'}; + goto ERROR; + } if (!($proxysettings{'UPSTREAM_PROXY'} eq '')) { my @temp = split(/:/,$proxysettings{'UPSTREAM_PROXY'}); @@ -381,7 +391,7 @@ if (($proxysettings{'ACTION'} eq $Lang::tr{'save'}) || ($proxysettings{'ACTION'} } } if (!($proxysettings{'FILEDESCRIPTORS'} =~ /^\d+/) || - ($proxysettings{'FILEDESCRIPTORS'} < 1) || ($proxysettings{'FILEDESCRIPTORS'} > 16384)) + ($proxysettings{'FILEDESCRIPTORS'} < 1) || ($proxysettings{'FILEDESCRIPTORS'} > 1048576)) { $errormessage = $Lang::tr{'proxy errmsg filedescriptors'}; goto ERROR; @@ -699,6 +709,16 @@ if (!$errormessage) &read_acls; } +# ------------------------------------------------------------------ + +# Hook to regenerate the configuration files, if cgi got called from command line. +if ($ENV{"REMOTE_ADDR"} eq "") { + writeconfig(); + exit(0); +} + +# ------------------------------------------------------------------- + $checked{'ENABLE'}{'off'} = ''; $checked{'ENABLE'}{'on'} = ''; $checked{'ENABLE'}{$proxysettings{'ENABLE'}} = "checked='checked'"; @@ -946,8 +966,8 @@ print < $Lang::tr{'advproxy transparent on'} Green: - $Lang::tr{'advproxy visible hostname'}: * - + $Lang::tr{'advproxy proxy port transparent'}: + END @@ -959,7 +979,8 @@ if ($netsettings{'BLUE_DEV'}) { print " "; } print <  + $Lang::tr{'advproxy visible hostname'}: * + END @@ -1185,7 +1206,7 @@ print <$Lang::tr{'advproxy destination ports'} - + $Lang::tr{'advproxy standard ports'}: @@ -1657,8 +1678,8 @@ print <$Lang::tr{'advproxy fake referer'}: * - - + +
@@ -2215,7 +2236,7 @@ print < $Lang::tr{'advproxy NCSA group'}: @@ -2951,11 +2972,23 @@ sub writepacfile print FILE < 0) @@ -3128,12 +3177,12 @@ END if ($proxysettings{'LOGGING'} eq 'on') { print FILE <; close PORTS; @@ -3442,6 +3486,18 @@ END close (ACL); } if ((!-z $extgrp) && ($proxysettings{'AUTH_METHOD'} eq 'ncsa') && ($proxysettings{'NCSA_BYPASS_REDIR'} eq 'on')) { print FILE "\nredirector_access deny for_extended_users\n"; } + + # Check if squidclamav is enabled. + if ($proxysettings{'ENABLE_CLAMAV'} eq 'on') { + print FILE "\n#Settings for squidclamav:\n"; + print FILE "http_port 127.0.0.1:$proxysettings{'PROXY_PORT'}\n"; + print FILE "acl purge method PURGE\n"; + print FILE "http_access deny to_localhost\n"; + print FILE "http_access allow localhost\n"; + print FILE "http_access allow purge localhost\n"; + print FILE "http_access deny purge\n"; + print FILE "url_rewrite_access deny localhost\n"; + } print FILE <