Рекомендуется настроить SSL Bumping в сервисе Squid для обработки шифрованных соединений. Если SSL Bumping не настроен, то прокси-сервер не может вмешаться в процесс установки шифрованного соединения. В этом случае модули защиты Kaspersky Web Traffic Security (Антивирус и Анти-Фишинг) не могут проверить данные, передаваемые внутри шифрованного канала связи. Это снижает уровень защиты IT-инфраструктуры организации.
Для работы SSL Bumping требуется SSL-сертификат и приватный ключ в формате PEM. Вы можете создать новый самоподписанный SSL-сертификат или использовать готовый (например, SSL-сертификат, выданный центром сертификации организации).
1 2 |
portsnap fetch extract portsnap fetch update |
1 |
cd /usr/ports/www/squid |
Выполняем установку порта:
1 |
make install clean BATCH=yes |
В процессе вылезла ошибка с установкой perl5, поставил его из пакета.
Создадим сертификат для SSL-bump’инга:
1 2 |
cd /usr/local/etc/squid openssl req -new -newkey rsa:1024 -days 3650 -nodes -x509 -keyout squidCA.pem -out squidCA.pem |
Настройте права на использование файла SSL-сертификата:
1 2 |
chown squid:squid /usr/local/etc/squid/squidCA.pem chmod 400 /usr/local/etc/squid/squidCA.pem |
Инициализируем файл базы SSL:
1 |
/usr/local/libexec/squid/security_file_certgen -c -s /var/log/squid/ssl_db -M 4MB |
Приводим squid.conf к следующему виду:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 |
# # 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 |
Далее создадим файл со списком запрещенных сайтов:
1 2 3 |
vi /usr/local/etc/squid/blocked_urls.acl .youtube.com .instagram.com |
Инициализируем кэш:
1 |
squid -z |
Добавляем в автозагрузку:
1 2 |
sysrc squid_enable="YES" sysrc gateway_enable="YES" |
Не забываем включить пересылку пакетов между интерфейсами (sysrc gateway_enable=”YES”):
1 |
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