how to deploy squid as transparent proxy

Issues related to configuring your network
Post Reply
s4starb4boy
Posts: 6
Joined: 2013/06/03 12:42:03

how to deploy squid as transparent proxy

Post by s4starb4boy » 2013/06/03 13:06:30

Hi to all,
well I am new bie here I want to deploy squid as transparent proxy server I've followed many tutorials but unable to find teh solution for my problem. I mean I am able to brows the internet on client machine but I've to setup proxy server addres on my browser and I also want to use outlook express to send and recieve mail but I coundn't letme shwo you my configuration.

DEVICE=eth0
HWADDR=00:27:0E:23:E3:E8
TYPE=Ethernet
UUID=94f80279-f5e2-42d4-ab0f-a58a10a5c6d8
ONBOOT=yes
NM_CONTROLLED=no
BOOTPROTO=static
IPADDR=192.168.1.51
NETMASK=255.255.255.0
GATEWAY=192.168.1.
---------------------------------------

DEVICE=eth1
HWADDR=00:0D:88:F7:66:55
TYPE=Ethernet
UUID=9cd8c9f5-a61e-4e0b-9e57-2b8b0b705d7a
ONBOOT=yes
NM_CONTROLLED=no
BOOTPROTO=static
IPADDR=192.168.0.253
NETMASK=255.255.255.0
-------------------------------------
/etc/squid/squid.conf

#
# Recommended minimum configuration:
#
acl manager proto cache_object
acl localhost src 127.0.0.1/32 ::1
acl to_localhost dst 127.0.0.0/8 0.0.0.0/32 ::1
acl asg src 192.168.0.0/24
acl blocked_site url_regex -i src "/etc/squid/blocked_site.conf"
http_access deny blocked_site
# 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

acl SSL_ports port 443
acl Safe_ports port 80 # 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





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

# Deny requests to certain unsafe ports
http_access deny !Safe_ports

# Deny CONNECT to other than secure SSL ports
http_access deny CONNECT !SSL_ports

# 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
http_access allow localnet
http_access allow localhost


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



# Squid normally listens to port 3128
http_port 3128 intercept

# We recommend you to use at least the following line.
hierarchy_stoplist cgi-bin ?

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

# Leave coredumps in the first cache dir
coredump_dir /var/spool/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
visible_hostname asg.proxy.srv
---------------------------------------------
iptables configuration

# Generated by iptables-save v1.4.7 on Mon Jun 3 16:59:37 2013
*nat
:PREROUTING ACCEPT [886:92870]
:POSTROUTING ACCEPT [10:1367]
:OUTPUT ACCEPT [8:521]
-A PREROUTING -i eth1 -p tcp -m tcp --dport 80 -j DNAT --to-destination 192.168.0.253:3128
-A PREROUTING -i eth0 -p tcp -m tcp --dport 80 -j REDIRECT --to-ports 3128
COMMIT
# Completed on Mon Jun 3 16:59:37 2013
# Generated by iptables-save v1.4.7 on Mon Jun 3 16:59:37 2013
*filter
:INPUT ACCEPT [161:46738]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [7928:10036929]
-A INPUT -s 192.168.0.0/24 -p tcp -m tcp --dport 3128 -j ACCEPT
-A INPUT -s 192.168.0.0/24 -j ACCEPT
-A FORWARD -s 192.168.0.0/24 -i eth1 -j ACCEPT
COMMIT
# Completed on Mon Jun 3 16:59:37 2013
-------------------------------
/etc/resolve.conf

# Generated by NetworkManager


# No nameservers found; try putting DNS servers into your
# ifcfg files in /etc/sysconfig/network-scripts like so:
#
# DNS1=xxx.xxx.xxx.xxx
# DNS2=xxx.xxx.xxx.xxx
# DOMAIN=lab.foo.com bar.foo.com
nameserver 8.8.8.8
-------------------------------------
/etc/networks

default 0.0.0.0
loopback 127.0.0.0
link-local 169.254.0.0
----------------------------------------
/etc/hosts
127.0.0.1 asg.proxy.srv localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
----------------------------------------
cat /proc/sys/net/ipv4/ip_forward
1
----------------------------------------

what information else you need to fix my problem? please letme know.

what I want??
I want to browse internet on client machine without setting proxy in the abpve stated scenario I am able to use internet on all clients successfully but with the setting of proxy on browser.I've tried to give the gateway(192.168.0.253) on my clients but no way.I also want to send and recieve mails via outlook express POP3. I cant I mean I am unable to do so. please guide me how to set it up?
I can provide all info you need to set it up please help me.

hi_vkkadam
Posts: 74
Joined: 2007/11/05 16:08:34
Location: Pune

how to deploy squid as transparent proxy

Post by hi_vkkadam » 2013/06/03 14:29:42

Hi,

