首页 > 解决方案 > 鱿鱼将每个传出IP绑定到用户?

问题描述

我正在尝试使用 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:

squid绑定传出ip

这是我的配置:

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。与用户 2 相同。

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

我觉得“http_access allow userIp”没有按预期工作。

我无法在网上搜索类似的问题...希望有人可以帮助我

标签: authenticationproxyaclsquid

解决方案


好的,我现在想通了。

%SRC %LOGIN 对意味着指定用户自己的电脑地址的来源,这实际上不是我想要的。

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

所以是的,这就是问题所在


推荐阅读