From 363fb6afce0da6581db2ebac774e506fc8db81c6 Mon Sep 17 00:00:00 2001 From: ms Date: Sun, 10 Sep 2006 19:52:20 +0000 Subject: [PATCH] Geaendert: * Squid auf neuesten Stand gebracht. * QoS-Fortschritt. * Kleines Script fuer Sprachdateiupdates. git-svn-id: http://svn.ipfire.org/svn/ipfire/trunk@268 ea5c0bd1-69bd-2848-81d8-4f18e57aeed8 --- config/qos/makeqosscripts.pl | 5 + config/qos/parse-func.pl | 4 +- doc/ChangeLog | 7 + html/cgi-bin/chpasswd.cgi | 2 +- html/cgi-bin/logs.cgi/proxylog.dat | 50 ++- html/cgi-bin/proxy.cgi | 697 +++++++++++++++++++---------- html/cgi-bin/qos.cgi | 47 +- langs/de/cgi-bin/de.pl | 24 +- langs/en/cgi-bin/en.pl | 11 + lfs/squid | 14 +- src/ROOTFILES.i386 | 1 + src/scripts/updatelang | 6 + 12 files changed, 577 insertions(+), 291 deletions(-) create mode 100644 src/scripts/updatelang diff --git a/config/qos/makeqosscripts.pl b/config/qos/makeqosscripts.pl index 13e7eeb344..de5804724d 100644 --- a/config/qos/makeqosscripts.pl +++ b/config/qos/makeqosscripts.pl @@ -553,11 +553,16 @@ print </dev/null 2>&1 + /usr/local/bin/qosd $qossettings{'IMQ_DEV'} >/dev/null 2>&1 + echo "Quality of Service was successfully started!" exit 0 ;; clear|stop) ### RESET EVERYTHING TO A KNOWN STATE + killall -9 qosd # DELETE QDISCS tc qdisc del dev $qossettings{'RED_DEV'} root tc qdisc del dev $qossettings{'IMQ_DEV'} root diff --git a/config/qos/parse-func.pl b/config/qos/parse-func.pl index 9779315ee0..bd0560c25a 100644 --- a/config/qos/parse-func.pl +++ b/config/qos/parse-func.pl @@ -157,8 +157,8 @@ sub parse_class($) { # print "bytes: $bytes\n"."pkts: $pkts\n"; # print "dropped: $dropped\n"."overlimits: $overlimits\n"; } else { - print "$timestamp: ERROR(+1) - Unable to parse (class ${class}_$device): "; - print "\"$tc_output[$i + 1]\"\n"; +# print "$timestamp: ERROR(+1) - Unable to parse (class ${class}_$device): "; +# print "\"$tc_output[$i + 1]\"\n"; $return_val=""; next; } diff --git a/doc/ChangeLog b/doc/ChangeLog index b3714cb0bb..d71007fed6 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,4 +1,11 @@ ------------------------------------------------------------------------ +r267 | ms | 2006-09-02 22:18:51 +0200 (Sat, 02 Sep 2006) | 4 lines + +Hinzugefuegt: + * QoS-Graphen jetzt auch für Unterklassen. +Fix: + * restartsquid killt jetzt auch squidGuard. +------------------------------------------------------------------------ r266 | ms | 2006-09-02 14:21:49 +0200 (Sat, 02 Sep 2006) | 6 lines Geaendert: diff --git a/html/cgi-bin/chpasswd.cgi b/html/cgi-bin/chpasswd.cgi index 41aba2986d..5bc97d2e26 100644 --- a/html/cgi-bin/chpasswd.cgi +++ b/html/cgi-bin/chpasswd.cgi @@ -6,7 +6,7 @@ use CGI qw(param); -$swroot = "/var/ipcop"; +$swroot = "/var/ipfire"; my %cgiparams; my %mainsettings; diff --git a/html/cgi-bin/logs.cgi/proxylog.dat b/html/cgi-bin/logs.cgi/proxylog.dat index 9c0176fa50..b4e622a037 100644 --- a/html/cgi-bin/logs.cgi/proxylog.dat +++ b/html/cgi-bin/logs.cgi/proxylog.dat @@ -6,8 +6,6 @@ # # (c) The SmoothWall Team # -# $Id: proxylog.dat,v 1.4.2.25 2005/07/07 17:32:24 eoberlander Exp $ -# use strict; @@ -28,6 +26,7 @@ undef (@dummy); my %cgiparams=(); my %logsettings=(); my %ips=(); +my %users=(); my %selected=(); my %checked=(); my @log=(); @@ -86,6 +85,7 @@ if ($ENV{'QUERY_STRING'} && $cgiparams{'ACTION'} ne $Lang::tr{'update'}) $cgiparams{'MONTH'} = $temp[1]; $cgiparams{'DAY'} = $temp[2]; $cgiparams{'SOURCE_IP'} = $temp[3]; + $cgiparams{'USERNAME'} = $temp[4]; } if (!($cgiparams{'MONTH'} =~ /^(0|1|2|3|4|5|6|7|8|9|10|11)$/) || @@ -168,6 +168,8 @@ my $daystr = $cgiparams{'DAY'} == 0 ? '' :$cgiparams{'DAY'} <= 9 ? "0$cgiparams{ my $filter = $cgiparams{'ENABLE_FILTER'} eq 'on' ? $cgiparams{'FILTER'} : ''; my $sourceip = $cgiparams{'SOURCE_IP'}; my $sourceall = $cgiparams{'SOURCE_IP'} eq 'ALL' ? 1 : 0; +my $username = $cgiparams{'USERNAME'}; +my $usersall = $cgiparams{'USERNAME'} eq 'ALL' ? 1 : 0; my $lines = 0; my $temp = (); @@ -217,21 +219,23 @@ if ($@ ne '') READ:while () { my ($datetime,$do,$ip,$ray,$me,$far,$url,$so) = split; $ips{$ip}++; + $users{$so}++; # for debug #$lastdatetime = $datetime; # collect lines between date && filter if (( ($datetime>$mintime)&&($datetime<$maxtime)) && !($url =~ /$filter/) && - ((($ip eq $sourceip) || $sourceall))) + ((($ip eq $sourceip) || $sourceall)) && + ((($so eq $username) || $usersall))) { # when standart viewing, just keep in memory the correct slices # it starts a '$start' and size is $viewport # If export, then keep all lines... if ($cgiparams{'ACTION'} eq $Lang::tr{'export'}){ - $log[$lines++] = "$datetime $ip $url"; + $log[$lines++] = "$datetime $ip $so $url"; } else { if ($lines++ < ($start + $Header::viewsize)) { - push(@log,"$datetime $ip $url"); + push(@log,"$datetime $ip $so $url"); if (@log > $Header::viewsize) { shift (@log); } @@ -247,7 +251,7 @@ if ($@ ne '') } close (FILE); } - $gzindex--; # will try next gz file eg 40,39,38,.... because it may have holes when ipcop stopped + $gzindex--; # will try next gz file eg 40,39,38,.... because it may have holes when ipfire stopped # for a long time } @@ -271,6 +275,7 @@ if ($cgiparams{'ACTION'} eq $Lang::tr{'export'}) print "IPFire proxy log\r\n"; print "$Lang::tr{'date'}: $daystr\r\n"; print "Source IP: $cgiparams{'SOURCE_IP'}\r\n"; + print "Username: $cgiparams{'USERNAME'}\r\n"; if ($cgiparams{'ENABLE_FILTER'} eq 'on') { print "Ignore filter: $cgiparams{'FILTER'}\r\n"; } print "\r\n"; @@ -278,22 +283,23 @@ if ($cgiparams{'ACTION'} eq $Lang::tr{'export'}) if ($logsettings{'LOGVIEW_REVERSE'} eq 'on') { @log = reverse @log; } foreach $_ (@log) { - my ($datetime,$ip,$url) = split; + my ($datetime,$ip,$so,$url) = split; my ($SECdt, $MINdt, $HOURdt, $DAYdt, $MONTHdt, $YEARdt) = localtime($datetime); $SECdt = sprintf ("%.02d",$SECdt); $MINdt = sprintf ("%.02d",$MINdt); $HOURdt = sprintf ("%.02d",$HOURdt); if ($cgiparams{'DAY'}==0) { # full month $DAYdt = sprintf ("%.02d",$DAYdt); - print "$DAYdt/$HOURdt:$MINdt:$SECdt $ip $url\n"; + print "$DAYdt/$HOURdt:$MINdt:$SECdt $ip $so $url\n"; } else { - print "$HOURdt:$MINdt:$SECdt $ip $url\n"; + print "$HOURdt:$MINdt:$SECdt $ip $so $url\n"; } } exit; } $selected{'SOURCE_IP'}{$cgiparams{'SOURCE_IP'}} = "selected='selected'"; +$selected{'USERNAME'}{$cgiparams{'USERNAME'}} = "selected='selected'"; $checked{'ENABLE_FILTER'}{'off'} = ''; $checked{'ENABLE_FILTER'}{'on'} = ''; @@ -357,12 +363,26 @@ print <$Lang::tr{'caps all'} END ; -foreach my $ip (keys %ips) { +foreach my $ip (sort keys %ips) { print "\n"; } print < + +   + $Lang::tr{'advproxy NCSA username'}: + + @@ -415,7 +435,8 @@ print < $Lang::tr{'time'} $Lang::tr{'source ip'} -$Lang::tr{'website'} +$Lang::tr{'advproxy NCSA username'} +$Lang::tr{'website'} END ; @@ -426,7 +447,7 @@ foreach $_ (@log) print "\n"; } else { print "\n"; } - my ($datetime,$ip,$url) = split; + my ($datetime,$ip,$so,$url) = split; my ($SECdt, $MINdt, $HOURdt, $DAYdt, $MONTHdt, $YEARdt) = localtime($datetime); $SECdt = sprintf ("%.02d",$SECdt); $MINdt = sprintf ("%.02d",$MINdt); @@ -445,6 +466,7 @@ foreach $_ (@log) print <$DAYdt$HOURdt:$MINdt:$SECdt $ip + $so $part END @@ -473,14 +495,14 @@ END print ""; if ($prev != -1) { - print "$Lang::tr{'older'}"; } + print "$Lang::tr{'older'}"; } else { print "$Lang::tr{'older'}"; } print "\n"; print ""; if ($next >= 0 ) { - print "$Lang::tr{'newer'}"; } + print "$Lang::tr{'newer'}"; } else { print "$Lang::tr{'newer'}"; } print "\n"; diff --git a/html/cgi-bin/proxy.cgi b/html/cgi-bin/proxy.cgi index 22d7757075..888653d85e 100644 --- a/html/cgi-bin/proxy.cgi +++ b/html/cgi-bin/proxy.cgi @@ -4,7 +4,7 @@ # # This code is distributed under the terms of the GPL # -# $Id: advproxy.cgi,v 1.2.1 2006/04/02 00:00:00 marco.s Exp $ +# $Id: advproxy.cgi,v 2.0.0 [beta] 2006/09/03 00:00:00 marco.s Exp $ # use strict; @@ -13,20 +13,22 @@ use strict; #use warnings; #use CGI::Carp 'fatalsToBrowser'; -use IO::Socket; - require '/var/ipfire/general-functions.pl'; require "${General::swroot}/lang.pl"; require "${General::swroot}/header.pl"; +my @squidversion = `/usr/sbin/squid -v`; +my $http_port='81'; +my $https_port='444'; + my %proxysettings=(); my %netsettings=(); my %filtersettings=(); -my %updaccsettings=(); +my %updaccelsettings=(); my %stdproxysettings=(); my %mainsettings=(); my $urlfilter_addon=0; -my $updacclrtr_addon=0; +my $updaccel_addon=0; my %checked=(); my %selected=(); @@ -36,6 +38,9 @@ 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 $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"; + my @useragent=(); my @useragentlist=(); @@ -82,7 +87,8 @@ my $cre_svhosts = "${General::swroot}/proxy/advanced/cre/supervisors"; my $identhosts = "$identdir/hosts"; -my $libexecdir = "/usr/lib/squid"; +my $authdir = "/usr/lib/squid/advproxy/auth"; +my $errordir = "/usr/lib/squid/advproxy/errors"; my $acl_src_subnets = "$acldir/src_subnets.acl"; my $acl_src_banned_ip = "$acldir/src_banned_ip.acl"; @@ -94,8 +100,13 @@ my $acl_src_noaccess_mac = "$acldir/src_noaccess_mac.acl"; my $acl_dst_nocache = "$acldir/dst_nocache.acl"; my $acl_dst_noauth = "$acldir/dst_noauth.acl"; my $acl_dst_throttle = "$acldir/dst_throttle.acl"; +my $acl_ports_safe = "$acldir/ports_safe.acl"; +my $acl_ports_ssl = "$acldir/ports_ssl.acl"; my $acl_include = "$acldir/include.acl"; +my $updaccelversion = 'n/a'; +my $urlfilterversion = 'n/a'; + unless (-d "$acldir") { mkdir("$acldir"); } unless (-d "$ncsadir") { mkdir("$ncsadir"); } unless (-d "$ntlmdir") { mkdir("$ntlmdir"); } @@ -121,6 +132,8 @@ unless (-e $acl_src_noaccess_mac) { system("touch $acl_src_noaccess_mac"); } unless (-e $acl_dst_nocache) { system("touch $acl_dst_nocache"); } unless (-e $acl_dst_noauth) { system("touch $acl_dst_noauth"); } unless (-e $acl_dst_throttle) { system("touch $acl_dst_throttle"); } +unless (-e $acl_ports_safe) { system("touch $acl_ports_safe"); } +unless (-e $acl_ports_ssl) { system("touch $acl_ports_ssl"); } unless (-e $acl_include) { system("touch $acl_include"); } unless (-e $browserdb) { system("touch $browserdb"); } @@ -130,35 +143,32 @@ open FILE, $browserdb; @useragentlist = sort { reverse(substr(reverse(substr($a,index($a,',')+1)),index(reverse(substr($a,index($a,','))),',')+1)) cmp reverse(substr(reverse(substr($b,index($b,',')+1)),index(reverse(substr($b,index($b,','))),',')+1))} grep !/(^$)|(^\s*#)/,; close(FILE); -my %filtersettings=(); -$filtersettings{'CHILDREN'} = '5'; -if (-e "${General::swroot}/urlfilter/settings") { - &General::readhash("${General::swroot}/urlfilter/settings", \%filtersettings); -} - &General::readhash("${General::swroot}/ethernet/settings", \%netsettings); &General::readhash("${General::swroot}/main/settings", \%mainsettings); -if (-e "${General::swroot}/urlfilter/version") { $urlfilter_addon = 1; } -if (-e "${General::swroot}/updacclrtr/version") { $updacclrtr_addon = 1; } +if (-e "${General::swroot}/urlfilter/version") { $urlfilter_addon = 1; } +if (-e "${General::swroot}/updatexlrator/version") { $updaccel_addon = 1; } if ($urlfilter_addon) { $filtersettings{'CHILDREN'} = '5'; if (-e "${General::swroot}/urlfilter/settings") { - &General::readhash("${General::swroot}/urlfilter/settings", \%filtersettings); + &General::readhash("${General::swroot}/urlfilter/settings", \%filtersettings); } + $urlfilterversion = `cat ${General::swroot}/urlfilter/version`; + $urlfilterversion =~ s/([^\s]+).*/$1/; } -if ($updacclrtr_addon) { - $updaccsettings{'ACCELERATORS'} = '10'; - if (-e "${General::swroot}/updacclrtr/settings") { - &General::readhash("${General::swroot}/updacclrtr/settings", \%updaccsettings); +if ($updaccel_addon) { + $updaccelsettings{'CHILDREN'} = '10'; + if (-e "${General::swroot}/updatexlrator/settings") { + &General::readhash("${General::swroot}/updatexlrator/settings", \%updaccelsettings); } + $updaccelversion = `cat ${General::swroot}/updatexlrator/version`; + $updaccelversion =~ s/([^\s]+).*/$1/; } &Header::showhttpheaders(); -$proxysettings{'ENABLE_FILTER'} = 'off'; $proxysettings{'ACTION'} = ''; $proxysettings{'VALID'} = ''; @@ -170,9 +180,12 @@ $proxysettings{'PROXY_PORT'} = '800'; $proxysettings{'VISIBLE_HOSTNAME'} = ''; $proxysettings{'ADMIN_MAIL_ADDRESS'} = ''; $proxysettings{'ERR_LANGUAGE'} = 'English'; +$proxysettings{'ERR_DESIGN'} = 'IPCop'; +$proxysettings{'SUPPRESS_VERSION'} = 'off'; $proxysettings{'FORWARD_VIA'} = 'off'; $proxysettings{'FORWARD_IPADDRESS'} = 'off'; $proxysettings{'FORWARD_USERNAME'} = 'off'; +$proxysettings{'NO_CONNECTION_AUTH'} = 'off'; $proxysettings{'UPSTREAM_PROXY'} = ''; $proxysettings{'UPSTREAM_USER'} = ''; $proxysettings{'UPSTREAM_PASSWORD'} = ''; @@ -232,7 +245,7 @@ $proxysettings{'NTLM_BDC'} = ''; $proxysettings{'NTLM_ENABLE_ACL'} = 'off'; $proxysettings{'NTLM_USER_ACL'} = 'positive'; $proxysettings{'RADIUS_SERVER'} = ''; -$proxysettings{'RADIUS_PORT'} = '1645'; +$proxysettings{'RADIUS_PORT'} = '1812'; $proxysettings{'RADIUS_IDENTIFIER'} = ''; $proxysettings{'RADIUS_SECRET'} = ''; $proxysettings{'RADIUS_ENABLE_ACL'} = 'off'; @@ -246,8 +259,8 @@ if ($urlfilter_addon) { $proxysettings{'ENABLE_FILTER'} = 'off'; } -if ($updacclrtr_addon) { - $proxysettings{'ENABLE_UPDACCEL'} = 'off'; +if ($updaccel_addon) { + $proxysettings{'ENABLE_UPDXLRATOR'} = 'off'; } $ncsa_buttontext = $Lang::tr{'advproxy NCSA create user'}; @@ -312,6 +325,11 @@ if (($proxysettings{'ACTION'} eq $Lang::tr{'save'}) || ($proxysettings{'ACTION'} $errormessage = $Lang::tr{'invalid input'}; goto ERROR; } + if (!(&General::validport($proxysettings{'PROXY_PORT'}))) + { + $errormessage = $Lang::tr{'advproxy errmsg invalid proxy port'}; + goto ERROR; + } if (!($proxysettings{'CACHE_SIZE'} =~ /^\d+/) || ($proxysettings{'CACHE_SIZE'} < 10)) { @@ -345,15 +363,6 @@ if (($proxysettings{'ACTION'} eq $Lang::tr{'save'}) || ($proxysettings{'ACTION'} $errormessage = $Lang::tr{'invalid maximum outgoing size'}; goto ERROR; } - if ($proxysettings{'ENABLE_FILTER'} eq 'on') - { - print FILE < END ; - foreach () { + foreach (<$errordir/*>) { if (-d) { $language = substr($_,rindex($_,"/")+1); print "\n"; @@ -882,12 +903,19 @@ print < -
$Lang::tr{'urlfilter url filter'} + $Lang::tr{'advproxy suppress version'}: + + $Lang::tr{'advproxy error design'}: + - $Lang::tr{'urlfilter enabled'} - -   + $Lang::tr{'advproxy squid version'}: +  [ $squidversion[0] ] +   +  
@@ -896,23 +924,29 @@ print <$Lang::tr{'advproxy upstream proxy'} - $Lang::tr{'advproxy via forwarding'}: + $Lang::tr{'advproxy via forwarding'}: $Lang::tr{'advproxy upstream proxy host:port'} * - $Lang::tr{'advproxy client IP forwarding'}: + $Lang::tr{'advproxy client IP forwarding'}: $Lang::tr{'advproxy upstream username'}: * - $Lang::tr{'advproxy username forwarding'}: + $Lang::tr{'advproxy username forwarding'}: $Lang::tr{'advproxy upstream password'}: * + + $Lang::tr{'advproxy no connection auth'}: + +   +   +
@@ -954,15 +988,15 @@ print < - + - - + + - - + +
$Lang::tr{'advproxy number of L1 dirs'}: - +
@@ -989,33 +1023,62 @@ print < - - + + - - + + - +
$Lang::tr{'advproxy memory replacement policy'}:$Lang::tr{'advproxy memory replacement policy'}:
$Lang::tr{'advproxy cache replacement policy'}:$Lang::tr{'advproxy cache replacement policy'}:
 