in squid you should allow your lan users and deny all others

and in iptables

MODPROBE=/sbin/modprobe
$MODPROBE iptable_nat
$MODPROBE ip_tables


IPTABLES -t nat -A POSTROUTING -o eth0 -s 192.168.0.0/24 -j SNAT --to-source 192.168.1.51

OR
$IPTABLES -t nat -A POSTROUTING -o $EXTIF -j MASQUERADE

s4starb4boy
Posts: 6
Joined: 2013/06/03 12:42:03

Re: how to deploy squid as transparent proxy

Post by s4starb4boy » 2013/06/04 04:41:35

thanks for your response against my query. I've applied this command on the squid proxy server(centos 6.4)

IPTABLES -t nat -A POSTROUTING -o eth0 -s 192.168.0.0/24 -j SNAT --to-source 192.168.1.51

sorry! but I didn't understand this phase (below)...


(Please tell me where do I need to change these settings?)




Result: same as before(not working) :( its works when I manually set the proxy setting via browser. and please also tell me how to send and receive mails via outlook?

tigalch
QA Team
Posts: 522
Joined: 2012/06/23 17:28:41
Location: Austria

Re: how to deploy squid as transparent proxy

Post by tigalch » 2013/06/04 19:14:30

you might want to take a look [url=http://www.broexperts.com/2013/03/squid-as-transparent-proxy-on-centos-6-4/]here[/url] which explains runing squid in transparent mode on CentOS-6.4.

Re eMailing (besides DNS-setup and a domain) you will need a POP3/IMAP-server and a mailserver. You can take a look [url=http://wiki.centos.org/HowTos/postfix]here[/url] or [url=http://www.krizna.com/centos/setup-mail-server-in-centos-6/]here[/url]. The first describes the steps in CentOS-5 (might need some changes for CentOs-6), the second is a tutorial for duing the same on CentOS-6.

s4starb4boy
Posts: 6
Joined: 2013/06/03 12:42:03

Re: how to deploy squid as transparent proxy

Post by s4starb4boy » 2013/06/05 07:15:22

Thanks @ tigalch
the link you have given to me has already been visited and implemented by me. no way. it is still not working as transparent proxy but working well with proxy setting in browser(when I set 192.168.0.253 as proxy server address and Port=3128). I've followed many links many tutorials I am unable to understand where am I making very tiny mistake.?????????? its really very challenging situation for me but I won't give up and keep try to sort it out .even I've watched videos on youtube and followed them step by step but still I am unable to configure it as transparent proxy server why?????

and you @ tigalch gave me the link to setup mail server? thanks but I need the outlook traffic pass through iptables(net-filter). I need that rule which is probably opening the 25 and 110 port. any way its an other scenario I am focusing on Transparent Proxy Server I don't know where is the tiny mistake. please ask for me any required information you people do need to fix it. I am being curious(crazy) to fix it.thanks in advance.

s4starb4boy
Posts: 6
Joined: 2013/06/03 12:42:03

Re: how to deploy squid as transparent proxy

Post by s4starb4boy » 2013/06/07 03:59:07

sorry @scottro I only posted teh same post on different forum so that may I get any solution from there. I'll delete my post from there.

s4starb4boy
Posts: 6
Joined: 2013/06/03 12:42:03

Re: how to deploy squid as transparent proxy

Post by s4starb4boy » 2013/06/07 04:12:38

thanks! @AStaley



Your client PC's would appear to be running Windows, which version? And are they part of a company domain?

From your first sentence am I right in thinking that the proxy is working, IE you are able to set the proxy within the browser and get out to the internet. If that's the case what you are now looking for is a way to deploy this to the client PC's and also get POP3 working via the proxy? Any reason that POP3 needs to go through the proxy, why not allow it straight out?

Yeah my clients pcs are running windows-xp and few of them running windows-7 and no there is not any domain deployed in our office its WORKGROUP environment.

yes proxy is working I can post here access.log too if you wish.yes I've to manually set proxy setting on all browser and on all PCs and I've here 100 plus clients. I don't want to manually setting up proxy setting on all clients I just want that any PC/CLient connected to our network be entertain itself. here in our office many people come with laptops for presentation and conference hall is in third floor I've to go there many time in the day to setup the setting adn ok in our WORKGROUP environment too I've to set it up manually I want any request for internet pass through proxy automaticaly that is why I want to deploy SQUID as transparent proxy server. and yes for OUT LOOK I want it to by pass the proxy but for that purpose I've to write the iptables rule that is what I am asking for.I don't want PROXY to control outlook sending/recieving there is a iptables rules I've tried different of them but none of them working for me I am againg asking if you need any kind of information, configuration,screens shots. please ask for it I'll give you teh complete info regarding my setup. but please help me to fix this issue.
thanks again.

Post Reply