Squid3 ncsa 基本身份验证总是失败

Ari*_*yan 3 configuration proxy squid 13.04

我正在尝试让 Squid3 使用基本身份验证。
但是当我提供正确的用户名/密码时,身份验证失败了!
我的 ACL 和 http_accesssquid.conf是:

acl manager proto cache_object
acl localhost src 127.0.0.1/32 ::1
acl to_localhost dst 127.0.0.0/8 0.0.0.0/32 ::1

acl SSL_ports port 443
acl SSL_ports port 80
acl Safe_ports port 80          # http
acl Safe_ports port 21          # ftp
acl Safe_ports port 443         # https
acl Safe_ports port 70          # gopher
acl Safe_ports port 210         # wais
acl Safe_ports port 1025-65535  # unregistered ports
acl Safe_ports port 280         # http-mgmt
acl Safe_ports port 488         # gss-http
acl Safe_ports port 591         # filemaker
acl Safe_ports port 777         # multiling http
acl CONNECT method CONNECT

auth_param basic program /usr/lib/squid3/ncsa_auth /etc/squid3/users
auth_param basic realm Private
auth_param basic credentialsttl 2 hours
auth_param basic casesensitive off

acl ncsa_users proxy_auth REQUIRED

http_access allow ncsa_users
http_access allow manager localhost
http_access deny manager
http_access deny !Safe_ports
http_access deny CONNECT !SSL_ports
http_access allow localhost
http_access deny all
Run Code Online (Sandbox Code Playgroud)

我正在创建/etc/squid3/users

htpasswd /etc/squid3/users myusername
Run Code Online (Sandbox Code Playgroud)

当我在 Firefox 中配置代理并请求密码时,我提供了正确的用户名/密码,但它失败并再次提示。
问题是什么?

Ari*_*yan 8

发现问题:
htpasswd使用-m(使用 Apache 修改后的 MD5 版本加密密码)
但 Squid(Ubuntu 13.04 存储库上的 Squid 3.1.20)ncsa_auth使用系统crypt函数(unistd.hcrypt.h)来检查密码(如果有的话crypt()- 我没有检查其他场景)
因此,如果我们/usr/lib/squid3/ncsa_auth /etc/squid3/users手动运行并检查用户/密码,我们将得到:

~$ /usr/lib/squid3/ncsa_auth /etc/squid3/users
user pass
Segmentation fault (core dumped)
Run Code Online (Sandbox Code Playgroud)

解决方案:
用于创建密码文件-d开关应使用:

htpasswd -d /etc/squid3/users myusername
Run Code Online (Sandbox Code Playgroud)

(使用-d告诉htpasswd使用系统的crypt功能)

祝你好运