<div dir="ltr"><div>Hi</div><div>I'm having trouble setting a transparent proxy in our network.</div><div>For testing I've asked our net admin to transparently forward all of my http traffic to squid port but when I try to open a page I get <b style="font-family:verdana,sans-serif;color:rgb(30,30,30);font-size:12px">Access Denied </b><span style="font-family:verdana,sans-serif;color:rgb(30,30,30);font-size:12px">error and a warring about </span><font color="#1e1e1e" face="verdana, sans-serif"><span style="font-size:12px">Forwarding loop.</span></font></div><div><font color="#1e1e1e" face="verdana, sans-serif"><span style="font-size:12px">As you can see in tcpdump squid sends request to it's machine and not to outside and I've no idea why this happens.</span></font></div><div><font color="#1e1e1e" face="verdana, sans-serif"><span style="font-size:12px">Can you help my about this? I feel like I'm missing something tiny here.</span></font></div><div><font color="#1e1e1e" face="verdana, sans-serif"><span style="font-size:12px"><br></span></font></div><div><font color="#1e1e1e" face="verdana, sans-serif"><span style="font-size:12px">Squid box: </span></font><span style="color:rgb(30,30,30);font-family:verdana,sans-serif;font-size:12px">172.16.1.5</span></div><div><span style="color:rgb(30,30,30);font-family:verdana,sans-serif;font-size:12px">My box: </span><span style="color:rgb(30,30,30);font-family:verdana,sans-serif;font-size:12px">192.168.10.122</span></div><div><span style="color:rgb(30,30,30);font-family:verdana,sans-serif;font-size:12px"><br></span></div><div><span style="color:rgb(30,30,30);font-family:verdana,sans-serif;font-size:12px">Thanks</span></div><div><font color="#1e1e1e" face="verdana, sans-serif"><span style="font-size:12px"><br></span></font></div><div><font color="#1e1e1e" face="verdana, sans-serif"><span style="font-size:12px">-------------------- tcpdump -ntAi any port ! 22</span></font></div><div><font color="#1e1e1e" face="verdana, sans-serif"><div style><div><span style="font-size:12px">IP 192.168.10.122.59550 > 172.16.1.5.3128: Flags [S], seq 1494863721, win 29200, options [mss 1460,sackOK,TS val 5421406 ecr 0,nop,wscale 7], length 0</span></div><div><span style="font-size:12px">IP 172.16.1.5.3128 > 192.168.10.122.59550: Flags [S.], seq 2174214961, ack 1494863722, win 14480, options [mss 1460,sackOK,TS val 733876 ecr 5421406,nop,wscale 4], length 0</span></div><div><span style="font-size:12px">IP 192.168.10.122.59550 > 172.16.1.5.3128: Flags [.], ack 1, win 229, options [nop,nop,TS val 5421406 ecr 733876], length 0</span></div><div><span style="font-size:12px">IP 192.168.10.122.59550 > 172.16.1.5.3128: Flags [P.], seq 1:75, ack 1, win 229, options [nop,nop,TS val 5421406 ecr 733876], length 74</span></div><div><span style="font-size:12px">GET / HTTP/1.1</span><br></div><div><span style="font-size:12px">User-Agent: curl/7.38.0</span></div><div><span style="font-size:12px">Host: <a href="http://google.com">google.com</a></span></div><div><span style="font-size:12px">Accept: */*</span></div><div><br></div><div><span style="font-size:12px">IP 172.16.1.5.3128 > 192.168.10.122.59550: Flags [.], ack 75, win 905, options [nop,nop,TS val 733876 ecr 5421406], length 0</span></div><div><span style="font-size:12px">IP 172.16.1.5.59906 > 172.16.1.5.3128: Flags [S], seq 717864720, win 32792, options [mss 16396,sackOK,TS val 733876 ecr 0,nop,wscale 4], length 0</span></div><div><span style="font-size:12px">IP 172.16.1.5.3128 > 172.16.1.5.59906: Flags [S.], seq 2077204582, ack 717864721, win 32768, options [mss 16396,sackOK,TS val 733876 ecr 733876,nop,wscale 4], length 0</span></div><div><span style="font-size:12px">IP 172.16.1.5.59906 > 172.16.1.5.3128: Flags [.], ack 1, win 2050, options [nop,nop,TS val 733876 ecr 733876], length 0</span></div><div><span style="font-size:12px"><b>IP 172.16.1.5.59906 > 172.16.1.5.3128: Flags [P.], seq 1:198, ack 1, win 2050, options [nop,nop,TS val 733876 ecr 733876], length 197</b></span></div><div><span style="font-size:12px">E.....@.@.R............8*...{..g....[......</span></div><div><span style="font-size:12px">..2...2.GET / HTTP/1.1</span></div><div><span style="font-size:12px">User-Agent: curl/7.38.0</span></div><div><span style="font-size:12px">Host: <a href="http://google.com">google.com</a></span></div><div><span style="font-size:12px">Accept: */*</span></div><div><span style="font-size:12px">Via: 1.1 172.16.1.5 (squid/3.4.8)</span></div><div><span style="font-size:12px">X-Forwarded-For: 192.168.10.122</span></div><div><span style="font-size:12px">Cache-Control: max-age=259200</span></div><div><span style="font-size:12px">Connection: keep-alive</span></div><div><span style="font-size:12px"><br></span></div><div><span style="font-size:12px"><br></span></div><div><span style="font-size:12px">IP 172.16.1.5.3128 > 172.16.1.5.59906: Flags [.], ack 198, win 2048, options [nop,nop,TS val 733876 ecr 733876], length 0</span></div><div><span style="font-size:12px">E..4..@.@.M..........8..{..g*.......ZQ.....</span></div><div><span style="font-size:12px">..2...2.</span></div><div><span style="font-size:12px">IP 172.16.1.5.3128 > 172.16.1.5.59906: Flags [P.], seq 1:3633, ack 198, win 2048, options [nop,nop,TS val 733876 ecr 733876], length 3632</span></div><div><span style="font-size:12px">E..d..@.@.?..........8..{..g*.......h......</span></div><div><span style="font-size:12px">..2...2.HTTP/1.1 403 Forbidden</span></div><div><span style="font-size:12px">Server: squid/3.4.8</span></div><div><span style="font-size:12px">Mime-Version: 1.0</span></div><div><span style="font-size:12px">Date: Wed, 15 Apr 2015 10:02:33 GMT</span></div><div><span style="font-size:12px">Content-Type: text/html</span></div><div><span style="font-size:12px">Content-Length: 3268</span></div><div><span style="font-size:12px">X-Squid-Error: ERR_ACCESS_DENIED 0</span></div><div><span style="font-size:12px">Vary: Accept-Language</span></div><div><span style="font-size:12px">Content-Language: en</span></div><div><span style="font-size:12px">X-Cache: MISS from 172.16.1.5</span></div><div><span style="font-size:12px">X-Cache-Lookup: MISS from <a href="http://172.16.1.5:8080">172.16.1.5:8080</a></span></div><div><span style="font-size:12px">Via: 1.1 172.16.1.5 (squid/3.4.8)</span></div><div><span style="font-size:12px">Connection: keep-alive</span></div><div><span style="font-size:12px"><br></span></div><div><span style="font-size:12px"><!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "<a href="http://www.w3.org/TR/html4/strict.dtd">http://www.w3.org/TR/html4/strict.dtd</a>"></span></div><div><span style="font-size:12px"><html><head></span></div><div><span style="font-size:12px"><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></span></div><div><span style="font-size:12px"><title>ERROR: The requested URL could not be retrieved</title></span></div><div><span style="font-size:12px"></head><body id=ERR_ACCESS_DENIED></span></div><div><span style="font-size:12px"><div id="titles"></span></div><div><span style="font-size:12px"><h1>ERROR</h1></span></div><div><span style="font-size:12px"><h2>The requested URL could not be retrieved</h2></span></div><div><span style="font-size:12px"></div></span></div><div><span style="font-size:12px"><hr></span></div><div><span style="font-size:12px"><br></span></div><div><span style="font-size:12px"><div id="content"></span></div><div><span style="font-size:12px"><p>The following error was encountered while trying to retrieve the URL: <a href="<a href="http://google.com/">http://google.com/</a>"><a href="http://google.com/">http://google.com/</a></a></p></span></div><div><span style="font-size:12px"><br></span></div><div><span style="font-size:12px"><blockquote id="error"></span></div><div><span style="font-size:12px"><p><b>Access Denied.</b></p></span></div><div><span style="font-size:12px"></blockquote></span></div><div><br></div><div><span style="font-size:12px"></div></span></div><div><span style="font-size:12px"></body></html></span></div><div><span style="font-size:12px"><br></span></div><div><span style="font-size:12px">IP 172.16.1.5.59906 > 172.16.1.5.3128: Flags [.], ack 3633, win 2048, options [nop,nop,TS val 733876 ecr 733876], length 0</span></div><div><span style="font-size:12px">IP 172.16.1.5.3128 > 192.168.10.122.59550: Flags [P.], seq 1:469, ack 75, win 905, options [nop,nop,TS val 733876 ecr 5421406], length 468</span></div><div><span style="font-size:12px">HTTP/1.1 403 Forbidden</span><br></div><div><span style="font-size:12px">Server: squid/3.4.8</span></div><div><span style="font-size:12px">Mime-Version: 1.0</span></div><div><span style="font-size:12px">Date: Wed, 15 Apr 2015 10:02:33 GMT</span></div><div><span style="font-size:12px">Content-Type: text/html</span></div><div><span style="font-size:12px">Content-Length: 3268</span></div><div><span style="font-size:12px">X-Squid-Error: ERR_ACCESS_DENIED 0</span></div><div><span style="font-size:12px">Vary: Accept-Language</span></div><div><span style="font-size:12px">Content-Language: en</span></div><div><span style="font-size:12px">X-Cache: MISS from 172.16.1.5</span></div><div><span style="font-size:12px">X-Cache-Lookup: MISS from <a href="http://172.16.1.5:8080">172.16.1.5:8080</a></span></div><div><span style="font-size:12px">X-Cache: MISS from 172.16.1.5</span></div><div><span style="font-size:12px">X-Cache-Lookup: MISS from <a href="http://172.16.1.5:8080">172.16.1.5:8080</a></span></div><div><span style="font-size:12px">Via: 1.1 172.16.1.5 (squid/3.4.8), 1.1 172.16.1.5 (squid/3.4.8)</span></div><div><span style="font-size:12px">Connection: keep-alive</span></div><div><span style="font-size:12px"><br></span></div><div><span style="font-size:12px"><br></span></div><div><span style="font-size:12px">IP 172.16.1.5.3128 > 192.168.10.122.59550: Flags [.], seq 469:3365, ack 75, win 905, options [nop,nop,TS val 733876 ecr 5421406], length 2896</span></div><div><span style="font-size:12px"><!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "<a href="http://www.w3.org/TR/html4/strict.dtd">http://www.w3.org/TR/html4/strict.dtd</a>"></span><br></div><div><span style="font-size:12px"><html><head></span></div><div><span style="font-size:12px"><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></span></div><div><span style="font-size:12px"><title>ERROR: The requested URL could not be retrieved</title></span></div><div><span style="font-size:12px">...</span></div><div><span style="font-size:12px"></head><body id=ERR_ACCESS_DENIED></span></div><div><span style="font-size:12px"><div id="titles"></span></div><div><span style="font-size:12px"><h1>ERROR</h1></span></div><div><span style="font-size:12px"><h2>The requested URL could not be retrieved</h2></span></div><div><span style="font-size:12px"></div></span></div><div><span style="font-size:12px"><hr></span></div><div><span style="font-size:12px"><br></span></div><div><span style="font-size:12px"><div id="content"></span></div><div><span style="font-size:12px"><p>The following error was encountered while trying to retrieve the URL: <a href="<a href="http://google.com/">http://google.com/</a>"><a href="http://google.com/">http://google.com/</a></a></p></span></div><div><span style="font-size:12px"><br></span></div><div><span style="font-size:12px"><blockquote id="error"></span></div><div><span style="font-size:12px"><p><b>Access Denied.</b></p></span></div><div><span style="font-size:12px"></blockquote></span></div><div><br></div><div><span style="font-size:12px"></div></span></div><div><span style="font-size:12px"></body></html></span></div><div><span style="font-size:12px"><br></span></div><div><span style="font-size:12px">IP 192.168.10.122.59550 > 172.16.1.5.3128: Flags [.], ack 469, win 237, options [nop,nop,TS val 5421408 ecr 733876], length 0</span></div><div><span style="font-size:12px">IP 192.168.10.122.59550 > 172.16.1.5.3128: Flags [.], ack 1917, win 260, options [nop,nop,TS val 5421408 ecr 733876], length 0</span></div><div><span style="font-size:12px">IP 192.168.10.122.59550 > 172.16.1.5.3128: Flags [.], ack 3365, win 282, options [nop,nop,TS val 5421408 ecr 733876], length 0</span></div><div><span style="font-size:12px">IP 192.168.10.122.59550 > 172.16.1.5.3128: Flags [.], ack 3737, win 305, options [nop,nop,TS val 5421408 ecr 733876], length 0</span></div><div><span style="font-size:12px">IP 192.168.10.122.59550 > 172.16.1.5.3128: Flags [F.], seq 75, ack 3737, win 305, options [nop,nop,TS val 5421408 ecr 733876], length 0</span></div><div><span style="font-size:12px">IP 172.16.1.5.3128 > 192.168.10.122.59550: Flags [F.], seq 3737, ack 76, win 905, options [nop,nop,TS val 733878 ecr 5421408], length 0</span></div><div><span style="font-size:12px">IP 192.168.10.122.59550 > 172.16.1.5.3128: Flags [.], ack 3738, win 305, options [nop,nop,TS val 5421411 ecr 733878], length 0</span></div><div><br></div></div></font></div><div><div>-------------------------- Squid config<br></div></div><div>acl localnet src 0.0.0.1-0.255.255.255  # RFC 1122 "this" network (LAN)</div><div>acl localnet src <a href="http://10.0.0.0/8" target="_blank">10.0.0.0/8</a>     # RFC 1918 local private network (LAN)</div><div>acl localnet src <a href="http://100.64.0.0/10" target="_blank">100.64.0.0/10</a>      # RFC 6598 shared address space (CGN)</div><div>acl localhet src <a href="http://169.254.0.0/16" target="_blank">169.254.0.0/16</a>     # RFC 3927 link-local (directly plugged) machines</div><div>acl localnet src <a href="http://172.16.0.0/12" target="_blank">172.16.0.0/12</a>      # RFC 1918 local private network (LAN)</div><div>acl localnet src <a href="http://192.168.0.0/16" target="_blank">192.168.0.0/16</a>     # RFC 1918 local private network (LAN)</div><div>acl localnet src fc00::/7           # RFC 4193 local private network range</div><div>acl localnet src fe80::/10          # RFC 4291 link-local (directly plugged) machines</div><div>                                                                                                                           </div><div>acl SSL_ports port 443</div><div>acl Safe_ports port 53          # http</div><div>acl Safe_ports port 80          # http</div><div>acl Safe_ports port 21          # ftp</div><div>acl Safe_ports port 443         # https</div><div>acl Safe_ports port 70          # gopher</div><div>acl Safe_ports port 210         # wais</div><div>acl Safe_ports port 1025-65535  # unregistered ports</div><div>acl Safe_ports port 280         # http-mgmt</div><div>acl Safe_ports port 488         # gss-http</div><div>acl Safe_ports port 591         # filemaker</div><div>acl Safe_ports port 777         # multiling http</div><div>acl CONNECT method CONNECT</div><div><br></div><div>#external_acl_type AclHelper %SRC %DST /usr/bin/python /etc/squid3/external_acl.py</div><div>#acl Acl external AclHelper</div><div><br></div><div><div>http_access deny !Safe_ports        # Deny requests to certain unsafe ports</div><div>http_access deny CONNECT !SSL_ports # Deny CONNECT to other than secure SSL ports</div><div>http_access allow localhost manager # Only allow cachemgr access from localhost</div><div>http_access deny manager            # Only allow cachemgr access from localhost</div><div>http_access deny to_localhost</div><div>http_access allow localnet</div><div>http_access allow localhost</div><div>http_access deny all</div></div><div><br></div><div>#ssl_bump server-first all</div><div>#always_direct allow all</div><div><br></div><div>http_port 3128 intercept</div><div>http_port 8080               # avoid ERROR: No forward-proxy ports configured.<br></div><div>#https_port 3129 intercept ssl-bump generate-host-certificates=on dynamic_cert_mem_cache_size=4MB cert=/etc/squid3/custom_csr.pem</div><div><br></div><div>coredump_dir /var/spool/squid3</div><div><br></div><div>refresh_pattern ^ftp:           1440    20%     10080</div><div>refresh_pattern ^gopher:        1440    0%      1440</div><div>refresh_pattern -i (/cgi-bin/|\?) 0     0%      0</div><div>refresh_pattern .               0       20%     4320</div><div><br></div><div>sslcrtd_program /usr/lib/squid3/ssl_crtd -ds /var/spool/squid3_ssldb -M 4MB</div><div>sslproxy_cert_error allow all</div><div>sslproxy_flags DONT_VERIFY_PEER</div><div>sslproxy_cert_adapt setCommonName</div><div><br></div><div>shutdown_lifetime 3 seconds</div><div>visible_hostname squid</div><div><br></div><div>debug_options ALL,1 33,2</div><div><br></div><div>------------------- iptables</div><div><div>root@proxy:~# iptables -L -t filter</div><div>Chain INPUT (policy ACCEPT)</div><div>target     prot opt source               destination</div><div>Chain FORWARD (policy ACCEPT)</div><div>target     prot opt source               destination</div><div>Chain OUTPUT (policy ACCEPT)</div><div>target     prot opt source               destination</div></div><div><br></div><div><div>root@proxy:~# iptables -L -t nat</div><div>Chain PREROUTING (policy ACCEPT)</div><div>target     prot opt source               destination</div><div>Chain INPUT (policy ACCEPT)</div><div>target     prot opt source               destination</div><div>Chain OUTPUT (policy ACCEPT)</div><div>target     prot opt source               destination</div><div>Chain POSTROUTING (policy ACCEPT)</div><div>target     prot opt source               destination</div></div><div><br></div><div><div>root@proxy:~# iptables -L -t mangle</div><div>Chain PREROUTING (policy ACCEPT)</div><div>target     prot opt source               destination</div><div>Chain INPUT (policy ACCEPT)</div><div>target     prot opt source               destination</div><div>Chain FORWARD (policy ACCEPT)</div><div>target     prot opt source               destination</div><div>Chain OUTPUT (policy ACCEPT)</div><div>target     prot opt source               destination</div><div>Chain POSTROUTING (policy ACCEPT)</div><div>target     prot opt source               destination</div></div><div><br></div><div>-------------------- Squid info</div><div><div>root@proxy:~/squid# squid3 -v</div><div>Squid Cache: Version 3.4.8</div><div>Debian linux</div><div>configure options:  '--build=x86_64-linux-gnu' '--prefix=/usr' '--includedir=${prefix}/include' '--mandir=${prefix}/share/man' '--infodir=${prefix}/share/info' '--sysconfdir=/etc' '--localstatedir=/var' '--libexecdir=${prefix}/lib/squid3' '--srcdir=.' '--disable-maintainer-mode' '--disable-dependency-tracking' '--disable-silent-rules' '--datadir=/usr/share/squid3' '--sysconfdir=/etc/squid3' '--mandir=/usr/share/man' '--enable-inline' '--disable-arch-native' '--enable-async-io=8' '--enable-storeio=ufs,aufs,diskd,rock' '--enable-removal-policies=lru,heap' '--enable-delay-pools' '--enable-cache-digests' '--enable-follow-x-forwarded-for' '--enable-icap-client' '--enable-auth-basic=DB,fake,getpwnam,LDAP,MSNT,MSNT-multi-domain,NCSA,NIS,PAM,POP3,RADIUS,SASL,SMB' '--enable-auth-digest=file,LDAP' '--enable-auth-negotiate=kerberos,wrapper' '--enable-auth-ntlm=fake,smb_lm' '--enable-external-acl-helpers=file_userip,kerberos_ldap_group,LDAP_group,session,SQL_session,unix_group,wbinfo_group' '--enable-url-rewrite-helpers=fake' '--enable-eui' '--enable-esi' '--enable-icmp' '--enable-zph-qos' '--enable-ecap' '--disable-translation' '--with-swapdir=/var/spool/squid3' '--with-logdir=/var/log/squid3' '--with-pidfile=/var/run/squid3.pid' '--with-filedescriptors=65536' '--with-large-files' '--with-default-user=proxy' '--enable-ssl' '--enable-ssl-crtd' '--with-openssl' '--enable-build-info=Debian linux' '--enable-linux-netfilter' 'build_alias=x86_64-linux-gnu' 'CFLAGS=-g -O2 -fPIE -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -Wall' 'LDFLAGS=-fPIE -pie -Wl,-z,relro -Wl,-z,now' 'CPPFLAGS=-D_FORTIFY_SOURCE=2' 'CXXFLAGS=-g -O2 -fPIE -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security'</div></div><div><br></div><div><div><div>-------------------------- R<span style="font-size:13px">outer</span> config<br></div><div><div style="font-size:13px">Flags: X - disabled, I - invalid, D - dynamic </div><div style="font-size:13px"> 0   ;;; This rule is being used for testing url-redirector service</div><div style="font-size:13px">     chain=prerouting action=mark-routing new-routing-mark=url-redirector-test-443 passthrough=yes protocol=tcp src-address=192.168.10.122 dst-address=!172.30.30.1 dst-port=443 </div><div style="font-size:13px"> 1   ;;; This rule is being used for testing url-redirector service</div><div style="font-size:13px">     chain=prerouting action=mark-routing new-routing-mark=url-redirector-test-80 passthrough=yes protocol=tcp src-address=192.168.10.122 dst-address=!172.30.30.1 dst-port=80 </div><div style="font-size:13px"><br></div><div style="font-size:13px">Flags: X - disabled, I - invalid, D - dynamic </div><div style="font-size:13px"> 2   ;;; url-test</div><div style="font-size:13px">     chain=dstnat action=dst-nat to-addresses=172.16.1.5 to-ports=3128 protocol=tcp routing-mark=url-redirector-test-80 </div><div style="font-size:13px"> 3   ;;; Url-test</div><div style="font-size:13px">     chain=dstnat action=dst-nat to-addresses=172.16.1.5 to-ports=3129 protocol=tcp routing-mark=url-redirector-test-443 </div></div></div><div><br></div></div>-- <br><div><div dir="ltr"><div><div dir="ltr">Live long and prosper,<div><a href="http://k1h.ir/" target="_blank">K1.H</a></div></div></div></div></div>
</div>