Компьютерный форум OSzone.net  

Компьютерный форум OSzone.net (http://forum.oszone.net/index.php)
-   Общий по FreeBSD (http://forum.oszone.net/forumdisplay.php?f=10)
-   -   Не работает прозрачны прокси SQUID (http://forum.oszone.net/showthread.php?t=316926)

tangichhan 19-07-2016 06:11 2652055

Не работает прозрачны прокси SQUID
 
Добрый день. Есть проблема, с которой я разобраться не могу.
Дано:
Сервер на FreeBSD 10
пакетный фильтр PF
squid 3.5
Проблема: При настройки прозрачного проксирования выдается ошибка на хосте (в браузере)
В чем проблема? Помогите разобраться, пожалуйста!
Ошибка в браузере
ERROR
The requested URL could not be retrieved

The following error was encountered while trying to retrieve the URL: /

Invalid URL

Some aspect of the requested URL is incorrect.

Some possible problems are:

Missing or incorrect access protocol (should be "http://" or similar)

Missing hostname

Illegal double-escape in the URL-Path

Illegal character in hostname; underscores are not allowed.

Your cache administrator is webmaster.

Если устанавливать в браузере настройки сквида, то все нормально - работает.
Конфигурация squid
#
# 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.0.0.0/8 # 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) machines

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

#
# 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 allow localnet
http_access allow localhost

# And finally deny all other access to this proxy
http_access deny all

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

# 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
visible_hostname BSDGW
#
# 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


На стороне PF настроено правило rdr
rdr on $iface2 proto tcp from {192.168.13.75} to any port $www_ports -> 192.168.0.1 port 3128


SQUID собран с параметрами
squid-3.5.9
Name : squid
Version : 3.5.9
Installed on : Fri Jul 15 09:05:37 2016 IRKT
Origin : www/squid
Architecture : freebsd:10:x86:32
Prefix : /usr/local
Categories : ipv6 www
Licenses : GPLv2
Maintainer : timp87@gmail.com
WWW : http://www.squid-cache.org/
Comment : HTTP Caching Proxy
Options :
ARP_ACL : off
AUTH_LDAP : off
AUTH_NIS : on
AUTH_SASL : off
AUTH_SMB : off
AUTH_SQL : off
CACHE_DIGESTS : off
DEBUG : off
DELAY_POOLS : on
DOCS : on
ECAP : off
ESI : off
EXAMPLES : on
FOLLOW_XFF : off
FS_AUFS : on
FS_DISKD : on
FS_ROCK : off
GSSAPI_BASE : on
GSSAPI_HEIMDAL : off
GSSAPI_MIT : off
GSSAPI_NONE : off
HTCP : on
ICAP : off
ICMP : off
IDENT : on
IPV6 : on
KQUEUE : on
LARGEFILE : on
LAX_HTTP : on
NETTLE : off
SNMP : on
SSL : off
SSL_CRTD : off
STACKTRACES : off
TP_IPF : off
TP_IPFW : off
TP_PF : on
VIA_DB : off
WCCP : on
WCCPV2 : on
Annotations :
cpe : cpe:2.3:a:squid-cache:squid:3.5.9:::::freebsd10:x86
Flat size : 8.05MiB
Description :
Squid is a fully-featured HTTP/1.0 proxy which is almost (but not quite)
HTTP/1.1 compliant. Squid offers a rich access control, authorization and
logging environment to develop web proxy and content serving applications.

WWW: http://www.squid-cache.org/

zai 19-07-2016 16:58 2652250

Попробуй transparent вместо intercept и указать реальный ip

tangichhan 20-07-2016 05:23 2652376

В версии SQUID выше 3.2 используется intercept, но замену transparent выполнял. Но ничего не помогло. Замену ip адреса http_port 192.168.20.1:3128 intercept выполнял. Так менял параметры на pf.
Что делать?

zai 20-07-2016 09:11 2652400

Порт 80 перенаправлен на 3128?

NickM 20-07-2016 20:40 2652670

tangichhan, для чего требуется прозрачность? Как с https поступите?

tangichhan 24-07-2016 15:49 2653712

для https будет NAT, для остального трафика прокси

smastykov 03-07-2017 10:20 2748696

Кусок из squid.conf
===
# Адрес и порт для входящих подключений
# При прозрачном проксировании может использоваться для управления кэшем
http_port 3128
# Локальный интерфейс, для трафика, перенаправленного брандмауэром
http_port 3129 intercept
===


Время: 22:35.

Время: 22:35.
© OSzone.net 2001-