免费注册 查看新帖 |

Chinaunix

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

[proxy] squid acl port疑惑 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2009-09-16 11:14 |只看该作者 |倒序浏览
使用squid2.6做反向代理,配置文件中有一小段(实际情况这段没有问题,squid正常运行)看的有点困惑:
      http_port 80 accel vhost vport
      ......
      acl p-safe port 80 443 563
      http_access deny  !p-safe
      ......
      cache_peer 192.168.24.198 parent 8088 0 no-query originserver
      ......
      squid监听的端口是80,acl port 80 443 563端口定义的应该是原始服务器的端口吧,而192.168.24.198定义的端口是8088, http_access禁止了非p-safe中定义的端口,也包括8088,这样的话,squid在转发客户端请求给192.168.24.198时,应该转发不过去,因为cache_peer 中定义了192.168.24.198 使用的端口是8088. 怎么感觉有点冲突

论坛徽章:
0
2 [报告]
发表于 2009-09-16 15:23 |只看该作者
个人感觉,如果向squid发起8088请求的时候,它应该会deny。
如果请求是域名,那么根据你做的cache_peer,是squid向后端web的8088端口发送请求,而不是接受8088端口的请求。所以这肯定是allow的。
可以试试:
web的域名:www.test.com
IP:192.168.1.1:8088
那么通过squid你访问www.test.com应该就可以,但是http://192.168.1.1:8088应该就会被deny。

论坛徽章:
0
3 [报告]
发表于 2009-09-16 15:32 |只看该作者
貌似不对~~就LZ得环境 刚做了一个实验:
#acl Safe_ports port 80          # http
http_access deny !Safe_ports

cache_peer 192.168.1.6 parent 80 0 no-query originserver name=a
cache_peer_domain a www.test.com
我向squid发出www.test.com的请求。
当我注释了80的Safe_ports时,www.test.com是不能访问的,显示deny
难道说这个端口也必须是Safe_ports?
如果工作正常。请LZ把配置文件都贴出来看看吧

论坛徽章:
0
4 [报告]
发表于 2009-09-16 21:25 |只看该作者

回复 #2 haoyu323 的帖子

"个人感觉,如果向squid发起8088请求的时候,它应该会deny“ ,这句好好像不对,向squid发送8088请求和这个没有关系,squid定义自己的端口用acl myport,squid代理服务器根本就没有程序在8088端口监听。

可以试试:
web的域名:www.test.com
IP:192.168.1.1:8088
那么通过squid你访问www.test.com应该就可以,但是http://192.168.1.1:8088应该就会被deny。
我的是反向代理,肯定不会直接用到web服务器的IP地址了。
如果web的域名是:www.test.com 那么这个域名映射的也应该是Squid代理服务器的IP,访问www.test.com相当于http://代理服务器IP:80,代理服务器在80端口可以接受到这个请求,如果直接是http://代理服务器IP:8088肯定没有响应了。

[[i] 本帖最后由 xiangni330 于 2009-9-16 21:30 编辑 [/i]]

论坛徽章:
0
5 [报告]
发表于 2009-09-16 21:34 |只看该作者

回复 #3 haoyu323 的帖子

#acl Safe_ports port 80          # http
http_access deny !Safe_ports
cache_peer 192.168.1.6 parent 80 0 no-query originserver name=a
cache_peer_domain a www.test.com
我向squid发出www.test.com的请求。
当我注释了80的Safe_ports时,www.test.com是不能访问的,显示deny
难道说这个端口也必须是Safe_ports?

如果这样的话,我的8088端口也应该被deny掉,但是没有。
你把你的配置文件发出来我看看。

[ 本帖最后由 xiangni330 于 2009-9-16 22:03 编辑 ]

论坛徽章:
0
6 [报告]
发表于 2009-09-16 21:37 |只看该作者
我的反向代理服务器IP地址:192.168.0.164  web服务器IP是:192.168.24.198
Squid配置文件如下:
http_port 80 accel vhost vport

cache_mem 100 MB
cache_swap_low 75
cache_swap_high 98

emulate_httpd_log on
logformat squid  %ts.%03tu %6tr %>a %Ss/%03Hs %<st %rm %ru %un %Sh/%<A %mt
cache_access_log C:\squid\var\logs\access.log
cache_log C:\squid\var\logs\cache.log
cache_store_log none
error_directory C:\squid\share\errors\Simplify_Chinese
hosts_file C:\WINDOWS\system32\drivers\etc\hosts
redirect_rewrites_host_header off

acl d-domains dstdomain .192.168.0.164
acl all src 0.0.0.0/0.0.0.0
acl p-manager proto cache_object
acl s-localhost src 127.0.0.1/255.255.255.255
acl d-localhost dst 127.0.0.0/8
acl p-ssl  port 443 563
acl p-safe port 80 443 563
acl m-conn method CONNECT
acl m-purge method PURGE
acl n-maxconn maxconn 150

acl rdims urlpath_regex -i ^http://192.168.0.164
no_cache deny rdims

http_access allow p-manager s-localhost
http_access allow m-purge
http_access allow p-manager
http_access deny  !p-safe
http_access allow d-domains
http_access deny  m-conn !p-ssl
http_access deny  n-maxconn
http_access deny  all
http_reply_access allow all
icp_access allow all

cache_peer 192.168.24.198 parent 8088 0 no-query originserver

cache_replacement_policy lru
cache_dir ufs C:\squid\var\cache 256 16 256

visible_hostname rd.com
cache_mgr [email]rdoa@wangw.com[/email]

[[i] 本帖最后由 xiangni330 于 2009-9-16 22:02 编辑 [/i]]
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

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

清除 Cookies - ChinaUnix - Archiver - WAP - TOP