Всем привет. Пытаюсь настроить связку freeBSD + PF + squid.###############
pf.conf:logopt = "log"
ext_if = "em0"
lan_if = "em1"pubserv = "{ 22, 443 }"
lanserv = "{ 22, 53, 67, 80, 443 }"
icmp_types = "echoreq"
lan_net = "{ 10.250.2.0/24, 10.250.1.0/24, 192.168.49.0/24, 192.168.50.0/24 }"
set block-policy return
set loginterface $ext_if
set skip on lo0
#set skip on $lan_if
scrub out all random-id# NAT
#nat on $lan_if from $lan_if:network to any -> ($ext_if)#rdr
rdr on $lan_if proto tcp from $lan_net to any port 80 -> $lan_if port 3128block all
block return-rst in $logopt on $ext_if proto tcp all
block return-icmp in $logopt on $ext_if proto udp all
block in $logopt on $ext_if proto icmp all
block out $logopt on $ext_if all
pass in quick on lo0 all
pass out quick on lo0 allpass in on $lan_if inet proto tcp from $lan_net to $lan_if port 3128 keep state
pass in on $lan_if inet proto tcp from $lan_net to $lan_if port www keep state
pass out on $ext_if inet proto tcp from $lan_net to any port www keep state#block drop in $logopt quick on $ext_if from to any
#block drop out $logopt quick on $ext_if from any to
#antispoof for { $lan_if, $ext_if }
block return-rst out on $ext_if proto tcp all
block return-rst in on $ext_if proto tcp all
block return-icmp out on $ext_if proto udp all
block return-icmp in on $ext_if proto udp all
block in $logopt quick proto tcp flags FUP/WEUAPRSF
block in $logopt quick proto tcp flags SRAFU/WEUAPRSF
block in $logopt quick proto tcp flags /WEUAPRSF
block in $logopt quick proto tcp flags SR/SR
block in $logopt quick proto tcp flags SF/SFpass in inet proto icmp all icmp-type $icmp_types keep state
pass in on $ext_if inet proto tcp from any to any port $pubserv flags S/SA keep state
pass in on $lan_if inet proto {tcp udp} from $lan_net to any port $lanserv keep statepass in from $lan_net to $lan_net keep state
pass out from $lan_net to $lan_net keep statepass out from any to any keep state
#############squid.conf:
visible_hostname "BSD_GW"#
# Recommended minimum configuration:
## Example rule allowing access from your local networks.
# Adapt to list your (internal) IP networks from where browsing
# should be allowed
acl localnet src 10.250.2.0/24 # RFC1918 possible internal network
#acl localnet src 172.16.0.0/12 # RFC1918 possible internal network
#acl localnet src 192.168.0.0/16 # RFC1918 possible internal network
#acl localnet src fc00::/7 # RFC 4193 local private network range
#acl localnet src fe80::/10 # RFC 4291 link-local (directly plugged) machinesacl 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
acl allow_site dstdomain "/squid/whitesite.lst"
acl deny_site dstdomain .bash.im .google.com
#
# Recommended minimum Access Permission configuration:
#
# Deny requests to certain unsafe ports
http_access deny !Safe_ports# Deny CONNECT to other than secure SSL ports
http_access deny CONNECT !SSL_ports# Only allow cachemgr access from localhost
http_access allow localhost manager
http_access deny manager# We strongly recommend the following be uncommented to protect innocent
# web applications running on the proxy server who think the only
# one who can access services on "localhost" is a local user
#http_access deny to_localhost#
# INSERT YOUR OWN RULE(S) HERE TO ALLOW ACCESS FROM YOUR CLIENTS
## Example rule allowing access from your local networks.
# Adapt localnet in the ACL section to list your (internal) IP networks
# from where browsing should be allowed
http_access deny localnet deny_site
http_access allow localnet
http_access allow localhost
#http_access allow localnet allow_site
# And finally deny all other access to this proxy
http_access deny all# Squid normally listens to port 3128
http_port 3128
#http_port 10.250.2.213:3128 intercept
http_port 127.0.0.1:3128 interceptdns_nameservers 192.168.49.90
# Uncomment and adjust the following to add a disk cache directory.
#cache_dir ufs /var/squid/cache 100 16 256# Leave coredumps in the first cache dir
coredump_dir /var/squid/cache#
# 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
###############При попытке с клиента через проксю открыть любой сайт имя сайте обрезается.
То есть вместо http://any.site.ru/anyPage.html в сквид попадает только /anyPage.htmlЕсли прописать адрес прокси в браузере все работает нормально.
Сквид собран с параметром enable_PFСо всем этим богатством столкнулся первый раз, гуглить и читать форумы пробовал - ответа найти не смог. Надеюсь хоть здесь кто-нибудь сможет помочь.
> Со всем этим богатством столкнулся первый раз, гуглить и читать форумы пробовал
> - ответа найти не смог. Надеюсь хоть здесь кто-нибудь сможет помочь.неправильно значит пробовал
http://wiki.squid-cache.org/ConfigExamples/Intercept/OpenBsdPf
>> Со всем этим богатством столкнулся первый раз, гуглить и читать форумы пробовал
>> - ответа найти не смог. Надеюсь хоть здесь кто-нибудь сможет помочь.
> неправильно значит пробовал
> http://wiki.squid-cache.org/ConfigExamples/Intercept/OpenBsdPfЗЫ PF offers a rdr-to option. However this not supported with any Squid. Use divert-to instead.
>>> Со всем этим богатством столкнулся первый раз, гуглить и читать форумы пробовал
>>> - ответа найти не смог. Надеюсь хоть здесь кто-нибудь сможет помочь.
>> неправильно значит пробовал
>> http://wiki.squid-cache.org/ConfigExamples/Intercept/OpenBsdPf
> ЗЫ PF offers a rdr-to option. However this not supported with any
> Squid. Use divert-to instead.ОС freeBSD. Для нее в мане ( http://wiki.squid-cache.org/ConfigExamples/Intercept/FreeBsd... ) написано по-другому:
#set skip on $int_if << These lines commented out
#set skip on $wi_if# redirect only IPv4 web traffic to squid
rdr pass inet proto tcp from 192.168.231.0/24 to any port 80 -> 192.168.231.1 port 3129block in
pass in quick on $int_if
pass in quick on $wi_if
pass out keep state###########
Сделал как в мане - ситуация не поменялась. Ниже обновленный конфиг PF^
###########
logopt = "log"
ext_if = "em0"
lan_if = "em1"pubserv = "{ 22, 443 }"
lanserv = "{ 22, 53, 67, 80, 443 }"
icmp_types = "echoreq"
lan_net = "{ 10.250.2.0/24, 10.250.1.0/24, 192.168.49.0/24, 192.168.50.0/24 }"
set block-policy return
set loginterface $ext_if
#set skip on lo0
#set skip on $lan_if
scrub out all random-id# NAT
#nat on $lan_if from $lan_if:network to any -> ($ext_if)#rdr
rdr pass inet proto tcp from $lan_net to any port 80 -> $lan_if port 3128block in
pass in quick on $lan_ifblock return-rst in $logopt on $ext_if proto tcp all
block return-icmp in $logopt on $ext_if proto udp all
block in $logopt on $ext_if proto icmp all
block out $logopt on $ext_if all
pass in quick on lo0 all
pass out quick on lo0 all
#block drop in $logopt quick on $ext_if from to any
#block drop out $logopt quick on $ext_if from any to
#antispoof for { $lan_if, $ext_if }
block return-rst out on $ext_if proto tcp all
block return-rst in on $ext_if proto tcp all
block return-icmp out on $ext_if proto udp all
block return-icmp in on $ext_if proto udp all
block in $logopt quick proto tcp flags FUP/WEUAPRSF
block in $logopt quick proto tcp flags WEUAPRSF/WEUAPRSF
block in $logopt quick proto tcp flags SRAFU/WEUAPRSF
block in $logopt quick proto tcp flags /WEUAPRSF
block in $logopt quick proto tcp flags SR/SR
block in $logopt quick proto tcp flags SF/SFpass in inet proto icmp all icmp-type $icmp_types keep state
pass in on $ext_if inet proto tcp from any to any port $pubserv flags S/SA keep state
pass in on $lan_if inet proto {tcp udp} from $lan_net to any port $lanserv keep statepass in from $lan_net to $lan_net keep state
pass out from $lan_net to $lan_net keep statepass out from any to any keep state
Заворачивать нужно именно в 3129, см. внимательнейsquid.conf:
http_port 3128
http_port 127.0.0.1:3129 interceptpf.conf:
rdr pass inet proto tcp from $lan_net to any port 80 -> 127.0.0.1 port 3129