我在运行鱿鱼服务器。
我想限制我的用户使用他们的用户名使用我的代理服务器。例如,我为一个名为(user1)的用户名定义了一个限制,例如,如果3个设备同时使用这个用户名连接和使用代理服务器,那么在三个用户中的一个停止使用代理之前,没有人可以使用该用户名连接到代理服务器并使用它。
有什么办法让我这么做吗?
对不起,如果我的问题不能理解,而且我解释的方式不够好.
发布于 2021-08-22 06:41:18
我觉得用鱿鱼是不可能的。
您可以为用户设置最大数量的IP地址(请参阅max_user_ip 酰基型),但是http/proxy auth没有注销机制。
至少没有一致或可靠的机制。有些浏览器很容易忘记auth凭据,而大多数浏览器不.并不是说现在经常使用http auth,每个人都使用某种登录页面和cookie来进行身份验证。早在90年代中期,http auth就被使用了,因为它是唯一普遍可用的选项,在任何人考虑或实现用户会话管理之前,它都是非常恼人的,因为人们还没有考虑或实现用户会话管理,以解决网站的无状态特性。
即使这是可能的,你也会遇到一些问题:用户忘记或不去登录,或者因为他们登录了他们的台式电脑而无法登录,而现在他们已经在笔记本电脑或平板电脑上了。
所以没有注销按钮。
但是,有一个实时(ttl)设置鉴证_ip地址_ttl,因此当用户进行身份验证时,授权将在X秒内有效。
解决方案:将max_user_ip设置为3,authenticate_ip_ttl设置为3600秒左右(1小时)。这应该是足够的时间,让人们在积极使用设备浏览时,在不被auth请求所困扰的情况下使用代理,但是足够短,以至于他们在其他设备上的登录会相当快地超时。
squid.conf示例的摘录:
# acl aclname max_user_ip [-s] number
# # This will be matched when the user attempts to log in from more
# # than <number> different ip addresses. The authenticate_ip_ttl
# # parameter controls the timeout on the ip entries. [fast]
# # If -s is specified the limit is strict, denying browsing
# # from any further IP addresses until the ttl has expired. Without
# # -s Squid will just annoy the user by "randomly" denying requests.
# # (the counter is reset each time the limit is reached and a
# # request is denied)
# # NOTE: in acceleration mode or where there is mesh of child proxies,
# # clients may appear to come from multiple addresses if they are
# # going through proxy farms, so a limit of 1 may cause user problems.
# TAG: authenticate_ip_ttl
# If you use proxy authentication and the 'max_user_ip' ACL,
# this directive controls how long Squid remembers the IP
# addresses associated with each user. Use a small value
# (e.g., 60 seconds) if your users might change addresses
# quickly, as is the case with dialup. You might be safe
# using a larger value (e.g., 2 hours) in a corporate LAN
# environment with relatively static address assignments.
#Default:
# authenticate_ip_ttl 1 secondhttps://unix.stackexchange.com/questions/665662
复制相似问题