SOLVED: (WPAD) Export Proxy Config through DHCP

  • Hi,

    how can I export additional dhcp options? I want to export a Proxy PAC file through the webserver of Captive Portal. Is that possible?

    For those that are interested:


  • use a hostname/webserver with a wpad.dat proxy pac

    Enforce it using AD Group Policies
    Click autodetect in the browser

  • Well, the problem is that I don't have admin rights on the maschine using the internet connection. So I wanted to set the option 252 in dhcp (auto-proxy-config) to the proxy.pac exported by captives lighttpd.

    Is it possible to set a custom option in dhcpd?

  • We currently don't support custom options besides the ones listed at services>dhcp server. Setting a prox is unfortunately not one of these options.

  • 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/

    The modifications:


       $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'];
    		/* static arp configuration */
    				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


    one-lease-per-client true;
    deny duplicates;
    +	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

    My proxy script looks like this:

    function FindProxyForURL(url, host)
    if (
         (isPlainHostName(host)) ||
         (dnsDomainIs(host, ".dsl.local")) ||
         (isInNet(host, "", "")) ||
         (isInNet(host, "", "")) ||
         (isInNet(host, "", "")) ||
         (isInNet(host, "", ""))
         return "DIRECT";
    if (
         (isInNet(myIpAddress(), "", ""))
         return "PROXY";