[squid-users] TCP_DENIED/403 3954 CONNECT www.welt.de:443 - HIER_NONE/- text/html

Amos Jeffries squid3 at treenet.co.nz
Wed Jan 6 05:57:23 UTC 2021


On 6/01/21 6:21 am, Wolfgang Paul Rauchholz wrote:
> I run a home server under Centos 7 and squid 3.5.20. The config is still 
> work in progress as I started only today. Any tipps&tricks are welcomed
> The function is as expected when working from my LAN. But when I tested 
> today from my cell phone from outside I received a few TCP_DENIED for 
> web pages that are not part of the blacklists and I can access from my LAN.
> I also tried a few apps (e.g. Twitter, Linkedin, etc..) and none worked. 
> Underneath the config as-is.
> 
> Any idea why I cannot connect?


The provided squid.conf has two types of access permitted through this 
proxy:

1) non-LAN traffic is allowed to anything on the whitelist.

2) LAN traffic is allowed to anything on the whitelist AND anything not 
on the blacklist(s).


So the key question is whether the domains you tried are (or were) on 
the whitelist when you access them from outside the LAN.



> I have two more question I fiddled with and has no success:
> 
>   * Is there a possibility to re-direct certain MACs from the LAN
>     through Squid and others can go direct?

Getting traffic to the proxy is entirely the OS duty. Most OS can route 
or NAT IPv4 packets based on MAC.

Note that if the client is not opening connections to the proxy by 
itself then you need to follow one of the interception configurations on 
the Squid machine. see 
<https://wiki.squid-cache.org/ConfigExamples/Intercept/LinuxRedirect>
Squid needs separate http_port's for the intercepted traffic and the 
normal proxy traffic.


>   * Is there a good howto that describes in detail how autdetect proxy
>     works with wpad.dat. I want that when users are on LAN they go
>     through squid, but when they are travelling they can go direct.
> 


I suggest you have a read of the FAQs 
(<https://wiki.squid-cache.org/SquidFaq/ConfiguringBrowsers>) about how 
proxies can be used by Browsers. In particular the section "Recommended 
network configuration" and links from there.



> Thanks for your help,
> 
> Wolfgang
> 
> 
> 
> #acl localnet src 172.16.0.0/12 <http://172.16.0.0/12>  # RFC1918 
> possible internal network
> #acl localnet src 192.168.0.0/16 <http://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
> # Add wo-lar LAN IP
> acl lan src 10.5.2.0/24 <http://10.5.2.0/24>
> 

FYI: this is what "localnet" ACL is supposed to be set to.

As the squid.conf file itself says:
  # Adapt localnet in the ACL section to list your (internal) IP networks


> # Basic user auth
> #auth_param basic program /usr/lib64/squid/basic_ncsa_auth 
> /etc/squid/.htpasswd
> #auth_param basic children 5
> #auth_param basic realm Squid Basic Authentication
> #auth_param basic credentialsttl 5 hours
> #acl password proxy_auth REQUIRED
> #http_access allow password
> 

FYI: if you ever want to enable auth this should all be down below the 
blacklist http_access lines.


> #
> # Recommended minimum Access Permission configuration:
> #
> # 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
> 

Please re-enable the above lines. They are protecting against whole 
groups of security attacks.


> # Only allow cachemgr access from localhost
> http_access allow localhost manager
> http_access deny manager
> 
> # 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
> #
> acl allowdomains dstdomain "/etc/squid/whitelists/domains"
> acl porn         dstdomain "/etc/squid/blacklists/porn/domains"
> acl drugs        dstdomain "/etc/squid/blacklists/drugs/domains"
> http_access allow allowdomains
> http_access deny porn
> http_access deny drugs
> 
> # 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 localhost
> http_access allow lan
> 
> # And finally deny all other access to this proxy
> http_access deny all


> request_header_access Referer deny all
> request_header_access X-Forwarded-For deny all

You have configured "forwarded_for off" and are not using the clients 
X-Forwarded-For header. Which means the above setting does nothing useful.

> request_header_access Via deny all
> request_header_access Cache-Control deny all
> 

The above breaks HTTP in bad ways. Your clients will not be having a 
good experience without Cache-Control.


Amos


More information about the squid-users mailing list