Saturday, December 17, 2011

Auto-proxy configuration for Safari on OSX Snow Leopard

To get proxy configuration working for Safari on OSX Snow Leopard, utilising WPAD Auto-proxy and Squid proxy on a Debian server:

1. Install Squid - by default Squid listens on port 3128, test your Squid config by manually configuring the proxy settings in a client.

2. Install Apache (or your preferred web server) - add the mime type for ".dat" files:
/etc/apache2/httpd.conf:
 AddType application/x-ns-proxy-autoconfig .dat 

3. Create the WPAD file - see here for a basic example:
http://wiki.debian.org/ProxyAutodetectConf

4. Create the DNS record for wpad.mydomain.local
(Hint: if using Bind9 you must also create the reverse-DNS (ptr) record)

At this stage auto-proxy should be working for other browsers, like IE on Windows.  But OSX Snow Leopard uses mDNS to resolve wpad.local (maybe this is just on .local domains?) - this requires avahi-daemon to be installed and functioning.

5. aptitude install avahi-daemon avahi-discover libnss-mdns avahi-utils
 - this provides the avahi implementation of mDNS.  Use tools to browse the existing mDNS network services:
 avahi-browse --all

6. Now the Debian Apache server needs to advertise it's hostname as wpad:
/etc/avahi/avahi-daemon.conf:
 host-name=wpad


/etc/init.d/avahi-daemon restart
avahi-browse --all

You can use Wireshark to trace and confirm the DNS, mDNS & HTTP transactions.  Install squidview on the Debian server to observe proxy traffic.

No comments:

Post a Comment