我正在学习如何使用Squid作为反向代理。 现在它不会发送任何Webstream量到后端Web服务器。 我正在采取httpstream量到反向代理服务器,并发送到8080我的web服务器。我的设置:
Internet--Firewall--Squid--WebServer
我用2个nicsbuild立了鱿鱼。 一个带有DMZ IP的NAT转换为公共IP。 另一个nic与web服务器在同一个子网上。 这里是squid.conf文件:
http_port 80 accel defaultsite=rcdlab.net vhost forwarded_for on refresh_pattern ^ftp: 1440 20% 10080 refresh_pattern ^gopher: 1440 0% 1440 refresh_pattern . 0 20% 4320 cache_peer 192.168.3.59 parent 8080 0 no-query no-digest originserver name=web01 acl sites_iis dstdomain www.rcdlab.net rcdlab.net 192.168.222.198 acl our_sites dstdomain www.rcdlab.net rcdlab.net 192.168.222.198 cache_peer_access web01 allow sites_iis acl all src all acl manager proto cache_object acl localhost src 127.0.0.1/32 acl to_localhost dst 127.0.0.0/8 acl localnet src 192.168.3.0/24 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 allow our_sites http_access allow manager all http_access allow manager http_access allow localnet http_access deny !Safe_ports http_access deny CONNECT !SSL_ports http_access deny all visible_hostname rp.rcdlab.local access_log /var/log/squid/access.log
2012年6月29日更新
从我的电脑外部stream量到达反向代理,但我看到这在tcpdump:
172.16.3.254 > 192.168.222.213: ICMP host 172.16.3.254 unreachable - admin prohibited, length 60 IP (tos 0x0, ttl 128, id 4230, offset 0, flags [DF], proto TCP (6), length 52)
172.16.3.254 =反向代理192.168.222.213 =我的IP
更新
编辑了/ etc / sysconfig / iptables并添加了以下规则:
-A INPUT -p tcp --dport 80 -j ACCEPT
这被附加到INPUT链(目的地为本地服务器的分组),tcp协议,目的地端口80,并跳转到匹配规则ACCEPT的分组的目标动作。
这允许外部stream量击中反向代理并被转发到通过查看IIS日志validation的后端web服务器。
/更新
我的NAT和防火墙规则很好。
问题在于/ etc / sysconfig / iptables中的CentOS和iptables
这一行:
-A INPUT -j REJECT --reject-with icmp-host-prohibited
阻止stream量到达我的networking服务器。 我现在评论了,但我需要更多地研究iptables及其工作原理。 我不想在反向代理上打开任何漏洞。