Franz Sirl schrieb:
Peter Warasin schrieb:
Hi
Franz Sirl wrote:
So I suggest the attached simple patch to /home/httpd/html/proxy.pac.
Applied, thank you!
Hi,
I want to refine it a bit more, we don't want "transparent proxy" at our
site, so "PROXY a.b.c.d; DIRECT;" makes no sense. Unfortunately I
couldn't find the EFW setting that tells me if EFW is in transparent
mode or not. And /etc/squid/squid.conf always has the line "http_port
0.0.0.0:8080 transparent", regardless of the GUI setting for transparent
proxy.
So what is the right setting to check in the proxy.pac perl-script to
get rid of the "DIRECT;"?
Hi,
after some more investigate I've come up with the attached patch that
only outputs "DIRECT;" if for example PROXY_GREEN equals "transparent".
Franz.
--- /home/httpd/html/proxy.pac.v2 2008-06-05 13:39:26.000000000 +0200
+++ /home/httpd/html/proxy.pac 2008-06-05 13:41:17.000000000 +0200
@@ -32,7 +32,6 @@
use CGI();
use Net::IPv4Addr qw (:all);
-my %conf;
my %netsettings;
my $swroot = "/var/efw/";
@@ -58,9 +57,10 @@
;
}
-sub printpac($$$) {
+sub printpac($$$$) {
my $ip = shift;
my $port = shift;
+ my $mode = shift;
my $zone_nets = shift;
print <<END
@@ -76,7 +76,7 @@
foreach my $net (split(/,/, $zone_nets)) {
my ($netaddr, $netmask) = ipv4_network($net);
- my $netmask = ipv4_cidr2msk($netmask);
+ $netmask = ipv4_cidr2msk($netmask);
print <<END
else if (isInNet(host, "$netaddr", "$netmask"))
return "DIRECT";
@@ -85,17 +85,15 @@
}
print <<END
-
else
END
;
if ($ip eq '' || $port eq '') {
print ' return "DIRECT";';
} else {
- print <<END
- return "PROXY $ip:$port; DIRECT;";
-END
-;
+ print qq{ return "PROXY $ip:$port;};
+ print ' DIRECT;' if ($mode eq 'transparent');
+ print '";';
}
print "\n}";
}
@@ -155,6 +153,14 @@
return "";
}
+sub get_mode($) {
+ my $zone = shift;
+ my %conf;
+ $zone = uc($zone);
+ readhash($PROXY_SETTINGS, \%conf);
+ return $conf{'PROXY_$zone'};
+}
+
sub get_ip($$) {
my $zone = shift;
my $ip = shift;
@@ -203,5 +209,5 @@
my $zone = calculate_zone($ENV{'REMOTE_ADDR'});
showhttpheaders();
-printpac(get_ip($zone, $ENV{'REMOTE_ADDR'}), get_port($zone),
$net_conf{$zone.'_IPS'});
+printpac(get_ip($zone, $ENV{'REMOTE_ADDR'}), get_port($zone), get_mode($zone),
$net_conf{$zone.'_IPS'});
exit(0);
-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
Efw-user mailing list
Efw-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/efw-user