PF + SQUID ?

FreeBSD, NetBSD, OpenBSD, DragonFly и т. д.

Модератор: arachnid

Аватара пользователя
ttys8
Сообщения: 26
ОС: FreeBSD OpenBSD Solaris 11

PF + SQUID ?

Сообщение ttys8 »

Идея завернуть на squid www трафик.
настраивал на этом примере
Вот конфиг:

Код: Выделить всё

ext_if="rl1" #Внешний интерфейс (192.168.1.0/24)
int_if="rl0" #Внутренний интерфейс (192.168.0.0/24)
internal_net="192.168.0.0/24" #Наша сеть
external_addr="192.168.1.9" #Внешний IP
kirill=192.168.0.2
set skip on lo0
scrub in all
#nat on $ext_if from $internal_net to any -> ($ext_if)
nat on $ext_if from $internal_net to any port { ntp, nntp, domain } -> ($ext_if)
rdr on $int_if proto tcp from $internal_net to any port www -> 127.0.0.1 port 3128
pass in on $int_if proto tcp from $kirill to 127.0.0.1 port 3128
pass in all
pass out all

Но нихренась не работает!
В чём проблема?
Спасибо сказали:
Аватара пользователя
ivan2ksusr
Сообщения: 882
ОС: Mac OS X, openSUSE

Re: PF + SQUID ?

Сообщение ivan2ksusr »

добавь в squid.conf

Код: Выделить всё

httpd_accel_host virtual
httpd_accel_port 80
httpd_accel_with_proxy on
httpd_accel_uses_host_header on
Спасибо сказали:
Аватара пользователя
ttys8
Сообщения: 26
ОС: FreeBSD OpenBSD Solaris 11

Re: PF + SQUID ?

Сообщение ttys8 »

ivan2ksusr писал(а):
23.12.2009 17:23
добавь в squid.conf

Код: Выделить всё

httpd_accel_host virtual
httpd_accel_port 80
httpd_accel_with_proxy on
httpd_accel_uses_host_header on

добавил, опять эта хрень

Код: Выделить всё

2009/12/24 07:26:41| parseConfigFile: squid.conf:651 unrecognized: 'httpd_accel_host'
2009/12/24 07:26:41| parseConfigFile: squid.conf:652 unrecognized: 'httpd_accel_port'
2009/12/24 07:26:41| parseConfigFile: squid.conf:653 unrecognized: 'httpd_accel_with_proxy'
2009/12/24 07:26:41| parseConfigFile: squid.conf:654 unrecognized: 'httpd_accel_uses_host_header'
2009/12/24 07:26:41| Squid is already running!  Process ID 30003

и нет кэша :wacko:
Спасибо сказали:
Аватара пользователя
ivan2ksusr
Сообщения: 882
ОС: Mac OS X, openSUSE

Re: PF + SQUID ?

Сообщение ivan2ksusr »

pkg_info|grep squid
если > 2.6 то в squid.conf надо сделать так: http_port 3128 transparent
Спасибо сказали:
Аватара пользователя
ttys8
Сообщения: 26
ОС: FreeBSD OpenBSD Solaris 11

Re: PF + SQUID ?

Сообщение ttys8 »

ivan2ksusr писал(а):
24.12.2009 10:25
pkg_info|grep squid
если > 2.6 то в squid.conf надо сделать так: http_port 3128 transparent


Код: Выделить всё

# pkg_info|grep squid
squid-2.7.7         HTTP Caching Proxy

/usr/local/etc/squid/squid.conf

Код: Выделить всё

#       visible on the internal address.
#

# Squid normally listens to port 3128
http_port 127.0.0.1:3128 transparent

#  TAG: https_port
# Note: This option is only available if Squid is rebuilt with the
#       --enable-ssl option
#
Спасибо сказали:
Аватара пользователя
ivan2ksusr
Сообщения: 882
ОС: Mac OS X, openSUSE

Re: PF + SQUID ?

Сообщение ivan2ksusr »

попробуй так:
http_port 127.0.0.1:3128 transparent > http_port 3128 transparent

Код: Выделить всё

# --------- pf.conf ----------
int_if="fxp0"
ext_if="fxp1"

