This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 9 years ago.
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(1)
这是我在 Ubuntu 14.04 上设置基本身份验证所需要做的事情(在其他地方找不到指南)
基本鱿鱼配置
/etc/squid3/squid.conf
而不是超级臃肿的默认配置文件请注意basic_ncsa_auth程序而不是旧的ncsa_auth
squid 2.x
对于squid 2.x,您需要编辑
/etc/squid/squid.conf
文件和位置:设置用户
并为所选用户名输入两次密码,然后为所选用户名
输入两次密码
,然后为所选用户名输入两次密码,然后为
htdigest 与 htpasswd
对于许多问我的人:这两种工具生成不同的文件格式:
htdigest
以纯文本形式存储密码。htpasswd
存储经过哈希处理的密码(可以使用各种哈希算法)尽管格式存在差异,
basic_ncsa_auth
仍然能够解析使用htdigest 生成的密码文件
。因此,您可以选择使用:请注意,此方法是经验性的、未记录的,并且 Squid 的未来版本可能不支持。
在 Ubuntu 14.04 上,
htdigest
和htpasswd
均在[apache2-utils][1]
软件包中提供。MacOS
与上面类似,但文件路径不同。
安装squid
启动squid服务
Squid配置文件存储在
/usr/local/etc/squid.conf
。注释或删除以下行:
然后类似于 Linux 配置(但具有更新的路径)添加以下内容:
请注意,
basic_ncsa_auth
的路径可能会有所不同,因为它取决于使用brew
,您可以使用 ls /usr/local/Cellar/squid/ 来验证这一点。另请注意,您应该在以下部分的下方添加上述内容:现在为自己生成一个 user:password 基本身份验证凭据(注意:
htpasswd
和htdigest
在 MacOS 上也可用)重新启动squid服务
Here's what I had to do to setup basic auth on Ubuntu 14.04 (didn't find a guide anywhere else)
Basic squid conf
/etc/squid3/squid.conf
instead of the super bloated default config filePlease note the basic_ncsa_auth program instead of the old ncsa_auth
squid 2.x
For squid 2.x you need to edit
/etc/squid/squid.conf
file and place:Setting up a user
and enter a password twice for the chosen username then
squid 2.x
and enter a password twice for the chosen username then
htdigest vs htpasswd
For the many people that asked me: the 2 tools produce different file formats:
htdigest
stores the password in plain text.htpasswd
stores the password hashed (various hashing algos are available)Despite this difference in format
basic_ncsa_auth
will still be able to parse a password file generated withhtdigest
. Hence you can alternatively use:Beware that this approach is empirical, undocumented and may not be supported by future versions of Squid.
On Ubuntu 14.04
htdigest
andhtpasswd
are both available in the[apache2-utils][1]
package.MacOS
Similar as above applies, but file paths are different.
Install squid
Start squid service
Squid config file is stored at
/usr/local/etc/squid.conf
.Comment or remove following line:
Then similar to linux config (but with updated paths) add this:
Note that path to
basic_ncsa_auth
may be different since it depends on installed version when usingbrew
, you can verify this withls /usr/local/Cellar/squid/
. Also note that you should add the above just bellow the following section:Now generate yourself a user:password basic auth credential (note:
htpasswd
andhtdigest
are also both available on MacOS)Restart the squid service