免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 4155 | 回复: 3
打印 上一主题 下一主题

[proxy] squid 3.5.12 用户认证失败 [复制链接]

论坛徽章:
1
丑牛
日期:2014-05-22 15:38:58
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2015-12-04 17:01 |只看该作者 |倒序浏览
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
[root@server squid]#


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

论坛徽章:
1
丑牛
日期:2014-05-22 15:38:58
2 [报告]
发表于 2015-12-04 17:46 |只看该作者
Squid运行信息如下:
# /usr/local/squid/sbin/squid -d 10
[root@automate squid]# 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 Mem  size: 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

论坛徽章:
1
丑牛
日期:2014-05-22 15:38:58
3 [报告]
发表于 2015-12-05 20:45 |只看该作者
已经解决了,是自己疏忽,忘记把:http_access deny all 给注释了。

论坛徽章:
223
2022北京冬奥会纪念版徽章
日期:2015-08-10 16:30:32操作系统版块每日发帖之星
日期:2016-05-10 19:22:58操作系统版块每日发帖之星
日期:2016-02-18 06:20:00操作系统版块每日发帖之星
日期:2016-03-01 06:20:00操作系统版块每日发帖之星
日期:2016-03-02 06:20:0015-16赛季CBA联赛之上海
日期:2019-09-20 12:29:3219周年集字徽章-周
日期:2019-10-01 20:47:4815-16赛季CBA联赛之八一
日期:2020-10-23 18:30:5320周年集字徽章-20	
日期:2020-10-28 14:14:2615-16赛季CBA联赛之广夏
日期:2023-02-25 16:26:26CU十四周年纪念徽章
日期:2023-04-13 12:23:10操作系统版块每日发帖之星
日期:2016-05-10 19:22:58
4 [报告]
发表于 2015-12-07 20:17 来自手机 |只看该作者
呵呵,
squid整体上还是不错的
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP