X-Git-Url: http://git.ipfire.org/?a=blobdiff_plain;f=html%2Fcgi-bin%2Fproxy.cgi;h=901ed7250466d84a2aa6a0c043a3b3745d5e6098;hb=6bea848d3476dd042d0a4f0f9eca63f7773e503c;hp=476de52cc3b4ee7e1b829c829a34d8afb7568b34;hpb=051cb353c6497ee22222a876e09472e048d20115;p=ipfire-2.x.git diff --git a/html/cgi-bin/proxy.cgi b/html/cgi-bin/proxy.cgi index 476de52cc3..901ed72504 100644 --- a/html/cgi-bin/proxy.cgi +++ b/html/cgi-bin/proxy.cgi @@ -2,7 +2,7 @@ ############################################################################### # # # IPFire.org - A linux based firewall # -# Copyright (C) 2007-2011 IPFire Team # +# Copyright (C) 2007-2013 IPFire Team # # # # 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 # @@ -55,10 +55,10 @@ my %mainsettings=(); my %checked=(); my %selected=(); -my @throttle_limits=(64,128,256,384,512,1024,2048,3072,5120); -my $throttle_binary="bin|cab|exe|gz|rar|sea|tar|tgz|zip"; -my $throttle_dskimg="b5t|bin|bwt|ccd|cdi|cue|gho|img|iso|mds|nrg|pqi"; -my $throttle_mmedia="aiff?|asf|avi|divx|mov|mp3|mpe?g|qt|ra?m"; +my @throttle_limits=(64,128,256,384,512,768,1024,1280,1536,1792,2048,2560,3072,3584,4096,5120,6144,7168,8192,10240,12288,16384,20480); +my $throttle_binary="7z|arj|bin|bz2|cab|exe|gz|lzh|rar|sea|tar|tgz|xz|zip"; +my $throttle_dskimg="b5t|bin|bwt|ccd|cdi|cue|gho|img|iso|mds|nrg|pqi|vmdk"; +my $throttle_mmedia="aiff?|asf|avi|divx|mov|mp3|mpe?g|ogg|qt|ra?m|ts|vob"; my $def_ports_safe="80 # http\n21 # ftp\n443 # https\n563 # snews\n70 # gopher\n210 # wais\n1025-65535 # unregistered ports\n280 # http-mgmt\n488 # gss-http\n591 # filemaker\n777 # multiling http\n800 # Squids port (for icons)\n"; my $def_ports_ssl="443 # https\n563 # snews\n"; @@ -221,6 +221,7 @@ $proxysettings{'MEM_POLICY'} = 'LRU'; $proxysettings{'CACHE_POLICY'} = 'LRU'; $proxysettings{'L1_DIRS'} = '16'; $proxysettings{'OFFLINE_MODE'} = 'off'; +$proxysettings{'CACHE_DIGESTS'} = 'off'; $proxysettings{'CLASSROOM_EXT'} = 'off'; $proxysettings{'SUPERVISOR_PASSWORD'} = ''; $proxysettings{'NO_PROXY_LOCAL'} = 'off'; @@ -348,11 +349,28 @@ if (($proxysettings{'ACTION'} eq $Lang::tr{'save'}) || ($proxysettings{'ACTION'} $errormessage = $Lang::tr{'invalid input'}; goto ERROR; } + if($proxysettings{'CACHE_MEM'} > $proxysettings{'CACHE_SIZE'} && $proxysettings{'CACHE_SIZE'} > 0){ + $errormessage = $Lang::tr{'advproxy errmsg cache'}." ".$proxysettings{'CACHE_MEM'}." > ".$proxysettings{'CACHE_SIZE'}; + goto ERROR; + } + if (!(&General::validport($proxysettings{'PROXY_PORT'}))) { $errormessage = $Lang::tr{'advproxy errmsg invalid proxy port'}; goto ERROR; } + if (!($proxysettings{'UPSTREAM_PROXY'} eq '')) + { + my @temp = split(/:/,$proxysettings{'UPSTREAM_PROXY'}); + if (!(&General::validip($temp[0]))) + { + if (!(&General::validdomainname($temp[0]))) + { + $errormessage = $Lang::tr{'advproxy errmsg invalid upstream proxy'}; + goto ERROR; + } + } + } if (!($proxysettings{'CACHE_SIZE'} =~ /^\d+/) || ($proxysettings{'CACHE_SIZE'} < 10)) { @@ -500,8 +518,11 @@ if (($proxysettings{'ACTION'} eq $Lang::tr{'save'}) || ($proxysettings{'ACTION'} } if (!&General::validip($proxysettings{'LDAP_SERVER'})) { - $errormessage = $Lang::tr{'advproxy errmsg ldap server'}; - goto ERROR; + if (!&General::validdomainname($proxysettings{'LDAP_SERVER'})) + { + $errormessage = $Lang::tr{'advproxy errmsg ldap server'}; + goto ERROR; + } } if (!&General::validport($proxysettings{'LDAP_PORT'})) { @@ -717,6 +738,9 @@ $selected{'L1_DIRS'}{$proxysettings{'L1_DIRS'}} = "selected='selected'"; $checked{'OFFLINE_MODE'}{'off'} = ''; $checked{'OFFLINE_MODE'}{'on'} = ''; $checked{'OFFLINE_MODE'}{$proxysettings{'OFFLINE_MODE'}} = "checked='checked'"; +$checked{'CACHE_DIGESTS'}{'off'} = ''; +$checked{'CACHE_DIGESTS'}{'on'} = ''; +$checked{'CACHE_DIGESTS'}{$proxysettings{'CACHE_DIGESTS'}} = "checked='checked'"; $checked{'LOGGING'}{'off'} = ''; $checked{'LOGGING'}{'on'} = ''; @@ -984,7 +1008,7 @@ print <$Lang::tr{'processes'} END ; -my $count = `arp -a | wc -l`; +my $count = `ip n| wc -l`; if ( $count < 1 ){$count = 1;} if ( -e "/usr/bin/squidclamav" ) { print "".$Lang::tr{'advproxy squidclamav'}."
"; @@ -1150,6 +1174,10 @@ print <$Lang::tr{'advproxy offline mode'}: + + $Lang::tr{'advproxy cache-digest'}: + +
@@ -2924,6 +2952,7 @@ sub writepacfile if ( (isPlainHostName(host)) || (dnsDomainIs(host, ".$mainsettings{'DOMAINNAME'}")) || + (isInNet(host, "127.0.0.1", "255.0.0.0")) || (isInNet(host, "10.0.0.0", "255.0.0.0")) || (isInNet(host, "172.16.0.0", "255.240.0.0")) || (isInNet(host, "192.168.0.0", "255.255.0.0")) || @@ -3012,7 +3041,7 @@ sub writeconfig } $_ = $proxysettings{'UPSTREAM_PROXY'}; - my ($remotehost, $remoteport) = (/^(?:[a-zA-Z ]+\:\/\/)?(?:[A-Za-z0-9\_\.\-]*?(?:\:[A-Za-z0-9\_\.\-]*?)?\@)?([a-zA-Z0-9\.\_\-]*?)(?:\:([0-9]{1,5}))?(?:\/.*?)?$/); + my ($remotehost, $remoteport) = split(/:/,$_); if ($remoteport eq '') { $remoteport = 80; } @@ -3073,16 +3102,11 @@ pid_filename /var/run/squid.pid cache_mem $proxysettings{'CACHE_MEM'} MB END ; - - if ($proxysettings{'CACHE_SIZE'} ne '0') - { - print FILE "cache_dir aufs /var/log/cache $proxysettings{'CACHE_SIZE'} $proxysettings{'L1_DIRS'} 256\n\n"; - } - print FILE "error_directory $errordir/$proxysettings{'ERR_LANGUAGE'}\n\n"; if ($proxysettings{'OFFLINE_MODE'} eq 'on') { print FILE "offline_mode on\n\n"; } - + if ($proxysettings{'CACHE_DIGESTS'} eq 'on') { print FILE "digest_generation on\n\n"; } else { print FILE "digest_generation off\n\n"; } + if ((!($proxysettings{'MEM_POLICY'} eq 'LRU')) || (!($proxysettings{'CACHE_POLICY'} eq 'LRU'))) { if (!($proxysettings{'MEM_POLICY'} eq 'LRU')) @@ -3096,6 +3120,11 @@ END print FILE "\n"; } + if ($proxysettings{'CACHE_SIZE'} ne '0') + { + print FILE "cache_dir aufs /var/log/cache $proxysettings{'CACHE_SIZE'} $proxysettings{'L1_DIRS'} 256\n\n"; + } + if ($proxysettings{'LOGGING'} eq 'on') { print FILE <