squid 配置 Basic auth 始终失败,百思不得其解 - V2EX
V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
aivier
V2EX    Squid

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

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

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

    前两天试着搭建成功过,但是因为机器原因,配置文件丢失,今天按照同样的步骤重新配置之后每次启动都会提示
    helperOpenServers: Starting 0/5 'basic_ncsa_auth' rocesses
    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     Solana     965 人在线   最高记录 6679       Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 24ms UTC 22:35 PVG 06:35 LAX 15:35 JFK 18:35
    Do have faith in what you're doing.
    ubao snddm index pchome yahoo rakuten mypaper meadowduck bidyahoo youbao zxmzxm asda bnvcg cvbfg dfscv mmhjk xxddc yybgb zznbn ccubao uaitu acv GXCV ET GDG YH FG BCVB FJFH CBRE CBC GDG ET54 WRWR RWER WREW WRWER RWER SDG EW SF DSFSF fbbs ubao fhd dfg ewr dg df ewwr ewwr et ruyut utut dfg fgd gdfgt etg dfgt dfgd ert4 gd fgg wr 235 wer3 we vsdf sdf gdf ert xcv sdf rwer hfd dfg cvb rwf afb dfh jgh bmn lgh rty gfds cxv xcv xcs vdas fdf fgd cv sdf tert sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf shasha9178 shasha9178 shasha9178 shasha9178 shasha9178 liflif2 liflif2 liflif2 liflif2 liflif2 liblib3 liblib3 liblib3 liblib3 liblib3 zhazha444 zhazha444 zhazha444 zhazha444 zhazha444 dende5 dende denden denden2 denden21 fenfen9 fenf619 fen619 fenfe9 fe619 sdf sdf sdf sdf sdf zhazh90 zhazh0 zhaa50 zha90 zh590 zho zhoz zhozh zhozho zhozho2 lislis lls95 lili95 lils5 liss9 sdf0ty987 sdft876 sdft9876 sdf09876 sd0t9876 sdf0ty98 sdf0976 sdf0ty986 sdf0ty96 sdf0t76 sdf0876 df0ty98 sf0t876 sd0ty76 sdy76 sdf76 sdf0t76 sdf0ty9 sdf0ty98 sdf0ty987 sdf0ty98 sdf6676 sdf876 sd876 sd876 sdf6 sdf6 sdf9876 sdf0t sdf06 sdf0ty9776 sdf0ty9776 sdf0ty76 sdf8876 sdf0t sd6 sdf06 s688876 sd688 sdf86