Hi, I have integrated the automatic proxy configuration by myself. It is integrated in the gui. Feel free to adopt.
The files to edit:
/usr/local/www/services_dhcp.php
/etc/inc/services.inc
The modifications:
/usr/local/www/services_dhcp.php
$pconfig['failover_peerip'] = $config['dhcpd'][$if]['failover_peerip'];
$pconfig['netmask'] = $config['dhcpd'][$if]['netmask'];
+ $pconfig['wpad'] = $config['dhcpd'][$if]['wpad'];
$ifcfg = $config['interfaces'][$if];
-----
$config['dhcpd'][$if]['next-server'] = $_POST['nextserver'];
$config['dhcpd'][$if]['filename'] = $_POST['filename'];
+ $config['dhcpd'][$if]['wpad'] = $_POST['wpad'];
write_config();
/* static arp configuration */
interfaces_staticarp_configure($if);
-----
Leave blank to disable. Enter the REAL address of the other machine. Machines must be using CARP.
+
+ Automatic Proxy URL
+
+
+
+ This is the URL to the automatic proxy script.
+
+
Static ARP
/etc/inc/services.inc
one-lease-per-client true;
deny duplicates;
EOD;
+ if (isset($dhcpifconf['wpad'])) {
+ $dhcpdconf .= "option wpad-url code 252 = text;"."\n";
+ $dhcpdconf .= "option wpad-url \"".$dhcpifconf['wpad']."\\n\";"."\n";
+ }
$dhcpdifs = array();
/* loop through and deterimine if we need to setup
* failover peer "bleh" entries
With these slight modifications, there will be an extra field in the dhcp configuration where you can enter the URL to your proxy.pac. I have copied my proxy.pac to /usr/local/captiveportal/captiveportal-proxy.pac and have entered in the Automatic proxy field http://192.168.0.1:8000/captiveportal-proxy.pac.
My proxy script looks like this:
function FindProxyForURL(url, host)
{
if (
(isPlainHostName(host)) ||
(dnsDomainIs(host, ".dsl.local")) ||
(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"))
)
return "DIRECT";
else
if (
(isInNet(myIpAddress(), "192.168.0.0", "255.255.255.0"))
)
return "PROXY 192.168.0.1:3128";
}
Cheers,
Manuel