Andrew McNabb wrote:
> On Mon, Jan 26, 2009 at 10:57:42AM -0700, Michael Torrie wrote:
>> The reason for having tiny proxy first is to make the iptables rules
>> doing transparent proxying very simple.  no redirect to another
>> ipaddress:port needed; makes things very easy to setup on the router and
>> allows for things like fall-back DG boxes.  This is how my relatives are
>> set up with WRT54GL routers and colinux DG installs.
> 
> I would love to see the actual configuration for both cases.  The only
> reason I haven't set up DansGuardian for my home router is that I
> haven't gotten around to figuring out the details.  By the way, how much
> RAM do you need to put DG directly on the router?

At minimum, I'd say 128 MB of RAM.  Especially if you want to use
blacklists, which I have found to be worthwhile.  I forget where I got
my list from (probably a squid guard list) and it's 30 MB!  My Alix
router that I built currently has 256 MB of RAM, but I know from running
colinux that 128 MB is sufficient. Maybe 64.  But certainly not 32 MB of
RAM.  Even with swap on a flash disk on my Asus 500GL premium, DG brings
the router to a halt.  I'd say you want more than 200 MHz of processor
power too.

Here's a quick and easy way to get DG working on your desktop machine,
and have your router use tinyproxy push traffic over to it:
1.  install DG and squid or tinyproxy on your linux machine and make
sure it's working.
2.  install local firewall rules to make sure your machine's traffic
goes through it:
# # Generated by iptables-save v1.3.8 on Fri Jun 27 10:49:36 2008
#
*nat
:PREROUTING ACCEPT [9:690]
:POSTROUTING ACCEPT [3304:231437]
:OUTPUT ACCEPT [3302:231317]
-A OUTPUT -p tcp -m tcp --dport 80 -d 205.156.51.200 -j ACCEPT #noaa.gov
-A OUTPUT -p tcp -m tcp --dport 80 -d 127.0.0.1 -j ACCEPT
-A OUTPUT -p tcp -m tcp --dport 80 -m owner --uid-owner proxy -j ACCEPT
-A OUTPUT -p tcp -m tcp --dport 3128 -m owner --uid-owner proxy -j ACCEPT
-A OUTPUT -p tcp -m tcp --dport 80 -j REDIRECT --to-ports 8080
-A OUTPUT -p tcp -m tcp --dport 3128 -j REDIRECT --to-ports 8080
COMMIT

This assumes DG and tiny or squid is running as the user "proxy."  This
rules makes it so that even though your router has to trust the host the
 DG filter is running on, any web access is still filtered locally, even
root's.

3. install tinyproxy on the router and use this config:
User nobody
Group nogroup
Port 8888
Timeout 600
DefaultErrorFile "/usr/share/tinyproxy/default.html"
StatFile "/usr/share/tinyproxy/stats.html"
Syslog On
LogLevel Error
PidFile "/var/run/tinyproxy.pid"
Upstream <dg filterbox>:8080
MaxClients 100
MinSpareServers 5
MaxSpareServers 10
StartServers 5
MaxRequestsPerChild 0
Allow 127.0.0.1
Allow <your network>/24
ViaProxyName "tinyproxy"
ConnectPort 443
ConnectPort 563

4. Use the following iptables rules on your router:
## transparent proxy rules
# allow proxy filter to access the net -- trust filterbox
iptables -t nat -A prerouting_rule -s <dg filterbox> -p tcp --dport 80
-j ACCEPT

# force all regular web traffic through it.
iptables -t nat -A prerouting_rule -s <yournet>/24 -d ! <yournet>/24 \
-p tcp --dport 80 -j REDIRECT --to-port 8888

iptables -t nat -A prerouting_rule -s <yournet>/24> -d ! <yournet>/24 \
-p tcp --dport 8080 -j REDIRECT --to-port 8888

iptables -t nat -A prerouting_rule -s <yournet>/24> -d ! <yournet>/24 \
-p tcp --dport 3128 -j REDIRECT --to-port 8888


Hope this helps.
--------------------
BYU Unix Users Group 
http://uug.byu.edu/ 

The opinions expressed in this message are the responsibility of their
author.  They are not endorsed by BYU, the BYU CS Department or BYU-UUG. 
___________________________________________________________________
List Info (unsubscribe here): http://uug.byu.edu/mailman/listinfo/uug-list

Reply via email to