[squid-users] Wpad problem (DNS)

L A Walsh squid-user at tlinx.org
Tue Jul 31 06:23:37 UTC 2018


erdosain9 wrote:
>  tail -f /var/log/squid/access.log | grep 192.168.6.22
> 1532616150.629     77 192.168.6.22 TCP_REFRESH_UNMODIFIED/200 316 GET
> http://www.msftncsi.com/ncsi.txt - HIER_DIRECT/200.81.17.41 text/plain
>   
---
    You may have some different setup, but this is what works
for me and seems to work for IE, FF, Opera et al.

For wpad, the browsers should look up wpad locally, 1st --
with no domain, then FQDN like wpad.xxx.example.com, then
wpad.example.com.  I also have my internal hosts setup to
lookup hosts on nmb -- so it also serves the hostname.

    It shouldn't have to go through the proxy to get the wpad
file -- sorta defeats the purpose.

At a windows prompt, I can do nslookup:
>  nslookup wpad
Server:  ishtar.sc.tlinx.org
Address:  192.168.33.1

Name:    Ishtar.sc.tlinx.org
Address:  192.168.33.1
Aliases:  wpad.sc.tlinx.org

---
or from linux:
>  dig wpad

; <<>> DiG 9.9.5-rpz2+rl.14038.05-P1 <<>> wpad
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 34174
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 2, ADDITIONAL: 2

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;wpad.sc.tlinx.org.   IN  A

;; ANSWER SECTION:
wpad.sc.tlinx.org.  28000 IN  CNAME Ishtar.sc.tlinx.org.
Ishtar.sc.tlinx.org.  28000 IN  A 192.168.33.1
...more stuff deleted...



--- then trying to get wpad.dat:
>  wget --no-proxy http://wpad/wpad.dat
--2018-07-30 23:09:51--  http://wpad/wpad.dat
Resolving wpad (wpad)... 192.168.33.1
Connecting to wpad (wpad)|192.168.33.1|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 1480 (1.4K) [application/octet-stream]
Saving to: ‘wpad.dat’
2018-07-30 23:09:51 (190 MB/s) - ‘wpad.dat’ saved [1480/1480]

and my wpad.dat looks sorta like (BTW -- my socks stuff has never worked 
right, but haven't bothered to track it down, so might wanna ignore it!).
also on my net, web-proxy, socks, etc...all point to same machine.



function FindProxyForURL(url, host) {
    // Some functions available:
    //    isPlainHostName(host)
    //    dnsDomainIs(host,".domainname.org")
    //    localHostOrDomainIs(host, "myhost.mydom.org")  (exact matching)
    //    isResolvable(host) - brwsr may 'longpause' if host !resolvable
    //    isInNet(host, 192.168.3.0, mask)
    //    dnsResolve(host) - returns IP from hostname
    //    shExpMatch(url, "*vpn.domain.com*")
    //    weekdayRange("MON, "FRI")
    //    dateRange("JAN", "MAR")
    //    timeRange(8, 18)
    //    myIpAddress() - my own numeric IP

    // References:
    // see http://en.wikipedia.org/wiki/Proxy_auto-config
    // or http://www.findproxyforurl.com

    var direct = "DIRECT";
    var sc_http_proxy = "PROXY web-proxy.sc.example.org:8118";
    var sc_socks_proxy = "SOCKS socks.sc.example.org:1080";
    var sc_http_w_socks_backup = sc_http_proxy + sc_socks_proxy;
    var news_proto_re = /^s?news://.*$/;
    var news_port_re = /^[^:]+://[^:/]+:(?:119|563)/.*$/;

    if (isInNet(host, "192.168.0.0", "255.255.255.0") ||
            isInNet(host, "192.168.1.0", "255.255.255.0") ||
            isInNet(host, "192.168.100.0", "255.255.255.0") ) {
            return sc_http_proxy;
    }
    if (isInNet(myIpAddress(), "192.168.33.0", "255.255.255.0") {
        if (isPlainHostName(host) || dnsDomainIs(host, ".sc.example.org")
                || dnsDomainIs(host, ".example.org")) {
            return direct;
        } else {
            // 119/563 for news
            if (news_proto_re.exec(url) ||
                news_port_re.exec(url)  ) {
                return sc_socks_proxy;
            }
            return sc_http_proxy;
        }
    }
    return direct;
}

// vim: ts=2 sw=2 syntax=javascript


================

Hope the above helps...it was pretty simple...





More information about the squid-users mailing list