V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
aivier
V2EX  ›  Squid

squid 配置 Basic auth 始终失败,百思不得其解

  •  
  •   aivier · 2015-08-31 23:03:25 +08:00 · 6653 次点击
    这是一个创建于 3131 天前的主题,其中的信息可能已经有所发展或是发生改变。

    最近要用 squid ,并且要带密码认证

    前两天试着搭建成功过,但是因为机器原因,配置文件丢失,今天按照同样的步骤重新配置之后每次启动都会提示
    helperOpenServers: Starting 0/5 'basic_ncsa_auth' processes
    helperOpenServers: No 'basic_ncsa_auth' processes needed.

    用的是 http://www.cyberciti.biz/tips/linux-unix-squid-proxy-server-authentication.html 的步骤,和之前一样的

    配置文件:
    acl localnet src 10.0.0.0/8 # RFC1918 possible internal network
    acl localnet src 172.16.0.0/12 # RFC1918 possible internal network
    acl localnet src 192.168.0.0/16 # RFC1918 possible internal network
    acl localnet src fc00::/7 # RFC 4193 local private network range
    acl localnet src fe80::/10 # RFC 4291 link-local (directly plugged ) machines

    acl SSL_ports port 443
    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

    http_access deny !Safe_ports
    http_access deny CONNECT !SSL_ports
    http_access allow localhost manager
    http_access deny manager

    http_access allow localnet
    http_access allow localhost

    http_access deny all

    https_port 9000

    auth_param basic program /usr/lib64/squid/basic_ncsa_auth /etc/squid/users
    auth_param basic children 5
    auth_param basic credentialsttl 2 hours
    acl Admin proxy_auth REQUIRED
    http_access allow Admin
    http_access deny all

    coredump_dir /var/spool/squid

    refresh_pattern ^ftp: 1440 20% 10080
    refresh_pattern ^gopher: 1440 0% 1440
    refresh_pattern -i (/cgi-bin/|\?) 0 0% 0
    refresh_pattern . 0 20% 4320

    /etc/squid/users 这个文件是存在的,经过测试有效,内含 Admin 用户密码信息

    除了开头提到的一句提示以外无任何错误信息,折腾一天,换了不同机器,不同版本,百思不得其解,到底哪里错了?...

    6 条回复    2015-09-02 16:11:19 +08:00
    i8s301a
        1
    i8s301a  
       2015-09-01 02:55:24 +08:00
    可能需要修改 /usr/lib64/squid/basic_ncsa_auth 的路径?
    rex1901
        2
    rex1901  
       2015-09-01 10:06:22 +08:00
    这个提示是启动才显示的,是因为这个时候没有用到认证
    你用密码登录一次,就会发现进程里有 basic_ncsa_auth 了
    貌似是这样的。
    aivier
        3
    aivier  
    OP
       2015-09-01 13:45:07 +08:00
    @i8s301a 这个路径确认存在,直接运行是有输出的
    aivier
        4
    aivier  
    OP
       2015-09-01 13:46:50 +08:00
    @rex1901 它这个提示,似乎是直接忽略配置里的认证部分了,向 squid 发送请求的时候没有返回需要认证而是直接返回 403 (因为我在认证用户后面设置了 deny all )
    aivier
        5
    aivier  
    OP
       2015-09-01 14:32:39 +08:00
    @rex1901 感谢提醒,我在另一台机器上用同样配置设置了一次,同样有这个提示,但是请求的时候可以看到返回 407 ,但是那台还是没有,直接 403 ,一模一样的配置文件,太怪了...
    rex1901
        6
    rex1901  
       2015-09-02 16:11:19 +08:00
    你前面有个 http_access deny all
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   3640 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 23ms · UTC 10:44 · PVG 18:44 · LAX 03:44 · JFK 06:44
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.