Прозрачный squid, https, rejik
Добавлено: 2019-08-16 10:33:44
Здарова мужики!
Есть роутер на uname -a: FreeBSD net.gateway 11.0-RELEASE-p8 FreeBSD 11.0-RELEASE-p8 #0: Thu Apr 6 19:22:31 MSK 2017 root@Gateway:/usr/obj/usr/src/sys/NETGATEWAY1.0 i386
Работает уже 2 года с хвостиком. Добавил вчера заворот на squid HTTPS трафика. В качестве фильтрации контента используется rejik, который прекрасно показывает заготовленные мной страницы блокировок для HTTP ресурсов. Когда блокируется сайт, работающий по HTTPS показывает вот это: Хотелось бы вместо этого показывать привычную страницу блокировки.
squid.conf
Конфиг rejik'a
Выдержка из правил IPFW
Из лога rejik'a видно, что он честно отрабатывает:
squid access.log
Прошу помощи, выручайте пацаны. Нужно при блокировке HTTPS сайтов тоже показывать страницы блокировки.
Есть роутер на uname -a: FreeBSD net.gateway 11.0-RELEASE-p8 FreeBSD 11.0-RELEASE-p8 #0: Thu Apr 6 19:22:31 MSK 2017 root@Gateway:/usr/obj/usr/src/sys/NETGATEWAY1.0 i386
Работает уже 2 года с хвостиком. Добавил вчера заворот на squid HTTPS трафика. В качестве фильтрации контента используется rejik, который прекрасно показывает заготовленные мной страницы блокировок для HTTP ресурсов. Когда блокируется сайт, работающий по HTTPS показывает вот это: Хотелось бы вместо этого показывать привычную страницу блокировки.
squid.conf
Код: Выделить всё
acl localnet src 192.168.0.0/24 # RFC1918 possible internal network
acl privileged src "/usr/local/rejik3/privileged"
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
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 192.168.0.1:3128 options=NO_SSLv3:NO_SSLv2
http_port localhost:3128 intercept options=NO_SSLv3:NO_SSLv2
https_port localhost:3129 intercept ssl-bump options=ALL:NO_SSLv3:NO_SSLv2 connection-auth=off cert=/usr/local/etc/squid/squidCA.pem
always_direct allow all
sslproxy_cert_error allow all
sslproxy_flags DONT_VERIFY_PEER
acl step1 at_step SslBump1
ssl_bump peek step1
ssl_bump splice all
sslcrtd_program /usr/local/libexec/squid/ssl_crtd -s /var/lib/ssl_db -M 4MB
# Uncomment and adjust the following to add a disk cache directory.
cache_dir ufs /usr/local/squid/cache 2048 16 256
# Amount of log files after rotate
logfile_rotate 100
# Leave coredumps in the first cache dir
coredump_dir /var/squid/cache
# Hostname for show users
visible_hostname proxy.fredy.net
# E-mail of administrator
cache_mgr admin@fredy.net
# Redirect blocked resources
redirect_program /usr/local/rejik3/redirector /usr/local/rejik3/redirector.conf
redirect_children 10
#
# 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
Код: Выделить всё
allow_ip f:/usr/local/rejik3/privileged
error_log /usr/local/rejik3/redirector.err
change_log /usr/local/rejik3/redirector.log
make-cache /usr/local/rejik3/make-cache
#allow_urls /usr/local/rejik3/banlists/allow_urls
#write_hostname_to_log on
<BANNER>
ban_dir /usr/local/rejik3/banlists/banners
url http://proxy.fredy.net/categories/banner/1x1.gif
log off
<PORNO>
ban_dir /usr/local/rejik3/banlists/porno
url http://127.0.0.1/ban/categories/adult/
<MP3>
ban_dir /usr/local/rejik3/banlists/mp3
url http://127.0.0.1/ban/categories/mp3/
<JS>
ban_dir /usr/local/rejik3/banlists/js
url http://proxy.fredy.net/categories/javascripts/js.js
log off
<ANONYM>
ban_dir /usr/local/rejik3/banlists/anonymizers
url http://127.0.0.1/ban/categories/anonym/
<FILESHARE>
ban_dir /usr/local/rejik3/banlists/fileshare
url http://127.0.0.1/ban/categories/fileshare/
<BADSITES>
ban_dir /usr/local/rejik3/banlists/badsites
url http://127.0.0.1/ban/categories/badsites/
<TORRENT>
ban_dir /usr/local/rejik3/banlists/torrents
url http://127.0.0.1/ban/categories/torrent/
#log off
<ILLEGALSW>
ban_dir /usr/local/rejik3/banlists/illegalsw
url http://127.0.0.1/ban/categories/illegalsw/
Код: Выделить всё
...
${FwCMD} add 230 fwd 127.0.0.1,3128 tcp from ${NetIn}/${NetMask} to any 80 via ${LanOut}
${FwCMD} add 231 fwd 127.0.0.1,3129 tcp from ${NetIn}/${NetMask} to any 443 via ${LanOut}
...
Код: Выделить всё
2019-08-16 10:25:58 FILESHARE: 192.168.0.21 - depositfiles.com:443 (urls rule: depositfiles.com)
2019-08-16 10:25:58 FILESHARE: 192.168.0.21 - depositfiles.com:443 (urls rule: depositfiles.com)
Код: Выделить всё
1565940358.239 56 192.168.0.21 TAG_NONE/503 0 CONNECT depositfiles.com:443 - HIER_NONE/- -
1565940358.239 55 192.168.0.21 TAG_NONE/503 0 CONNECT depositfiles.com:443 - HIER_NONE/- -