X-Git-Url: http://git.ipfire.org/?p=people%2Fteissler%2Fipfire-2.x.git;a=blobdiff_plain;f=html%2Fcgi-bin%2Fproxy.cgi;h=c8f0dca77f490970c488f9f9ea49980c1b455c4b;hp=c42d35a95e5ba0160199eb610b2e3e28b7ec3d14;hb=631b67b7cd4c5fa00417cbe9e843892cae6f0ff6;hpb=3e862ce4f99059002b60994addc87a013d298b38 diff --git a/html/cgi-bin/proxy.cgi b/html/cgi-bin/proxy.cgi index c42d35a95..c8f0dca77 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; @@ -956,8 +966,8 @@ print < $Lang::tr{'advproxy transparent on'} Green: - $Lang::tr{'advproxy visible hostname'}: * - + $Lang::tr{'advproxy proxy port transparent'}: + END @@ -969,7 +979,8 @@ if ($netsettings{'BLUE_DEV'}) { print " "; } print <  + $Lang::tr{'advproxy visible hostname'}: * + END @@ -1195,7 +1206,7 @@ print <$Lang::tr{'advproxy destination ports'} - + $Lang::tr{'advproxy standard ports'}: @@ -1667,8 +1678,8 @@ print <$Lang::tr{'advproxy fake referer'}: * - - + +
@@ -3071,16 +3082,32 @@ icp_port 0 END ; + + # Include file with user defined settings. + if (-e "/etc/squid/squid.conf.pre.local") { + print FILE "include /etc/squid/squid.conf.pre.local\n\n"; + } + print FILE "http_port $netsettings{'GREEN_ADDRESS'}:$proxysettings{'PROXY_PORT'}"; - if ($proxysettings{'TRANSPARENT'} eq 'on') { print FILE " transparent" } if ($proxysettings{'NO_CONNECTION_AUTH'} eq 'on') { print FILE " no-connection-auth" } print FILE "\n"; + if ($proxysettings{'TRANSPARENT'} eq 'on') { + print FILE "http_port $netsettings{'GREEN_ADDRESS'}:$proxysettings{'TRANSPARENT_PORT'} intercept"; + if ($proxysettings{'NO_CONNECTION_AUTH'} eq 'on') { print FILE " no-connection-auth" } + print FILE "\n"; + } + if ($netsettings{'BLUE_DEV'} && $proxysettings{'ENABLE_BLUE'} eq 'on') { print FILE "http_port $netsettings{'BLUE_ADDRESS'}:$proxysettings{'PROXY_PORT'}"; - if ($proxysettings{'TRANSPARENT_BLUE'} eq 'on') { print FILE " transparent" } if ($proxysettings{'NO_CONNECTION_AUTH'} eq 'on') { print FILE " no-connection-auth" } print FILE "\n"; + + if ($proxysettings{'TRANSPARENT_BLUE'} eq 'on') { + print FILE "http_port $netsettings{'BLUE_ADDRESS'}:$proxysettings{'TRANSPARENT_PORT'} intercept"; + if ($proxysettings{'NO_CONNECTION_AUTH'} eq 'on') { print FILE " no-connection-auth" } + print FILE "\n"; + } } if ($proxysettings{'CACHE_SIZE'} > 0) @@ -3138,12 +3165,12 @@ END if ($proxysettings{'LOGGING'} eq 'on') { print FILE <; close PORTS; @@ -3456,8 +3478,7 @@ END # 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'} transparent\n"; - print FILE "acl to_localhost dst 127.0.0.0/8\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";