diff --git a/html/cgi-bin/proxy.cgi b/html/cgi-bin/proxy.cgi index e349dfd14..c6410da28 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 Michael Tremer & Christian Schmidt # +# Copyright (C) 2008 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 # @@ -18,6 +18,13 @@ # along with this program. If not, see . # # # ############################################################################### +# +# (c) 2004-2008 marco.s - http://www.advproxy.net +# +# This code is distributed under the terms of the GPL +# +# $Id: advproxy.cgi,v 3.0.0 2008/08/18 00:00:00 marco.s Exp $ +# use strict; @@ -112,8 +119,14 @@ my $acl_src_unrestricted_ip = "$acldir/src_unrestricted_ip.acl"; my $acl_src_unrestricted_mac = "$acldir/src_unrestricted_mac.acl"; my $acl_src_noaccess_ip = "$acldir/src_noaccess_ip.acl"; 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_noauth_dom = "$acldir/dst_noauth_dom.acl"; +my $acl_dst_noauth_net = "$acldir/dst_noauth_net.acl"; +my $acl_dst_noauth_url = "$acldir/dst_noauth_url.acl"; +my $acl_dst_nocache = "$acldir/dst_nocache.acl"; +my $acl_dst_nocache_dom = "$acldir/dst_nocache_dom.acl"; +my $acl_dst_nocache_net = "$acldir/dst_nocache_net.acl"; +my $acl_dst_nocache_url = "$acldir/dst_nocache_url.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"; @@ -144,8 +157,14 @@ unless (-e $acl_src_unrestricted_ip) { system("touch $acl_src_unrestricted_ip") unless (-e $acl_src_unrestricted_mac) { system("touch $acl_src_unrestricted_mac"); } unless (-e $acl_src_noaccess_ip) { system("touch $acl_src_noaccess_ip"); } 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_noauth) { system("touch $acl_dst_noauth"); } +unless (-e $acl_dst_noauth_dom) { system("touch $acl_dst_noauth_dom"); } +unless (-e $acl_dst_noauth_net) { system("touch $acl_dst_noauth_net"); } +unless (-e $acl_dst_noauth_url) { system("touch $acl_dst_noauth_url"); } +unless (-e $acl_dst_nocache) { system("touch $acl_dst_nocache"); } +unless (-e $acl_dst_nocache_dom) { system("touch $acl_dst_nocache_dom"); } +unless (-e $acl_dst_nocache_net) { system("touch $acl_dst_nocache_net"); } +unless (-e $acl_dst_nocache_url) { system("touch $acl_dst_nocache_url"); } 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"); } @@ -329,8 +348,11 @@ if (($proxysettings{'ACTION'} eq $Lang::tr{'save'}) || ($proxysettings{'ACTION'} if (!($proxysettings{'CACHE_SIZE'} =~ /^\d+/) || ($proxysettings{'CACHE_SIZE'} < 10)) { - $errormessage = $Lang::tr{'advproxy errmsg hdd cache size'}; - goto ERROR; + if (!($proxysettings{'CACHE_SIZE'} eq '0')) + { + $errormessage = $Lang::tr{'advproxy errmsg hdd cache size'}; + goto ERROR; + } } if (!($proxysettings{'CACHE_MEM'} =~ /^\d+/) || ($proxysettings{'CACHE_MEM'} < 1)) @@ -503,6 +525,10 @@ if (($proxysettings{'ACTION'} eq $Lang::tr{'save'}) || ($proxysettings{'ACTION'} $errormessage = $Lang::tr{'advproxy errmsg invalid bdc'}; goto ERROR; } + + $proxysettings{'NTLM_DOMAIN'} = lc($proxysettings{'NTLM_DOMAIN'}); + $proxysettings{'NTLM_PDC'} = lc($proxysettings{'NTLM_PDC'}); + $proxysettings{'NTLM_BDC'} = lc($proxysettings{'NTLM_BDC'}); } if ($proxysettings{'AUTH_METHOD'} eq 'radius') { @@ -588,6 +614,9 @@ ERROR: if (-e "${General::swroot}/proxy/settings") { &General::readhash("${General::swroot}/proxy/settings", \%stdproxysettings); } $stdproxysettings{'PROXY_PORT'} = $proxysettings{'PROXY_PORT'}; + $stdproxysettings{'UPSTREAM_PROXY'} = $proxysettings{'UPSTREAM_PROXY'}; + $stdproxysettings{'UPSTREAM_USER'} = $proxysettings{'UPSTREAM_USER'}; + $stdproxysettings{'UPSTREAM_PASSWORD'} = $proxysettings{'UPSTREAM_PASSWORD'}; $stdproxysettings{'ENABLE_FILTER'} = $proxysettings{'ENABLE_FILTER'}; $stdproxysettings{'ENABLE_UPDXLRATOR'} = $proxysettings{'ENABLE_UPDXLRATOR'}; $stdproxysettings{'ENABLE_CLAMAV'} = $proxysettings{'ENABLE_CLAMAV'}; @@ -953,19 +982,28 @@ print <$Lang::tr{'advproxy upstream proxy'} - $Lang::tr{'advproxy via forwarding'}: - $Lang::tr{'advproxy upstream proxy host:port'} + $Lang::tr{'advproxy via forwarding'}: + + $Lang::tr{'advproxy upstream proxy host:port'} + - $Lang::tr{'advproxy client IP forwarding'}: - $Lang::tr{'advproxy upstream username'} + $Lang::tr{'advproxy client IP forwarding'}: + + $Lang::tr{'advproxy upstream username'}: + - $Lang::tr{'advproxy username forwarding'}: - $Lang::tr{'advproxy upstream password'}: + $Lang::tr{'advproxy username forwarding'}: + + $Lang::tr{'advproxy upstream password'}: + - $Lang::tr{'advproxy no connection auth'}: + $Lang::tr{'advproxy no connection auth'}: + + + @@ -974,9 +1012,16 @@ print <$Lang::tr{'advproxy log settings'} - $Lang::tr{'advproxy log enabled'}: - $Lang::tr{'advproxy log query'}: - $Lang::tr{'advproxy log useragent'}: + $Lang::tr{'advproxy log enabled'}: + + $Lang::tr{'advproxy log query'}: + + + + + + $Lang::tr{'advproxy log useragent'}: + @@ -985,7 +1030,7 @@ print <$Lang::tr{'advproxy cache management'} - + $Lang::tr{'advproxy ram cache size'}: @@ -1023,7 +1068,7 @@ print < - + END ; @@ -2166,7 +2211,7 @@ if (-e $disgrp) # If the password file contains entries, print entries and action icons -if ( $userdb ne "" ) { +if ( ! -z "$userdb" ) { print < $Lang::tr{'advproxy NCSA username'} @@ -2419,10 +2464,11 @@ sub check_acls undef $proxysettings{'DST_NOCACHE'}; foreach (@temp) { - s/^\s+//g; s/\s+$//g; + s/^\s+//g; + unless (/^#/) { s/\s+//g; } if ($_) { - unless (/^\./) { $_ = '.'.$_; } + if (/^\./) { $_ = '*'.$_; } $proxysettings{'DST_NOCACHE'} .= $_."\n"; } } @@ -2488,13 +2534,13 @@ sub check_acls } @temp = split(/\n/,$proxysettings{'DST_NOAUTH'}); - undef $proxysettings{'DST_NOAUTH'}; foreach (@temp) { - s/^\s+//g; s/\s+$//g; + s/^\s+//g; + unless (/^#/) { s/\s+//g; } if ($_) { - unless (/^\./) { $_ = '.'.$_; } + if (/^\./) { $_ = '*'.$_; } $proxysettings{'DST_NOAUTH'} .= $_."\n"; } } @@ -2632,15 +2678,103 @@ sub write_acls print FILE $proxysettings{'SRC_UNRESTRICTED_MAC'}; close(FILE); + open(FILE, ">$acl_dst_noauth"); + flock(FILE, 2); + print FILE $proxysettings{'DST_NOAUTH'}; + close(FILE); + + open(FILE, ">$acl_dst_noauth_net"); + close(FILE); + open(FILE, ">$acl_dst_noauth_dom"); + close(FILE); + open(FILE, ">$acl_dst_noauth_url"); + close(FILE); + + @temp = split(/\n/,$proxysettings{'DST_NOAUTH'}); + foreach(@temp) + { + unless (/^#/) + { + if (/^\*\.\w/) + { + s/^\*//; + open(FILE, ">>$acl_dst_noauth_dom"); + flock(FILE, 2); + print FILE "$_\n"; + close(FILE); + } + elsif (&General::validipormask($_)) + { + open(FILE, ">>$acl_dst_noauth_net"); + flock(FILE, 2); + print FILE "$_\n"; + close(FILE); + } + elsif (/\d\d?\d?\.\d\d?\d?\.\d\d?\d?\.\d\d?\d?-\d\d?\d?\.\d\d?\d?\.\d\d?\d?\.\d\d?\d?/) + { + open(FILE, ">>$acl_dst_noauth_net"); + flock(FILE, 2); + print FILE "$_\n"; + close(FILE); + } + else + { + open(FILE, ">>$acl_dst_noauth_url"); + flock(FILE, 2); + if (/^[fh]tt?ps?:\/\//) { print FILE "$_\n"; } else { print FILE "^[fh]tt?ps?://$_\n"; } + close(FILE); + } + } + } + open(FILE, ">$acl_dst_nocache"); flock(FILE, 2); print FILE $proxysettings{'DST_NOCACHE'}; close(FILE); - open(FILE, ">$acl_dst_noauth"); - flock(FILE, 2); - print FILE $proxysettings{'DST_NOAUTH'}; + open(FILE, ">$acl_dst_nocache_net"); close(FILE); + open(FILE, ">$acl_dst_nocache_dom"); + close(FILE); + open(FILE, ">$acl_dst_nocache_url"); + close(FILE); + + @temp = split(/\n/,$proxysettings{'DST_NOCACHE'}); + foreach(@temp) + { + unless (/^#/) + { + if (/^\*\.\w/) + { + s/^\*//; + open(FILE, ">>$acl_dst_nocache_dom"); + flock(FILE, 2); + print FILE "$_\n"; + close(FILE); + } + elsif (&General::validipormask($_)) + { + open(FILE, ">>$acl_dst_nocache_net"); + flock(FILE, 2); + print FILE "$_\n"; + close(FILE); + } + elsif (/\d\d?\d?\.\d\d?\d?\.\d\d?\d?\.\d\d?\d?-\d\d?\d?\.\d\d?\d?\.\d\d?\d?\.\d\d?\d?/) + { + open(FILE, ">>$acl_dst_nocache_net"); + flock(FILE, 2); + print FILE "$_\n"; + close(FILE); + } + else + { + open(FILE, ">>$acl_dst_nocache_url"); + flock(FILE, 2); + if (/^[fh]tt?ps?:\/\//) { print FILE "$_\n"; } else { print FILE "^[fh]tt?ps?://$_\n"; } + close(FILE); + } + } + } open(FILE, ">$acl_ports_safe"); flock(FILE, 2); @@ -2745,8 +2879,8 @@ if ( (dnsDomainIs(host, ".$mainsettings{'DOMAINNAME'}")) || (isInNet(host, "10.0.0.0", "255.0.0.0")) || (isInNet(host, "172.16.0.0", "255.240.0.0")) || - (isInNet(host, "169.254.0.0", "255.255.0.0")) || - (isInNet(host, "192.168.0.0", "255.255.0.0")) + (isInNet(host, "192.168.0.0", "255.255.0.0")) || + (isInNet(host, "169.254.0.0", "255.255.0.0")) ) return "DIRECT"; @@ -2863,15 +2997,22 @@ END print FILE "\n"; } - print FILE < 0) + { + print FILE "\n"; -acl QUERY urlpath_regex cgi-bin \\? -cache deny QUERY -END - ; - if (!-z $acl_dst_nocache) { - print FILE "acl no_cache_domains dstdomain \"$acl_dst_nocache\"\n"; - print FILE "cache deny no_cache_domains\n"; + if (!-z $acl_dst_nocache_dom) { + print FILE "acl no_cache_domains dstdomain \"$acl_dst_nocache_dom\"\n"; + print FILE "cache deny no_cache_domains\n"; + } + if (!-z $acl_dst_nocache_net) { + print FILE "acl no_cache_domains dst \"$acl_dst_nocache_net\"\n"; + print FILE "cache deny no_cache_ipaddr\n"; + } + if (!-z $acl_dst_nocache_url) { + print FILE "acl no_cache_hosts url_regex -i \"$acl_dst_nocache_url\"\n"; + print FILE "cache deny no_cache_hosts\n"; + } } print FILE <) { $_ =~ s/__GREEN_IP__/$netsettings{'GREEN_ADDRESS'}/; $_ =~ s/__GREEN_NET__/$netsettings{'GREEN_NETADDRESS'}\/$netsettings{'GREEN_NETMASK'}/; @@ -3219,7 +3370,7 @@ END $_ =~ s/__PROXY_PORT__/$proxysettings{'PROXY_PORT'}/; print FILE $_; } - print FILE "#End of custom includes\n"; + print FILE "\n#End of custom includes\n"; 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"; } @@ -3230,8 +3381,8 @@ END http_access allow localhost #GUI admin if local machine connects -http_access allow IPCop_ips IPCop_networks IPCop_http -http_access allow CONNECT IPCop_ips IPCop_networks IPCop_https +http_access allow IPFire_ips IPFire_networks IPFire_http +http_access allow CONNECT IPFire_ips IPFire_networks IPFire_https #Deny not web services http_access deny !Safe_ports @@ -3311,14 +3462,14 @@ if ($delaypools) { print FILE "\n"; } - print FILE "delay_access 1 deny IPCop_ips\n"; - if (!-z $acl_src_unrestricted_ip) { print FILE "delay_access 1 deny IPCop_unrestricted_ips\n"; } - if (!-z $acl_src_unrestricted_mac) { print FILE "delay_access 1 deny IPCop_unrestricted_mac\n"; } + print FILE "delay_access 1 deny IPFire_ips\n"; + if (!-z $acl_src_unrestricted_ip) { print FILE "delay_access 1 deny IPFire_unrestricted_ips\n"; } + if (!-z $acl_src_unrestricted_mac) { print FILE "delay_access 1 deny IPFire_unrestricted_mac\n"; } if (($proxysettings{'AUTH_METHOD'} eq 'ncsa') && (!-z $extgrp)) { print FILE "delay_access 1 deny for_extended_users\n"; } if ($netsettings{'BLUE_DEV'}) { - print FILE "delay_access 1 allow IPCop_green_network"; + print FILE "delay_access 1 allow IPFire_green_network"; if (!-z $acl_dst_throttle) { print FILE " for_throttled_urls"; } print FILE "\n"; print FILE "delay_access 1 deny all\n"; @@ -3330,11 +3481,11 @@ if ($delaypools) { if ($netsettings{'BLUE_DEV'}) { - print FILE "delay_access 2 deny IPCop_ips\n"; - if (!-z $acl_src_unrestricted_ip) { print FILE "delay_access 2 deny IPCop_unrestricted_ips\n"; } - if (!-z $acl_src_unrestricted_mac) { print FILE "delay_access 2 deny IPCop_unrestricted_mac\n"; } + print FILE "delay_access 2 deny IPFire_ips\n"; + if (!-z $acl_src_unrestricted_ip) { print FILE "delay_access 2 deny IPFire_unrestricted_ips\n"; } + if (!-z $acl_src_unrestricted_mac) { print FILE "delay_access 2 deny IPFire_unrestricted_mac\n"; } if (($proxysettings{'AUTH_METHOD'} eq 'ncsa') && (!-z $extgrp)) { print FILE "delay_access 2 deny for_extended_users\n"; } - print FILE "delay_access 2 allow IPCop_blue_network"; + print FILE "delay_access 2 allow IPFire_blue_network"; if (!-z $acl_dst_throttle) { print FILE " for_throttled_urls"; } print FILE "\n"; print FILE "delay_access 2 deny all\n"; @@ -3347,40 +3498,67 @@ if ($delaypools) { if ($proxysettings{'NO_PROXY_LOCAL'} eq 'on') { print FILE "#Prevent internal proxy access to Green\n"; - print FILE "http_access deny IPCop_green_servers !IPCop_green_network\n\n"; + print FILE "http_access deny IPFire_green_servers !IPFire_green_network\n\n"; } if ($proxysettings{'NO_PROXY_LOCAL_BLUE'} eq 'on') { print FILE "#Prevent internal proxy access from Blue\n"; - print FILE "http_access allow IPCop_blue_network IPCop_blue_servers\n"; - print FILE "http_access deny IPCop_blue_network IPCop_servers\n\n"; + print FILE "http_access allow IPFire_blue_network IPFire_blue_servers\n"; + print FILE "http_access deny IPFire_blue_network IPFire_servers\n\n"; } print FILE < 0) + { + print FILE < 0) { - if (!-z $acl_src_unrestricted_ip) { print FILE "reply_body_max_size 0 allow IPCop_unrestricted_ips\n"; } - if (!-z $acl_src_unrestricted_mac) { print FILE "reply_body_max_size 0 allow IPCop_unrestricted_mac\n"; } + if (!-z $acl_src_unrestricted_ip) { print FILE "reply_body_max_size 0 allow IPFire_unrestricted_ips\n"; } + if (!-z $acl_src_unrestricted_mac) { print FILE "reply_body_max_size 0 allow IPFire_unrestricted_mac\n"; } if ($proxysettings{'AUTH_METHOD'} eq 'ncsa') { if (!-z $extgrp) { print FILE "reply_body_max_size 0 allow for_extended_users\n"; } @@ -3679,7 +3864,8 @@ END } elsif ($proxysettings{'FORWARD_USERNAME'} eq 'on') { print FILE " login=*:password"; } - print FILE "\nnever_direct allow all\n\n"; + print FILE "\nalways_direct allow IPFire_ips\n"; + print FILE "never_direct allow all\n\n"; } if (($proxysettings{'ENABLE_FILTER'} eq 'on') || ($proxysettings{'ENABLE_UPDXLRATOR'} eq 'on') || ($proxysettings{'ENABLE_CLAMAV'} eq 'on')) { diff --git a/lfs/squid b/lfs/squid index 2e5d51ce6..80e14f017 100644 --- a/lfs/squid +++ b/lfs/squid @@ -77,7 +77,7 @@ $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects)) --localstatedir=/var --sysconfdir=/etc/squid \ --disable-poll --disable-snmp --disable-icmp --disable-wccp \ --disable-http-violations --disable-ident-lookups \ - --enable-storeio="aufs,coss,diskd,ufs" --enable-ssl \ + --enable-storeio="aufs,coss,diskd,ufs,null" --enable-ssl \ --enable-underscores --enable-ntlm-fail-open --enable-arp-acl \ --enable-http-violations --enable-auth=basic,ntlm \ --enable-removal-policies="heap,lru" \ diff --git a/lfs/squidclamav b/lfs/squidclamav index 083b246f1..e753ca0ab 100644 --- a/lfs/squidclamav +++ b/lfs/squidclamav @@ -24,7 +24,7 @@ include Config -VER = 3.6 +VER = 3.7 THISAPP = squidclamav-$(VER) DL_FILE = $(THISAPP).tar.gz @@ -32,7 +32,7 @@ DL_FROM = $(URL_IPFIRE) DIR_APP = $(DIR_SRC)/$(THISAPP) TARGET = $(DIR_INFO)/$(THISAPP) PROG = squidclamav -PAK_VER = 2 +PAK_VER = 3 DEPS = "clamav" @@ -44,7 +44,7 @@ objects = $(DL_FILE) $(DL_FILE) = $(DL_FROM)/$(DL_FILE) -$(DL_FILE)_MD5 = ead0556e126dcab957175c4088167133 +$(DL_FILE)_MD5 = 95a3f81133edfb6a905f491f994f7d95 install : $(TARGET)