歡迎您光臨本站 註冊首頁

squid acl port疑惑

←手機掃碼閱讀     火星人 @ 2014-03-04 , reply:0

squid acl port疑惑

使用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. 怎麼感覺有點衝突
《解決方案》

個人感覺,如果向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。
《解決方案》

貌似不對~~就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把配置文件都貼出來看看吧
《解決方案》

回復 #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肯定沒有響應了。

[ 本帖最後由 xiangni330 於 2009-9-16 21:30 編輯 ]
《解決方案》

回復 #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 編輯 ]
《解決方案》

我的反向代理伺服器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 rdoa@wangw.com

[ 本帖最後由 xiangni330 於 2009-9-16 22:02 編輯 ]

[火星人 ] squid acl port疑惑已經有845次圍觀

http://coctec.com/docs/service/show-post-20722.html