[squid-users] Squid 3.3 Interception Proxy

From: Ethan H <3ethanh_at_gmail.com>
Date: Sat, 30 Mar 2013 18:27:55 -0700

Hi,

I am having trouble setting up a Squid Interception/transparent proxy
server. I am using Ubuntu Server Edition 12.10, Squid 3.3 and a DD-WRT
Router to redirect traffic to the proxy. The script I am using I got
at this link: http://www.dd-wrt.ca/wiki/index.php/Squid_Transparent_Proxy

My exact iptables script is (from that link):

#!/bin/sh
PROXY_IP=192.168.0.10
PROXY_PORT=3127
LAN_IP=`nvram get lan_ipaddr`
LAN_NET=$LAN_IP/`nvram get lan_netmask`

iptables -t nat -A PREROUTING -i br0 -s $LAN_NET -d $LAN_NET -p tcp
--dport 80 -j ACCEPT
iptables -t nat -A PREROUTING -i br0 -s ! $PROXY_IP -p tcp --dport 80
-j DNAT --to $PROXY_IP:$PROXY_PORT
iptables -t nat -I POSTROUTING -o br0 -s $LAN_NET -d $PROXY_IP -p tcp
-j SNAT --to $LAN_IP
iptables -I FORWARD -i br0 -o br0 -s $LAN_NET -d $PROXY_IP -p tcp
--dport $PROXY_PORT -j ACCEPT

I have also tried to use PROXY_PORT 3128 (not 3127) also. I can
successfully edit the PROXY_PORT to 80 (local Apache web server) and
it works, no problem.

My error message I am getting in /var/log/squid/cache.log is:

TIME HERE kid1| NF getsockopt(SO_ORIGINAL_DST) failed on
local=SERVER_IP:3127 remote=ROUTER_IP:62479 FD 20 flags=33: (92)
Protocol not available

In my browser I don't get any error message, just a blank page.

I get this error message every request I try, though the port on the
remote changes each time. My squid.conf is as follows:

#
# Recommended minimum configuration:
#

# Example rule allowing access from your local networks.
# Adapt to list your (internal) IP networks from where browsing
# should be allowed
#acl localnet src 10.0.0.0/8 # RFC1918 possible internal network
#acl localnet src 172.16.0.0/12 # RFC1918 possible internal network
#acl localnet src 192.168.0.0/16 # RFC1918 possible internal network
#acl localnet src fc00::/7 # RFC 4193 local private network range
#acl localnet src fe80::/10 # RFC 4291 link-local (directly
plugged) machines

#HTTP header X-Forwarded-For
forwarded_for transparent #Don't change header sent by client

#VIA (sends proxy header)
via off

#Define error message directory
error_directory /var/www/error

#Log query string in access.log
strip_query_terms off

#Define log file locations
access_log /var/log/squid/access.log
cache_store_log /var/log/squid/store.log
cache_log /var/log/squid/cache.log

# Squid normally listens to port 3128

http_port 3128
http_port 3127 intercept

acl SSL_ports port 443 # Normal SSL port for HTTPS
acl SSL_ports port 8443 # Plesk SSL
acl SSL_ports port 2083 # cPanel SSL
acl Safe_ports port 80 # http
acl Safe_ports port 83 # http
acl Safe_ports port 21 # ftp
acl Safe_ports port 443 # https
acl Safe_ports port 70 # gopher
acl Safe_ports port 210 # wais
acl Safe_ports port 1025-65535 # unregistered ports
acl Safe_ports port 280 # http-mgmt
acl Safe_ports port 488 # gss-http
acl Safe_ports port 591 # filemaker
acl Safe_ports port 777 # multiling http
acl CONNECT method CONNECT

# Deny requests to certain unsafe ports
# Deny CONNECT to other than secure SSL ports

#
# Recommended minimum Access Permission configuration:
#
# Only allow cachemgr access from localhost

# We strongly recommend the following be uncommented to protect innocent
# web applications running on the proxy server who think the only
# one who can access services on "localhost" is a local user
#http_access deny to_localhost

#
# INSERT YOUR OWN RULE(S) HERE TO ALLOW ACCESS FROM YOUR CLIENTS
#

# Example rule allowing access from your local networks.
# Adapt localnet in the ACL section to list your (internal) IP networks
# from where browsing should be allowed

acl localnet src 192.168.0.0/16

cache deny all

http_access deny !Safe_ports
http_access deny CONNECT !SSL_ports
http_access allow localnet

# And finally deny all other access to this proxy
http_access deny all

# Uncomment and adjust the following to add a disk cache directory.
cache_dir ufs /var/cache/squid 100 16 256

# Leave coredumps in the first cache dir
coredump_dir /var/cache/squid

# Add any of your own refresh_pattern entries above these.
refresh_pattern ^ftp: 1440 20% 10080
refresh_pattern ^gopher: 1440 0% 1440
refresh_pattern -i (/cgi-bin/|\?) 0 0% 0
refresh_pattern . 0 20% 4320
cache_effective_user proxy
cache_effective_group proxy
Received on Sun Mar 31 2013 - 01:28:01 MDT

This archive was generated by hypermail 2.2.0 : Mon Apr 01 2013 - 12:00:07 MDT