X
X
xaker12016-02-02 11:34:41
linux
xaker1, 2016-02-02 11:34:41

Blocking sites on squid3 tproxy does not work, what could be the problem?

There was a task - at a certain time to block access to the Internet from certain IPs.
I'm trying to implement on Squid3 in tproxy mode.
On the test machine, the default gateway is the IP of the proxy server.
Proxy settings:

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 operators src "/etc/squid3/operators_block.txt"
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
#http_access deny all
http_access allow manager localhost
http_access deny manager
http_access deny !Safe_ports
http_access deny CONNECT !SSL_ports
http_access deny operators
http_access allow localhost
http_access allow all
#http_access deny all
http_port 3128 intercept
http_port 3129 tproxy
cache deny all
coredump_dir /var/spool/squid3
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

iptables:
# Generated by iptables-save v1.4.14 on Tue Feb 2 11:22:59 2016
*mangle
:PREROUTING ACCEPT [2783:307560]
:INPUT ACCEPT [25673:7155810]
:FORWARD ACCEPT [1010:326606]
:OUTPUT ACCEPT [23047 :7271968]
:POSTROUTING ACCEPT [24057:7598574]
:DIVERT - [0:0]
-A PREROUTING -p tcp -m socket -j DIVERT
-A PREROUTING -p tcp -m tcp --dport 80 -j TPROXY --on -port 3129 --on-ip 0.0.0.0 --tproxy-mark 0x1/0x1
-A DIVERT -j MARK --set-xmark 0x1/0xffffffff
-A DIVERT -j ACCEPT
COMMIT
# Completed on Tue Feb 2 11:22: 59 2016
# Generated by iptables-save v1.4.14 on Tue Feb 2 11:22:59 2016
*filter
:INPUT ACCEPT [250578:73336474]
:FORWARD ACCEPT [1798:529894]
:OUTPUT ACCEPT [227736:66644487]
COMMIT
# Completed on Tue Feb 2 11:22:59 2016

As a result, no matter what acl I specify, sites open all the time. If I turn off the proxy - everything stops working. There is no information in the logs about the test machine.
When prescribing a proxy in the system, everything works fine.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
1
1001001, 2016-02-02
@1001001

In my opinion, you all allow
http_access deny operators
http_access allow localhost
http_access allow all

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question