Squid 将每个传出 ip 绑定到一个用户?

Squid bind each outgoing ip to a user?

我正在尝试使用 squid 并将 2 个传出 ip 分别绑定到 2 个用户。

理想的结果是,我可以访问以下内容:

xxx.xxx.xxx.14:3128:user1:user1password 
xxx.xxx.xxx.18:3128:user2:user2password

但不是:

xxx.xxx.xxx.14:3128:user2:user2password 
xxx.xxx.xxx.18:3128:user1:user1password

我找到了一个类似的问题并使用了类似的squid.conf:

这是我的配置:

acl http proto http
acl port_80 port 80
acl port_443 port 443
acl CONNECT method CONNECT


auth_param basic program /usr/lib64/squid/basic_ncsa_auth /etc/squid/passwords
acl ncsa_users proxy_auth REQUIRED
external_acl_type userIp %SRC %LOGIN /usr/lib64/squid/ext_file_userip_acl -f /etc/squid/userIp.conf

acl userIp external userIp

http_access deny !ncsa_users
http_access allow userIp
http_access deny all

http_port 3128
acl ip1 myip xxx.xxx.xxx.14
tcp_outgoing_address xxx.xxx.xxx.14 ip1

acl ip2 myip xxx.xxx.xxx.18
tcp_outgoing_address xxx.xxx.xxx.18 ip2

在我的 userIp.conf 中我有:

xxx.xxx.xxx.14 user1
xxx.xxx.xxx.18 user2

在我的 /etc/squid/passwords 中,我有以下由 htpasswd 创建的:

user1:encrypted password
user2:encrypted password

问题是: 如果我删除 'http_access deny !ncsa_users',则 user1 可以访问 xxx.xxx.xxx.14 和 xxx.xxx.xxx.18。与 user2 相同。

但是如果我保持'http_access deny !ncsa_users'不变,那么所有连接都会失败。

我觉得 'http_access allow userIp' 没有像预期的那样工作。

我在网上搜索不到类似的问题...希望有人能帮助我

好的,我现在明白了。

%SRC %LOGIN pair的意思是指定用户自己的pc地址来源,其实不是我想要的

我要的其实是%MYADDR %LOGIN对,指定允许每个用户连接的ips。

是的,这就是问题所在