Wednesday, November 4, 2009

dansguardian on OSX

sudo port install dansguardian
sudo launchctl load -w /Library/LaunchDaemons/org.macports.dansguardian.plist
sudo mkdir /opt/local/var/run
sudo port install squid
sudo launchctl load -w /Library/LaunchDaemons/org.macports.Squid.plist
Once this is done, one has to force the browsers to go through Dans. For Safari, System Preferences -> Network -> Advanced -> Proxies and set localhost and port 8080 to what you want filtered:

For firefox, it's a little more complicated

1) in /Applications/Firefox.app/Contents/MacOS, create a file named firefox.cfg that contains:
//
lockPref("network.proxy.http", "127.0.0.1");
lockPref("network.proxy.http_port", 8080);
lockPref("network.proxy.ssl", "127.0.0.1");
lockPref("network.proxy.ssl_port", 8080);
lockPref("network.proxy.ftp", "127.0.0.1");
lockPref("network.proxy.ftp_port", 8080);
lockPref("network.proxy.type", 1);
2) edit /Applications/Firefox.app/Contents/MacOS/greprefs/all.js and add these two lines:
pref('general.config.obscure_value', 0);
pref('general.config.filename', 'firefox.cfg');
You'll need to check these every time you upgrade firefox...

6 comments:

Unknown said...

I've gotten dansguardian installed via MacPorts, and it's running on reboot, but it does nothing. What else is needed to make it filter? Web sharing? Proxy server? Proxy config? Any help is appreciated. Darren.

drb80 said...

Darren -- I updated the info above. Let me know if it makes more sense. Thanks!

Anonymous said...

Do you know, whether this will work on Snow Leopard Server? I currently have it working on Leopard Server, but am about to upgrade.

drb80 said...

I don't have easy access to a Snow Leopard Server, but a regular Snow Leopard machine works fine, so I'd be optimistic the Server version would too...

drb80 said...

Once I had to repair permissions on the disk to get squid running from startup -- I don't have a clue as to why...

Anonymous said...

I successfully installed a working copy of DansGuardian on an Xserve running Snow Leopard Server.