Squid透明代理不拦截

Squid透明代理不拦截

我已经在centos 8上将squid配置为透明代理。squid没有拦截或部署在我的配置之下。

#
# 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 0.0.0.1-0.255.255.255 # RFC 1122 "this" network (LAN)
#acl localnet src 10.0.0.0/8        # RFC 1918 local private network (LAN)
#acl localnet src 100.64.0.0/10     # RFC 6598 shared address space (CGN)
#acl localnet src 169.254.0.0/16    # RFC 3927 link-local (directly plugged) machines
#acl localnet src 172.16.0.0/12     # RFC 1918 local private network (LAN)
#acl localnet src 192.168.0.0/16        # RFC 1918 local private network (LAN)
#acl localnet src fc00::/7          # RFC 4193 local private network range
#acl localnet src fe80::/10         # RFC 4291 link-local (directly plugged) machines

acl localnet src 172.30.0.0/24

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:
#
# 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

# 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
#badsites
acl badsite url_regex "/etc/squid/block"
http_access deny badsite

# 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

# Squid normally listens to port 3128
http_port 31229
http_port 172.30.0.223:3128 transparent

# 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

# ADMINISTRATIVE PARAMETERS
# -----------------------------------------------------------------------------

#  TAG: cache_mgr
#   Email-address of local cache manager who will receive
#   mail if the cache dies.  The default is "webmaster".
cache_mgr [email protected]
#Default:
# cache_mgr webmaster

#  TAG: visible_hostname
visible_hostname AJ-Group.local

iptables

# Generated by iptables-save v1.8.4 on Wed Nov  3 09:49:49 2021
*filter
:INPUT ACCEPT [9038:1043246]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [5542:835350]
-A INPUT -s 172.30.0.0/24 -p tcp -m tcp --dport 3128 -j ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 3128 -j ACCEPT
-A INPUT -p udp -m state --state NEW -m udp --dport 53 -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 8080 -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 443 -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 389 -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 22 -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 23 -j ACCEPT
-A INPUT -p udp -m state --state NEW -m udp --dport 21 -j ACCEPT
-A INPUT -p udp -m state --state NEW -m udp --dport 20 -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 20 -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 10000 -j ACCEPT
-A INPUT -p icmp -j ACCEPT
-A INPUT -j DROP
-A FORWARD -o lo -j ACCEPT
-A FORWARD -m state --state RELATED,ESTABLISHED -j ACCEPT
-A FORWARD -j DROP
-A OUTPUT -o lo -j ACCEPT
-A OUTPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
-A OUTPUT -p tcp -m state --state NEW -m tcp --dport 3128 -j ACCEPT
-A OUTPUT -p udp -m state --state NEW -m udp --dport 53 -j ACCEPT
-A OUTPUT -p tcp -m state --state NEW -m tcp --dport 389 -j ACCEPT
-A OUTPUT -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT
-A OUTPUT -p tcp -m state --state NEW -m tcp --dport 8080 -j ACCEPT
-A OUTPUT -p tcp -m state --state NEW -m tcp --dport 443 -j ACCEPT
-A OUTPUT -p tcp -m state --state NEW -m tcp --dport 23 -j ACCEPT
-A OUTPUT -p udp -m state --state NEW -m udp --dport 21 -j ACCEPT
-A OUTPUT -p udp -m state --state NEW -m udp --dport 20 -j ACCEPT
-A OUTPUT -p tcp -m state --state NEW -m tcp --dport 20 -j ACCEPT
-A OUTPUT -p tcp -m state --state NEW -m tcp --dport 22 -j ACCEPT
-A OUTPUT -j DROP
COMMIT
# Completed on Wed Nov  3 09:49:49 2021
# Generated by iptables-save v1.8.4 on Wed Nov  3 09:49:49 2021
*security
:INPUT ACCEPT [9963:1087506]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [6542:973915]
COMMIT
# Completed on Wed Nov  3 09:49:49 2021
# Generated by iptables-save v1.8.4 on Wed Nov  3 09:49:49 2021
*raw
:PREROUTING ACCEPT [12167:1267324]
:OUTPUT ACCEPT [6562:976299]
COMMIT
# Completed on Wed Nov  3 09:49:49 2021
# Generated by iptables-save v1.8.4 on Wed Nov  3 09:49:49 2021
*mangle
:PREROUTING ACCEPT [12167:1267324]
:INPUT ACCEPT [11013:1204786]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [6563:976631]
:POSTROUTING ACCEPT [6545:975263]
COMMIT
# Completed on Wed Nov  3 09:49:49 2021
# Generated by iptables-save v1.8.4 on Wed Nov  3 09:49:49 2021
*nat
:PREROUTING ACCEPT [2211:180238]
:INPUT ACCEPT [14:776]
:POSTROUTING ACCEPT [112:8277]
:OUTPUT ACCEPT [130:9645]
-A PREROUTING -i eth1 -p tcp -m tcp --dport 80 -j REDIRECT --to-ports 3128
COMMIT
# Completed on Wed Nov  3 09:49:49 2021

相关内容