使用身份验证重定向 squid(已编辑)

使用身份验证重定向 squid(已编辑)

首先抱歉我的英语不好。其次我在端口 8888 上配置了一个身份验证模式的 squid。并通过路由图将我的网络流量(例如 www)重定向到 squid 服务器。在服务器 iptables 中,将端口 80 上的流量重定向到 8888(squid 端口)。

-A PREROUTING  -s 10.32.3.0/24 -p tcp --dport 80 -j DNAT --to 64.23.45.12:8888

但是当我用 IE 浏览网页时出现以下错误:

The requested URL could not be retrieved
The following error was encountered while trying to retrieve the URL: /
Invalid URL

并且此消息出现在access.log中:

1281752166.811      0 10.32.3.12 NONE/400 1744 GET / - NONE/- text/html

但是当我在 IE 代理设置中将每个 ip (不是 squid ip) 都设置为端口 80 时;

出现身份验证窗口然后是我请求的网站。

PS 当通过透明模式配置 squid 时,它可以正常工作。

这是我的 squid.conf:

visible_hostname black    
maximum_object_size 64000 KB    
dns_nameservers 4.2.2.4    
auth_param basic program /usr/lib/squid/ncsa_auth /etc/squid/squid_passwd    
acl ncsa_users proxy_auth REQUIRED
acl snmppublic snmp_community squiz    
acl manager proto cache_object    
acl localhost src 127.0.0.1/255.255.255.255    
acl SSL_ports port 443 563 8443    
acl Safe_ports port 80 1000 443 563 70 20-65535 280  488 591 777 5555 465  210 21    
acl CONNECT method CONNECT    
http_access allow  ncsa_users    
http_access allow manager localhost    
http_access deny manager    
http_access deny !Safe_ports    
tcp_outgoing_address 64.23.45.12
http_port 8888    
cache_mem 20 MB
cache_dir ufs /var/spool/squid 100 16 256
access_log /log/access.log
cache_store_log none
cache_effective_user nobody
http_access deny all

答案1

我猜想从概念上来说,同时处于透明模式和认证模式是不可能的。

如果您需要身份验证,请不要使用透明代理。用户必须手动配置代理 ip/user/pass。

如果您想要透明代理,那里没有地方输入用户/密码。

您唯一的解决方案是使用热点,但我认为您无法仅使用 Squid 来做到这一点(您需要 Nocat 之类的工具)。

相关内容