smallfish 发表于 2015-12-04 17:01

squid 3.5.12 用户认证失败

Centos 6.7 用源码方式安装了Squid 3.5.12,在不使用用户认证方式的情况下,也就是开启http_access allow localnet,客户端可以访问,但配置了需要客户端用户名密码验证的时候就不行,客户端错误信息如下:


当尝试取回该 URL 时遇到下面的错误:http://www.sina.com.cn/

访问被拒绝。

服务器端squid.conf配置如下:


acl localnet src 10.155.0.0/16

acl SSL_ports port 443
acl Safe_ports port 80          # http
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

# Squid normally listens to port 3128
http_port 3128

coredump_dir /var/cache/squid

#
# Add any of your own refresh_pattern entries above these.
#
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


#New add for authenticaion
auth_param basic program /usr/bin/basic_ncsa_auth /etc/squid/squid_passwd
auth_param basic children 5
auth_param basic credentialsttl 2 hours
auth_param basic realm Web proxy server
auth_param basic casesensitive off
acl ncsa_users proxy_auth REQUIRED
http_access allow ncsa_users


日志上没有看到什么错误,尝试验证用户名密码也是对的:

# /usr/local/squid/libexec/basic_ncsa_auth /etc/squid/squid_passwd
user 123456
OK
^C
#


不知道这个配置哪里有问题?

smallfish 发表于 2015-12-04 17:46

Squid运行信息如下:
# /usr/local/squid/sbin/squid -d 10
# 2015/12/04 17:44:50 kid1| Set Current Directory to /var/cache/squid
2015/12/04 17:44:50 kid1| Starting Squid Cache version 3.5.12 for x86_64-pc-linux-gnu...
2015/12/04 17:44:50 kid1| Service Name: squid
2015/12/04 17:44:50 kid1| Process ID 5708
2015/12/04 17:44:50 kid1| Process Roles: worker
2015/12/04 17:44:50 kid1| With 1024 file descriptors available
2015/12/04 17:44:50 kid1| Initializing IP Cache...
2015/12/04 17:44:50 kid1| DNS Socket created at [::], FD 5
2015/12/04 17:44:50 kid1| DNS Socket created at 0.0.0.0, FD 6
2015/12/04 17:44:50 kid1| Adding domain abc.com from /etc/resolv.conf
2015/12/04 17:44:50 kid1| Adding domain dev.abc.com from /etc/resolv.conf
2015/12/04 17:44:50 kid1| Adding nameserver 10.155.3.222 from /etc/resolv.conf
2015/12/04 17:44:50 kid1| helperOpenServers: Starting 5/5 'basic_ncsa_auth' processes
2015/12/04 17:44:50 kid1| Logfile: opening log daemon:/usr/local/squid/var/logs/access.log
2015/12/04 17:44:50 kid1| Logfile Daemon: opening log /usr/local/squid/var/logs/access.log
2015/12/04 17:44:50 kid1| Store logging disabled
2015/12/04 17:44:50 kid1| Swap maxSize 0 + 262144 KB, estimated 20164 objects
2015/12/04 17:44:50 kid1| Target number of buckets: 1008
2015/12/04 17:44:50 kid1| Using 8192 Store buckets
2015/12/04 17:44:50 kid1| Max Memsize: 262144 KB
2015/12/04 17:44:50 kid1| Max Swap size: 0 KB
2015/12/04 17:44:50 kid1| Using Least Load store dir selection
2015/12/04 17:44:50 kid1| Set Current Directory to /var/cache/squid
2015/12/04 17:44:50 kid1| Finished loading MIME types and icons.
2015/12/04 17:44:50 kid1| HTCP Disabled.
2015/12/04 17:44:50 kid1| Pinger socket opened on FD 22
2015/12/04 17:44:50 kid1| Squid plugin modules loaded: 0
2015/12/04 17:44:50 kid1| Adaptation support is off.
2015/12/04 17:44:50 kid1| Accepting HTTP Socket connections at local=[::]:3128 remote=[::] FD 20 flags=9
2015/12/04 17:44:51 kid1| storeLateRelease: released 0 objects

smallfish 发表于 2015-12-05 20:45

已经解决了,是自己疏忽,忘记把:http_access deny all 给注释了。

action08 发表于 2015-12-07 20:17

呵呵,
squid整体上还是不错的
页: [1]
查看完整版本: squid 3.5.12 用户认证失败