Squid 配置-同一用户多个 IP

Squid 配置-同一用户多个 IP

我正在用我拥有的 8 个 IP 构建一个小型代理服务器,但是,如果我授予 1 个用户访问更多 IP 的权限,则无论他使用哪一个作为代理,squid 服务器都会使用第一个符合规则的 IP。

从我的 squid 配置文件中可以看到,用户曼弗雷德可以访问所有 IP,但无论我选择哪个 IP,squid 都只使用列表中的第一个 IP:x.213.223.188

知道如何强制 squid 为该用户使用所需的代理吗?

http_port 8888
visible_hostname funky
auth_param basic program /usr/lib/squid/ncsa_auth /etc/squid/squid_passwd
acl ncsa_users proxy_auth REQUIRED
auth_param basic children 5
auth_param basic realm Anonymous proxy
auth_param basic credentialsttl 1 hours

acl all src all
acl manager proto cache_object
acl localhost src 127.0.0.1
acl to_localhost dst 127.0.0.0/8 0.0.0.0/32
acl SSL_ports port 443          # https
acl SSL_ports port 563          # snews
acl SSL_ports port 873          # rsync
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 Safe_ports port 631         # cups
acl Safe_ports port 873         # rsync
acl Safe_ports port 901         # SWAT
acl purge method PURGE
acl CONNECT method CONNECT

acl user41 proxy_auth manfred
acl user42 proxy_auth manfred
acl user43 proxy_auth manfred
acl user44 proxy_auth manfred
acl user45 proxy_auth manfred
acl user46 proxy_auth ciokan manfred
acl user47 proxy_auth manfred
acl user48 proxy_auth manfred
tcp_outgoing_address x.213.223.188 user41
tcp_outgoing_address x.213.223.189 user42
tcp_outgoing_address x.213.223.190 user43
tcp_outgoing_address x.213.223.191 user44
tcp_outgoing_address x.37.196.188 user45
tcp_outgoing_address x.37.196.189 user46
tcp_outgoing_address x.37.196.190 user47
tcp_outgoing_address x.37.196.191 user48
# No local caching
maximum_object_size 0 KB
minimum_object_size 0 KB

# No local log
cache_access_log /dev/null
cache_store_log /dev/null

refresh_pattern ^ftp:           1440    20%     10080
refresh_pattern ^gopher:        1440    0%      1440
refresh_pattern .               0       20%     4320
refresh_pattern -i (/cgi-bin/|\?) 0 0% 0

http_access allow manager localhost
http_access deny manager
http_access allow purge localhost
http_access deny purge
http_access deny !Safe_ports
http_access deny CONNECT !SSL_ports

http_access deny !ncsa_users
http_access allow ncsa_users
http_access allow user41
http_access allow user42
http_access allow user43
http_access allow user44
http_access allow user45
http_access allow user46
http_access allow user47
http_access allow user48

http_access allow all

hosts_file /etc/hosts
coredump_dir /var/spool/squid

答案1

尝试以下方法:

acl user41 proxy_auth manfred
acl user41 myip x.213.223.188

acl user42 proxy_auth manfred
acl user42 myip x.213.223.189

并保留 tcp_outgoing_adress 不变。

编辑:是的,也许可以改为

acl ip_1 myip x.213.223.188
tcp_outgoing_address x.213.223.188 ip_1

acl ip_2 myip x.213.223.189
tcp_outgoing_address x.213.223.189 ip_2

并保留 proxy_auth acls 不变:

acl user_manfred proxy_auth manfred

然后

http_access allow user_manfred ip_1
http_access allow user_manfred ip_2

相关内容