$Lang::tr{'advproxy offline mode'}:$Lang::tr{'advproxy offline mode'}:

+ + + + + + + + + + + + + + +
$Lang::tr{'advproxy destination ports'}
$Lang::tr{'advproxy standard ports'}:$Lang::tr{'advproxy ssl ports'}:
+
+ @@ -1031,14 +1094,14 @@ print < @@ -1112,7 +1175,7 @@ if (-e $cre_enabled) { print < - + @@ -1158,13 +1221,14 @@ END END ; } + # ------------------------------------------------------------------- print < - +
$Lang::tr{'advproxy network based access'}
$Lang::tr{'advproxy classroom extensions'}$Lang::tr{'advproxy classroom extensions'}
$Lang::tr{'advproxy time restrictions'}$Lang::tr{'advproxy time restrictions'}
@@ -1347,8 +1411,8 @@ print < - - + +
$Lang::tr{'advproxy throttle mmedia'}:     

@@ -1362,8 +1426,8 @@ print <
$Lang::tr{'advproxy MIME block types'}: *    
    

@@ -1386,8 +1450,8 @@ print < $Lang::tr{'advproxy UA enable filter'}: -   -   +   +   @@ -1438,15 +1502,32 @@ print < + + $Lang::tr{'advproxy url filter'}  [ $urlfilterversion ] + + + $Lang::tr{'advproxy enabled'}: + +   +   + + +
+END +; } + +if ($updaccel_addon) { print < - $Lang::tr{'advproxy update accelerator'} + $Lang::tr{'advproxy update accelerator'}  [ $updaccelversion ] $Lang::tr{'advproxy enabled'}: - +     @@ -1458,7 +1539,7 @@ END print < - $Lang::tr{'advproxy AUTH method'} + $Lang::tr{'advproxy AUTH method'} $Lang::tr{'advproxy AUTH method none'} @@ -1476,7 +1557,7 @@ if (!($proxysettings{'AUTH_METHOD'} eq 'none')) { if (!($proxysettings{'AUTH_MET
- + @@ -1539,8 +1620,8 @@ print < - - + + @@ -1565,7 +1646,7 @@ print <$Lang::tr{'advproxy NCSA min password length'}: - + @@ -1589,9 +1670,9 @@ print < - - - + + + @@ -1650,7 +1731,7 @@ print <$Lang::tr{'advproxy IDENT unauthorized users'} - - - -
$Lang::tr{'advproxy AUTH global settings'}$Lang::tr{'advproxy AUTH global settings'}
$Lang::tr{'advproxy AUTH always required'}:$Lang::tr{'advproxy AUTH always required'}:
  $Lang::tr{'advproxy NCSA redirector bypass'} \'$Lang::tr{'advproxy NCSA grp extended'}\':

 
$Lang::tr{'advproxy IDENT required'}:$Lang::tr{'advproxy AUTH always required'}:$Lang::tr{'advproxy AUTH always required'}:
$Lang::tr{'advproxy IDENT timeout'}: