Freebsd 13.2 установка Squid в jail-е

Рекомендуется настроить SSL Bumping в сервисе Squid для обработки шифрованных соединений. Если SSL Bumping не настроен, то прокси-сервер не может вмешаться в процесс установки шифрованного соединения. В этом случае модули защиты Kaspersky Web Traffic Security (Антивирус и Анти-Фишинг) не могут проверить данные, передаваемые внутри шифрованного канала связи. Это снижает уровень защиты IT-инфраструктуры организации.

Для работы SSL Bumping требуется SSL-сертификат и приватный ключ в формате PEM. Вы можете создать новый самоподписанный SSL-сертификат или использовать готовый (например, SSL-сертификат, выданный центром сертификации организации).

portsnap fetch extract
portsnap fetch update
cd /usr/ports/www/squid

Выполняем установку порта:

make install clean BATCH=yes

В процессе вылезла ошибка с установкой perl5, поставил его из пакета.

Создадим сертификат для SSL-bump’инга:

cd /usr/local/etc/squid
openssl req -new -newkey rsa:1024 -days 3650 -nodes -x509 -keyout squidCA.pem -out squidCA.pem

Настройте права на использование файла SSL-сертификата:

chown squid:squid /usr/local/etc/squid/squidCA.pem
chmod 400 /usr/local/etc/squid/squidCA.pem

Инициализируем файл базы SSL:

/usr/local/libexec/squid/security_file_certgen -c -s /var/log/squid/ssl_db -M 4MB

Приводим squid.conf к следующему виду:

#
# Squid configuration:
#

# Set a hostname
visible_hostname gate78.local

# Set nameservers (optional)
#dns_nameservers 1.1.1.1

# Local area network
acl localnet src 192.168.0.0/16
acl localnet src 10.0.0.0/8

# Blocked domains
acl blocked_urls url_regex -i "/usr/local/etc/squid/blocked_urls.acl"

# Squid ports listening
http_port 0.0.0.0:3128
http_port 0.0.0.0:3129 intercept
https_port 0.0.0.0:3130 intercept ssl-bump connection-auth=off cert=/usr/local/etc/squid/squidCA.pem

always_direct allow all
sslproxy_cert_error allow all

acl blocked_https ssl::server_name "/usr/local/etc/squid/blocked_urls.acl"
acl step1 at_step SslBump1
ssl_bump peek step1

ssl_bump terminate blocked_https
ssl_bump splice all

sslcrtd_program /usr/local/libexec/squid/security_file_certgen -s /var/log/squid/ssl_db -M 4MB

# Allowed ports
acl open_ports port 80 # http
acl open_ports port 443 # https
acl ssl_ports port 443
acl CONNECT method CONNECT

#
# Access Permission configuration:
#

# Deny requests to certain unsafe ports
http_access deny !open_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

# Deny access to localhost
http_access deny to_localhost

# Deny access to domains
http_access deny blocked_urls

# Allow access from local networks
http_access allow localnet
http_access allow localhost

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

# 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

# Errors pages
#error_directory /usr/local/etc/squid/errors/ru
#error_default_language ru

Далее создадим файл со списком запрещенных сайтов:

vi /usr/local/etc/squid/blocked_urls.acl
.youtube.com
.instagram.com

Инициализируем кэш:

squid -z

Добавляем в автозагрузку:

sysrc squid_enable="YES"
sysrc gateway_enable="YES"

Не забываем включить пересылку пакетов между интерфейсами (sysrc gateway_enable=»YES»):

sysctl net.inet.ip.forwarding=1

 

Использованная литература: https://habr.com/ru/companies/timeweb/articles/586850/

https://support.kaspersky.com/KWTS/6.1/ru-RU/166244.htm

Довольны?
[Оценок: 0 средняя: 0]