【问题标题】:Basic Authentication in Squid Server(behind NAT) over internet通过 Internet 在 Squid 服务器(在 NAT 之后)中的基本身份验证
【发布时间】:2017-04-01 09:48:34
【问题描述】:

我在 Google 上搜索过“在 squid 服务器中无法通过 Internet 进行的基本身份验证”类型的搜索,但对我的问题没有合适的答案。

这是我的问题: 我在防火墙后面设置了一个 squid 代理服务器。我已将端口 (54321) 转发到 squid 代理正在侦听的端口 9999。现在一切都很好。我可以从任何地方连接到这个代理。但我需要某种身份验证,因此启用了 basic_ncsa_auth。现在,我可以通过我的局域网计算机进行身份验证后访问互联网。好吧,一切都如我所愿,但是,

我从互联网弹出用户名/密码(firefox),在身份验证后,我从 squid 代理收到“缓存访问被拒绝”消息。

如果有人指出我在这里做错了什么,我将不胜感激。

这是我的 squid.conf 文件:

http_port 9999
auth_param basic program /usr/lib/squid3/basic_ncsa_auth /etc/squid3/passwd
auth_param basic realm proxy
acl authenticated proxy_auth REQUIRED
http_access allow authenticated

网络设置: 防火墙静态 IP:端口:54321 转发到代理服务器:10.11.12.8:9999。

【问题讨论】:

    标签: proxy ubuntu-14.04 basic-authentication squid


    【解决方案1】:

    您的 Squid 配置是否允许 http_reply_access?

    http_reply_access allow all
    

    如果您的密码超过 8 个字符,您还需要确保您没有使用 DES 哈希,这是 htpasswd 命令的默认设置。

    以下是使用 MD5 哈希算法创建新密码文件的方法:

    [root@localhost ~] htpasswd -cm /tmp/passwd testuser
    New password: 
    Re-type new password: 
    Adding password for user testuser
    

    检查文件内容:

    [root@localhost ~] cat /tmp/password
    testuser:$apr1$VxCDyltg$krZ6v7VrnULVOiuS0u6KD1
    

    使用 basic_ncsa_auth 验证密码:

    [root@localhost ~] /usr/lib64/squid/basic_ncsa_auth /tmp/passwd
    testuser superspurs
    OK
    

    现在在 CLI 中验证:

    [root@TLABprx00 ~]# http_proxy=http://localhost:9999/ curl http://www.msftncsi.com/ncsi.txt --proxy-user testuser:superspurs
    Microsoft NCSI
    

    【讨论】:

    • 感谢您的清晰解释。正如我所说的一切正常,除了从互联网到代理的身份验证给我“访问被拒绝错误”,一段时间后我发现 Chromium/Chrome 可以成功验证并按预期工作,但 Firefox 不能......它显示“缓存访问拒绝”消息。我现在使用 chrome 只是因为 Firefox 没有对代理服务器进行身份验证。 (Firefox 显示身份验证框,并在输入凭据后显示访问被拒绝错误。WEIRD。)
    猜你喜欢
    • 2016-02-25
    • 2015-08-17
    • 1970-01-01
    • 2019-06-10
    • 2011-11-08
    • 2019-02-05
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多