rdr on $int_if inet proto tcp from any to any port www -> 127.0.0.1 port 3128
pass in on $int_if inet proto tcp from any to 127.0.0.1 port 3128 keep state
pass out on $ext_if inet proto tcp from any to any port www keep state
# ------- end pf.conf -------


только в pf свои данные поставь, и еще, посмотри собран ли у тебя squid c параметром --enable-pf-transparent :)

пока что идей бельше нет ни каких
Спасибо сказали:
Аватара пользователя
ttys8
Сообщения: 26
ОС: FreeBSD OpenBSD Solaris 11

Re: PF + SQUID ?

Сообщение ttys8 »

что из этого надо выбирать для прозрачного прокси?

Код: Выделить всё

                SQUID_LDAP_AUTH "Install LDAP authentication helpers" off \
                SQUID_NIS_AUTH "Install NIS/YP authentication helpers" on \
                SQUID_SASL_AUTH "Install SASL authentication helpers" off \
                SQUID_DELAY_POOLS "Enable delay pools" off \
                SQUID_SNMP "Enable SNMP support" on \
                SQUID_CARP "Enable CARP support" on \
                SQUID_SSL "Enable SSL support for reverse proxies" off \
                SQUID_PINGER "Install the icmp helper" off \
                SQUID_DNS_HELPER "Use the old 'dnsserver' helper" off \
                SQUID_HTCP "Enable HTCP support" off \
                SQUID_VIA_DB "Enable forward/via database" off \
                SQUID_CACHE_DIGESTS "Enable cache digests" off \
                SQUID_WCCP "Enable Web Cache Coordination Prot. v1" on \
                SQUID_WCCPV2 "Enable Web Cache Coordination Prot. v2" off \
                SQUID_STRICT_HTTP "Be strictly HTTP compliant" off \
                SQUID_IDENT "Enable ident (RFC 931) lookups" on \
                SQUID_REFERER_LOG "Enable Referer-header logging" off \
                SQUID_USERAGENT_LOG "Enable User-Agent-header logging" off \
                SQUID_ARP_ACL "Enable ACLs based on ethernet address" oт \
                SQUID_IPFW "Enable transparent proxying with IPFW" off \
                SQUID_PF "Enable transparent proxying with PF" on \
                SQUID_IPFILTER "Enable transp. proxying with IPFilter" off \
                SQUID_ICAP "Enable ICAP client functionality" off \
                SQUID_ESI "Enable ESI support (experimental)" off \
                SQUID_AUFS "Enable the aufs storage scheme" off \
                SQUID_COSS "Enable COSS (currently not available)" off \
                SQUID_KQUEUE "Use kqueue(2) (experimental)" on \
                SQUID_LARGEFILE "Support log and cache files >2GB" on \
                SQUID_STACKTRACES "Create backtraces on fatal errors" off \
                SQUID_DEBUG "Enable debugging options" off
Спасибо сказали:
Аватара пользователя
ivan2ksusr
Сообщения: 882
ОС: Mac OS X, openSUSE

Re: PF + SQUID ?

Сообщение ivan2ksusr »

да вообще можно все включить как вариант :)
SQUID_PF "Enable transparent proxying with PF" on - уже нормально, SQUID_ICAP "Enable ICAP client functionality" off > on если конечно же будете ставить clamav, на оф сайте есть описание squid что и зачем надо :)
Спасибо сказали:
Аватара пользователя
Shad0w
Сообщения: 31
ОС: Win7, FreeBSD, Ubuntu

Re: PF + SQUID ?

Сообщение Shad0w »

А без squid то работает?

SQUID_PF, SQUID_LARGEFILE будет достаточно. в довесок можно включить SQUID_DELAY_POOLS, SQUID_AUFS.

Не совсем понимаю зачем надо external_addr="192.168.1.9" в конфиге.
Для начала лучше вот так попробовать:

Код: Выделить всё

ext_if="rl1"
int_if="rl0"

set skip on lo0
scrub in all

nat on $ext_if from !($ext_if) to any -> ($ext_if)

rdr on $int_if proto tcp from $int_if:network to any port www -> 127.0.0.1 port 3128

pass all
Спасибо сказали: