Lipetsk *nix Association Forum Lipetsk *nix Association Forum
Новости:
 
*
Добро пожаловать, Гость. Пожалуйста, войдите или зарегистрируйтесь.
Вам не пришло письмо с кодом активации?
19 Апреля 2024, 03:50:05


Войти


Страниц: [1]   Вниз
  Печать  
Автор Тема: FreeBSD 11+squid 4.5 прозрачное проксирование с подменой сертификата  (Прочитано 29982 раз)
0 Пользователей и 1 Гость смотрят эту тему.
wrag
Небритый одмин
*****

Карма: 0
Сообщений: 673


ОС:
Windows 7 Windows 7
Браузер:
Chrome 71.0.3578.99 Chrome 71.0.3578.99


Награды
« : 14 Февраля 2019, 10:43:42 »

Состав программного обеспечения: FreeBSD 11.2 amd64 + squid 4.5 на сервере две сетевые карты.

На текущий момент:
установлена система в качестве шлюза,
поднято соединение с интернет,
на внутреннюю сеть DHCP isc-dhcpd + DNS named (bind).
интернет раздается стабильно.

Возникла необходимость в настройке контроля проходящего трафика http\https (урезать однокласников и в контакте и вообще любой сайт, который укажут, для всех, кроме избранных, есть ещё принтера и другие устройства, которые тоже надо зарезать).

Итого получим три правила для трех типов пользователей (три файла для списков ip boss_user, allow_user, deny_user в правилах squid имя acl с окончанием s):
- можно все, адресация х.х.88.200-88.250
- можно но не все, х.х.88.1-88.100
- полный блок. х.х.88.101-88.199
пользователи прибиты по маку на dhcp к адресам.

текущий статус новых работ:
установлен squid 4.5 при старте пишет


 
Код:
WARNING: /usr/local/libexec/squid/ssl_crtd -c -s /var/log/squid/ssl_db -M 4MB #Hlpr1 exited
2019/02/14 10:18:31 kid1| Too few /usr/local/libexec/squid/ssl_crtd -c -s /var/log/squid/ssl_db -M 4MB processes are running (need 1/32)
2019/02/14 10:18:31 kid1| Closing HTTP(S) port 127.0.0.1:3128
2019/02/14 10:18:31 kid1| Closing HTTP(S) port 127.0.0.1:3130
2019/02/14 10:18:31 kid1| Closing HTTP(S) port 127.0.0.1:3129
2019/02/14 10:18:31 kid1| storeDirWriteCleanLogs: Starting...
2019/02/14 10:18:31 kid1|   Finished.  Wrote 0 entries.
2019/02/14 10:18:31 kid1|   Took 0.00 seconds (  0.00 entries/sec).
2019/02/14 10:18:31 kid1| FATAL: The /usr/local/libexec/squid/ssl_crtd -c -s /var/log/squid/ssl_db -M 4MB helpers are crashing too rapidly, need help!

Поискав в интернете нашел, что не инициализирована база ssl_db, как ее проинициализировать??
Пришел к выводу, что нужно ставить либо openssl либо вообще libressl, но так на версию openssl 1.0.0 -1.0.2 старые и из-за их проблем (но используется в системе, как бы новая версия библиотеки не покрашила часть ПО) народ дружно переехали на libressl, чтобы фильтровать шифрованный трафик.
Насколько оправдан переход на libressl, после выхода обновления в сентябре 2018 года openssl 1.1.1 ? Если обновлять openssl то полностью или ставить параллельно?

Конфиг squid 4.5

Код:
acl localnet src 192.168.88.0/24
acl allow_users src "/usr/local/etc/squid/allow_user"
acl deny_users src "/usr/local/etc/squid/deny_user"
acl boss_users src "/usr/local/etc/squid/boss_user"

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

visible_hostname bsdproxy.loc
dns_nameservers х.х.х.х

http_access deny !Safe_ports
http_access deny CONNECT !SSL_ports

# Only allow cachemgr access from localhost
http_access allow localhost manager
http_access deny manager

# INSERT YOUR OWN RULE(S) HERE TO ALLOW ACCESS FROM YOUR CLIENTS
http_access allow localnet
http_access allow localhost
http_access allow boss_users
http_access deny  boss_users


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


always_direct allow all
sslproxy_cert_error allow all
tls_outgoing_options flags=DONT_VERIFY_PEER
acl blocked ssl::server_name  "/usr/local/etc/squid/blocked_https.txt"
acl step1 at_step SslBump1
ssl_bump peek step1
ssl_bump terminate blocked
ssl_bump splice all
sslcrtd_program /usr/local/libexec/squid/ssl_crtd -c -s /var/log/squid/ssl_db -M 4MB
cache_dir ufs /var/squid/cache 100 16 256

# 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

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


опции скуида
Код:
squid -v
Squid Cache: Version 4.5
Service Name: squid

This binary uses OpenSSL 1.0.2q  20 Nov 2018. For legal restrictions on distribution see https://www.openssl.org/source/license.html

configure options:  '--with-default-user=squid' '--bindir=/usr/local/sbin' '--sbindir=/usr/local/sbin' '--datadir=/usr/local/etc/squid' '--libexecdir=/usr/local/libexec/squid' '--localstatedir=/var' '--sysconfdir=/usr/local/etc/squid' '--with-logdir=/var/log/squid' '--with-pidfile=/var/run/squid/squid.pid' '--with-swapdir=/var/squid/cache' '--without-gnutls' '--with-included-ltdl' '--enable-auth' '--enable-zph-qos' '--enable-build-info' '--enable-loadable-modules' '--enable-removal-policies=lru heap' '--disable-epoll' '--disable-linux-netfilter' '--disable-linux-tproxy' '--disable-translation' '--disable-arch-native' '--enable-eui' '--enable-cache-digests' '--enable-delay-pools' '--enable-ecap' '--disable-esi' '--enable-follow-x-forwarded-for' '--without-heimdal-krb5' '--without-mit-krb5' '--without-gss' '--enable-htcp' '--enable-icap-client' '--enable-icmp' '--enable-ident-lookups' '--disable-ipv6' '--enable-kqueue' '--with-large-files' '--enable-http-violations' '--without-nettle' '--enable-snmp' '--enable-ssl' '--with-openssl=/usr/local' '--enable-security-cert-generators=file' 'LIBOPENSSL_CFLAGS=-I/usr/local/include' 'LIBOPENSSL_LIBS=-lcrypto -lssl' '--enable-ssl-crtd' '--disable-stacktraces' '--disable-ipf-transparent' '--enable-ipfw-transparent' '--disable-pf-transparent' '--without-nat-devpf' '--enable-forw-via-db' '--enable-wccp' '--enable-wccpv2' '--enable-auth-basic=DB SMB_LM NCSA PAM POP3 RADIUS fake getpwnam' '--enable-auth-digest=file' '--enable-external-acl-helpers=file_userip unix_group' '--enable-auth-negotiate=none' '--enable-auth-ntlm=fake SMB_LM' '--enable-storeio=aufs diskd rock ufs' '--enable-disk-io=DiskThreads DiskDaemon AIO Blocking IpcIo Mmapped' '--enable-log-daemon-helpers=file' '--enable-url-rewrite-helpers=fake' '--enable-storeid-rewrite-helpers=file' '--enable-security-cert-validators=fake' '--prefix=/usr/local' '--mandir=/usr/local/man' '--disable-silent-rules' '--infodir=/usr/local/share/info/' '--build=amd64-portbld-freebsd11.2' 'build_alias=amd64-portbld-freebsd11.2' 'CC=cc' 'CFLAGS=-O2 -pipe -march=native  -I/usr/local/include -fstack-protector -fno-strict-aliasing ' 'LDFLAGS= -L/usr/local/lib -pthread -L/usr/local/lib -lpcreposix -lpcre -Wl,-rpath,/usr/local/lib -fstack-protector ' 'LIBS=' 'CPPFLAGS=-I/usr/local/include' 'CXX=c++' 'CXXFLAGS=-O2 -pipe -march=native -I/usr/local/include -fstack-protector -fno-strict-aliasing  ' 'CPP=cpp' 'PKG_CONFIG=pkgconf' --enable-ltdl-convenience

ответ при попытке выхода браузером через прокси:
Прокси-сервер отказывается принимать соединения
« Последнее редактирование: 14 Февраля 2019, 10:48:10 от wrag » Записан

живущий в консоли
начальник отдела системотехники Люцифеp
NeO
Злобный админчик
Администратор
*****

Карма: 62
Сообщений: 2376

Debian Stretch

ОС:
Linux Linux
Браузер:
Firefox 60.0 Firefox 60.0


WWW Награды
« Ответ #1 : 14 Февраля 2019, 11:24:42 »

Поискав в интернете нашел, что не инициализирована база ssl_db, как ее проинициализировать??
https://www.opennet.ru/openforum/vsluhforumID12/7034.html
Записан
wrag
Небритый одмин
*****

Карма: 0
Сообщений: 673


ОС:
Windows 7 Windows 7
Браузер:
Chrome 71.0.3578.99 Chrome 71.0.3578.99


Награды
« Ответ #2 : 14 Февраля 2019, 12:34:35 »

Ответ был найден. Нужно было вручную запустить ssl_crtd с ключами -s -c, тем самым инициализируется база для сертификатов. Потом прописать в конфиге сквида путь для ssl_crtd.
КАКККК?!?!?
ssl_crtd: Command not found.
читал уже там но не указано как/

 $ openssl version
OpenSSL 1.0.2q  20 Nov 2018

НО
Код:
/usr/ports/security/openssl# pkg upgrade openssl-1.0.2q
Updating FreeBSD repository catalogue...
Fetching meta.txz: 100%    940 B   0.9kB/s    00:01
Fetching packagesite.txz: 100%    6 MiB   1.7MB/s    00:04
Processing entries: 100%
FreeBSD repository update completed. 32374 packages processed.
All repositories are up to date.
Updating database digests format: 100%
pkg: openssl-1.0.2q is not installed, therefore upgrade is impossible
Checking integrity... done (0 conflicting)
Your packages are up to date.
вторая попытка
Код:
:/usr/ports/security/openssl# pkg upgrade openssl
Updating FreeBSD repository catalogue...
FreeBSD repository is up to date.
All repositories are up to date.
The following 1 package(s) will be affected (of 0 checked):

Installed packages to be REINSTALLED:
        openssl-1.0.2q,1 (options changed)

Number of packages to be reinstalled: 1

3 MiB to be downloaded.



Добавлено: [time]Чт 14 фев 2019 14:19:56[/time]
после установки из скачанных исходников
$ openssl version
OpenSSL 1.1.1  11 Sep 2018
$
в списке параметров команд OpenSSL и squid  нет  ssl_crtd

# /usr/local/libexec/squid/ssl_crtd -c -s /usr/local/var/squid/lib/ssl_db                                                         /usr/local/libexec/squid/ssl_crtd: Permission denied.
права выставлены
« Последнее редактирование: 14 Февраля 2019, 14:44:16 от wrag » Записан

живущий в консоли
начальник отдела системотехники Люцифеp
NeO
Злобный админчик
Администратор
*****

Карма: 62
Сообщений: 2376

Debian Stretch

ОС:
Linux Linux
Браузер:
Firefox 60.0 Firefox 60.0


WWW Награды
« Ответ #3 : 14 Февраля 2019, 14:25:35 »

У тебя прямо в конфиге прописана команда для инициализации:
Код:
/usr/local/libexec/squid/ssl_crtd -c -s /var/log/squid/ssl_db

По идее уже всё инициализировано, осталось в конфиге сквида поменять на:
Код:
sslcrtd_program /usr/local/squid/libexec/ssl_crtd -s /var/log/squid/ssl_db -M 4MB

PS ssl_crtd - это часть сквида, а не openssl.
Записан
wrag
Небритый одмин
*****

Карма: 0
Сообщений: 673


ОС:
Windows 7 Windows 7
Браузер:
Chrome 71.0.3578.99 Chrome 71.0.3578.99


Награды
« Ответ #4 : 01 Марта 2019, 08:43:34 »

Код:
2019/03/01 08:41:29 kid1| Squid plugin modules loaded: 0
2019/03/01 08:41:29 kid1| Adaptation support is off.
2019/03/01 08:41:29 kid1| Accepting NAT intercepted HTTP Socket connections at local=127.0.0.1:3128 remote=[::] FD 27 flags=41
2019/03/01 08:41:29 kid1| Accepting HTTP Socket connections at local=127.0.0.1:3130 remote=[::] FD 28 flags=9
2019/03/01 08:41:29 kid1| Accepting NAT intercepted SSL bumped HTTPS Socket connections at local=127.0.0.1:3129 remote=[::] FD 29 flags=41
2019/03/01 08:41:29 kid1| Done reading /var/squid/cache swaplog (0 entries)
2019/03/01 08:41:29 kid1| Store rebuilding is 0.00% complete
2019/03/01 08:41:29 kid1| Finished rebuilding storage from disk.
2019/03/01 08:41:29 kid1|         0 Entries scanned
2019/03/01 08:41:29 kid1|         0 Invalid entries.
2019/03/01 08:41:29 kid1|         0 With invalid flags.
2019/03/01 08:41:29 kid1|         0 Objects loaded.
2019/03/01 08:41:29 kid1|         0 Objects expired.
2019/03/01 08:41:29 kid1|         0 Objects cancelled.
2019/03/01 08:41:29 kid1|         0 Duplicate URLs purged.
2019/03/01 08:41:29 kid1|         0 Swapfile clashes avoided.
2019/03/01 08:41:29 kid1|   Took 0.01 seconds (  0.00 objects/sec).
2019/03/01 08:41:29 kid1| Beginning Validation Procedure
2019/03/01 08:41:29 kid1|   Completed Validation Procedure
2019/03/01 08:41:29 kid1|   Validated 0 Entries
2019/03/01 08:41:29 kid1|   store_swap_size = 0.00 KB
2019/03/01 08:41:29 kid1| WARNING: /usr/local/libexec/squid/ssl_crtd -s /var/log/squid/ssl_db -M 4MB #Hlpr1 exited
2019/03/01 08:41:29 kid1| Too few /usr/local/libexec/squid/ssl_crtd -s /var/log/squid/ssl_db -M 4MB processes are running (need 1/32)
2019/03/01 08:41:29 kid1| Closing HTTP(S) port 127.0.0.1:3128
2019/03/01 08:41:29 kid1| Closing HTTP(S) port 127.0.0.1:3130
2019/03/01 08:41:29 kid1| Closing HTTP(S) port 127.0.0.1:3129
2019/03/01 08:41:29 kid1| storeDirWriteCleanLogs: Starting...
2019/03/01 08:41:29 kid1|   Finished.  Wrote 0 entries.
2019/03/01 08:41:29 kid1|   Took 0.00 seconds (  0.00 entries/sec).
2019/03/01 08:41:29 kid1| FATAL: The /usr/local/libexec/squid/ssl_crtd -s /var/log/squid/ssl_db -M 4MB helpers are crashing too rapidly, need help!

2019/03/01 08:41:29 kid1| Squid Cache (Version 4.5): Terminated abnormally.
CPU Usage: 0.043 seconds = 0.021 user + 0.021 sys
Maximum Resident Size: 202784 KB
Page faults with physical i/o: 0
2019/03/01 08:41:29| WARNING: BCP 177 violation. IPv6 transport forced OFF by build parameters.
2019/03/01 08:41:29| pinger: Initialising ICMP pinger ...
2019/03/01 08:41:29| pinger: ICMP socket opened.
2019/03/01 08:41:39| Pinger exiting.

Добавлено: [time]Пт 01 мар 2019 09:41:43[/time]
Цитировать
У вас:
FATAL: The /usr/local/libexec/squid/ssl_crtd
В сквиде 4.5 заменили на:
#sslcrtd_program /usr/local/libexec/squid/security_file_certgen
Разово инициализировать базу:
КОД: ВЫДЕЛИТЬ ВСЁ

#sslcrtd_program /usr/local/libexec/squid/security_file_certgen -c -s /var/squid/cache/ssl_db -M 4MB
В конфиге использовать без параметра
КОД: ВЫДЕЛИТЬ ВСЁ



теперь вроде стартует

Код:
2019/03/01 09:32:36 kid1| Pinger socket opened on FD 31
2019/03/01 09:32:36 kid1| Squid plugin modules loaded: 0
2019/03/01 09:32:36 kid1| Adaptation support is off.
2019/03/01 09:32:36 kid1| Accepting NAT intercepted HTTP Socket connections at local=127.0.0.1:3128 remote=[::] FD 27 flags=41
2019/03/01 09:32:36 kid1| Accepting HTTP Socket connections at local=127.0.0.1:3130 remote=[::] FD 28 flags=9
2019/03/01 09:32:36 kid1| Accepting NAT intercepted SSL bumped HTTPS Socket connections at local=127.0.0.1:3129 remote=[::] FD 29 flags=41
2019/03/01 09:32:36 kid1| Done reading /var/squid/cache swaplog (0 entries)
2019/03/01 09:32:36 kid1| Store rebuilding is 0.00% complete
2019/03/01 09:32:36 kid1| Finished rebuilding storage from disk.
2019/03/01 09:32:36 kid1|         0 Entries scanned
2019/03/01 09:32:36 kid1|         0 Invalid entries.
2019/03/01 09:32:36 kid1|         0 With invalid flags.
2019/03/01 09:32:36 kid1|         0 Objects loaded.
2019/03/01 09:32:36 kid1|         0 Objects expired.
2019/03/01 09:32:36 kid1|         0 Objects cancelled.
2019/03/01 09:32:36 kid1|         0 Duplicate URLs purged.
2019/03/01 09:32:36 kid1|         0 Swapfile clashes avoided.
2019/03/01 09:32:36 kid1|   Took 0.01 seconds (  0.00 objects/sec).
2019/03/01 09:32:36 kid1| Beginning Validation Procedure
2019/03/01 09:32:36 kid1|   Completed Validation Procedure
2019/03/01 09:32:36 kid1|   Validated 0 Entries
2019/03/01 09:32:36 kid1|   store_swap_size = 0.00 KB
2019/03/01 09:32:36| WARNING: BCP 177 violation. IPv6 transport forced OFF by build parameters.
2019/03/01 09:32:36| pinger: Initialising ICMP pinger ...
2019/03/01 09:32:36| pinger: ICMP socket opened.
2019/03/01 09:32:37 kid1| storeLateRelease: released 0 objects
2019/03/01 09:33:30| Set Current Directory to /var/squid/cache
2019/03/01 09:33:30 kid1| Preparing for shutdown after 0 requests
2019/03/01 09:33:30 kid1| Waiting 30 seconds for active connections to finish
2019/03/01 09:33:30 kid1| Closing HTTP(S) port 127.0.0.1:3128
2019/03/01 09:33:30 kid1| Closing HTTP(S) port 127.0.0.1:3130
2019/03/01 09:33:30 kid1| Closing HTTP(S) port 127.0.0.1:3129
2019/03/01 09:33:30 kid1| Closing Pinger socket on FD 31
2019/03/01 09:33:36| Pinger exiting.
2019/03/01 09:34:01 kid1| Shutdown: NTLM authentication.
2019/03/01 09:34:01 kid1| Shutdown: Negotiate authentication.
2019/03/01 09:34:01 kid1| Shutdown: Digest authentication.
2019/03/01 09:34:01 kid1| Shutdown: Basic authentication.
2019/03/01 09:34:01 kid1| Shutting down...
2019/03/01 09:34:01 kid1| Closing unlinkd pipe on FD 24
2019/03/01 09:34:01 kid1| storeDirWriteCleanLogs: Starting...
2019/03/01 09:34:01 kid1|   Finished.  Wrote 0 entries.
2019/03/01 09:34:01 kid1|   Took 0.00 seconds (  0.00 entries/sec).
CPU Usage: 0.056 seconds = 0.022 user + 0.034 sys
Maximum Resident Size: 204736 KB
Page faults with physical i/o: 0
2019/03/01 09:34:01 kid1| Logfile: closing log daemon:/var/log/squid/access.log
2019/03/01 09:34:01 kid1| Logfile Daemon: closing log daemon:/var/log/squid/access.log
2019/03/01 09:34:01 kid1| Open FD UNSTARTED     9 security_file_certgen #1
2019/03/01 09:34:01 kid1| Open FD UNSTARTED    11 security_file_certgen #2
2019/03/01 09:34:01 kid1| Open FD UNSTARTED    13 security_file_certgen #3
2019/03/01 09:34:01 kid1| Open FD UNSTARTED    15 security_file_certgen #4
2019/03/01 09:34:01 kid1| Open FD UNSTARTED    17 security_file_certgen #5
2019/03/01 09:34:01 kid1| Open FD UNSTARTED    19 IPC UNIX STREAM Parent
2019/03/01 09:34:01 kid1| Squid Cache (Version 4.5): Exiting normally.
2019/03/01 09:34:01| Removing PID file (/var/run/squid/squid.pid)

Добавлено: 01 Марта 2019, 10:13:28
В общем в режиме service squid onestart запущен не валиться и ошибок не пишет.


Добавлено: 01 Марта 2019, 10:56:09
так как нужно прозрачное проксирование с подменой сертификата то хотелось бы получить советы и рекомендации по настройке конфига скуид 4.5!

Добавлено: 01 Марта 2019, 14:29:46
распишу мысли по конфигу:


\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
# блок который был (разбираем объявление прозрачности с подменой сертификата)
always_direct allow all
sslproxy_cert_error allow all
tls_outgoing_options flags=DONT_VERIFY_PEER
acl blocked ssl::server_name  "/usr/local/etc/squid/blocked_https.txt"
acl step1 at_step SslBump1
ssl_bump peek step1
ssl_bump terminate blocked
ssl_bump splice all
\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\



# как выяснили в данном блоке вроде все нормально ошибок при старте не дает, но не понятно, что же дают опции
# options=ALL:NO_SSLv3:NO_SSLv2 connection-auth=off по идее если мы делаем подмену то теоретически должны быть опции
# генерирования сертификата и его подмены относительно портов стандарта https ибо они прячутся.

http_port 127.0.0.1:3128 intercept
http_port 127.0.0.1:3130
https_port 127.0.0.1:3129 intercept ssl-bump options=ALL:NO_SSLv3:NO_SSLv2 connection-auth=off cert=/usr/local/etc/squid/squidCA.pem
#  нашел пример но в нем почему-то порты http
#   http_port 3128 ssl-bump cert=/usr/local/etc/squid/ssl/squidCA.pem generate-host-certificates=on dynamic_cert_mem_cache_size=16MB

# Принимаем сертификаты, даже если они не прошли проверку.
always_direct allow all
sslproxy_cert_error allow all
# неведомая хрень позже посмотрю что делает закомментирую пока что ? ? ? ? ? ? ? ? ? ? ? ? ? ?
# tls_outgoing_options flags=DONT_VERIFY_PEER

# Укажем список блокируемых ресурсов (в файле домены вида .domain.com) и правила блокировки их
   
   acl blocked ssl::server_name  "/usr/local/etc/squid/blocked_https.txt"

# Закрываем соединение, если клиент заходит на ресурс указанные в blocked
# краткая справка:
# И для каждого из этих этапов можно определить, что Squid будет делать c запросами клиентов:
# splice - пропустить все последующие действия, т.е. просто поднимаем TCP-туннель, словно и нет никакого ssl-bump
# peek — подсмотреть всю доступную информацию без "влезания" в соединение
# terminate — закрыть соединение
# bump — "влезть" в соединение, сделать https видимым как http
# SslBump1 - получение открытой информации о соединении (из сертификатов и http-запроса);
# SslBump2 - передача Hello info клиента (создание соединения с сервером);
# SslBump3 - получение Hello info сервера (создание соединения с клиентом).

# Cоздаем acl с шагами bump. Странный блок сам по себе, если мы хотим видеть все соединения расшифрованными,
#  то вероятно по иному выглядеть должны, по идее заменить в нем peek  и splice на bump:


   acl step1 at_step SslBump1  # создать еще правило  с именем step1 для получения открытой информацией
   ssl_bump peek step1         # подсмотреть всю доступную информацию без "влезания" в соединение ---- вопрос почему не bump???
   ssl_bump terminate blocked  #  здесь блочить все что указано в файле в правиле blocked см. выше
   ssl_bump splice all         #  пропустить все последующие действия для всех. ---- вопрос почему не bump???

# Настраиваем хелпер генерации сертификатов для сайтов в инструкции указано что лучше увелить размер базы  16MB
# и добавить строку sslcrtd_children 50 startup=10 idle=10

sslcrtd_program /usr/local/libexec/squid/security_file_certgen -s /var/log/squid/ssl_db -M 4MB
sslcrtd_children 50 startup=10 idle=10

\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
# блок который по идее должен принять вид, но первые три строки у всех мануалов разняться. что правильно сюда писать?
http_port 127.0.0.1:3128 intercept
http_port 127.0.0.1:3130
https_port 127.0.0.1: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

acl blocked ssl::server_name  "/usr/local/etc/squid/blocked_https.txt"
acl step1 at_step SslBump1 
   ssl_bump peek step1
        ssl_bump bump all   
   ssl_bump terminate blocked 

sslcrtd_program /usr/local/libexec/squid/security_file_certgen -s /var/log/squid/ssl_db -M 4MB
sslcrtd_children 50 startup=10 idle=10
\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\    
« Последнее редактирование: 01 Марта 2019, 14:29:46 от wrag » Записан

живущий в консоли
начальник отдела системотехники Люцифеp
wrag
Небритый одмин
*****

Карма: 0
Сообщений: 673


ОС:
Windows 7 Windows 7
Браузер:
Chrome 72.0.3626.109 Chrome 72.0.3626.109


Награды
« Ответ #5 : 13 Марта 2019, 16:40:11 »

в общем конфиг такой:
Код:
acl localnet src 192.168.88.0/24
acl deny_users src "/usr/local/etc/squid/deny_user"

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

visible_hostname xxxxxxxx.loc
dns_nameservers хх.хх.хх.хх

# Recommended minimum configuration:

http_access deny !Safe_ports
http_access deny CONNECT !SSL_ports
http_access allow localhost manager
http_access deny manager
http_access allow localnet
http_access allow localhost
http_access deny all

# прозрачность

http_port 127.0.0.1:3128 intercept
http_port 127.0.0.1:3130
https_port 127.0.0.1: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


# блокировка сайтов из файла blocked_https.txt

acl blocked ssl::server_name  "/usr/local/etc/squid/blocked_https.txt"
acl step1 at_step SslBump1
ssl_bump peek step1
ssl_bump terminate blocked deny_users
ssl_bump bump all

sslcrtd_program /usr/local/libexec/squid/security_file_certgen -s /var/log/squid/ssl_db -M 4MB
cache_dir ufs /var/squid/cache 100 16 256

# дальше не менялось

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


ошибок на сервере нет,
 при попытке выйти через комп  с прописанным в настройках мозилы прокси:

Прокси-сервер отказывается принимать соединения
Firefox настроен на использование прокси-сервера, который отказывает в соединении.
а в access.log пишет:
Код:


1549896253.352      0 139.162.102.46 TAG_NONE/400 4421 NONE error:invalid-request - HIER_NONE/- text/html
1549896261.013   1742 139.162.102.46 TCP_DENIED/403 4010 GET http://clientapi.ipip.net/echo.php? - HIER_NONE/- text/html
1549896277.353      0 139.162.102.46 TCP_DENIED/403 3928 GET http://213.109.8.37:3128/ - HIER_NONE/- text/html
1549898136.413      0 185.120.188.220 TAG_NONE/400 3940 ^C mstshash=hello - HIER_NONE/- text/html
1549900843.111      0 185.120.188.220 TAG_NONE/400 3940 ^C mstshash=hello - HIER_NONE/- text/html
1549903011.437      0 46.161.27.52 TAG_NONE/400 3935 ^C mstshash=Test - HIER_NONE/- text/html
1549903011.533      0 46.161.27.52 TAG_NONE/400 3935 ^C mstshash=Test - HIER_NONE/- text/html
1549903590.748      0 185.120.188.220 TAG_NONE/400 3940 ^C mstshash=hello - HIER_NONE/- text/html
1549906296.417      0 185.120.188.220 TAG_NONE/400 3940 ^C mstshash=hello - HIER_NONE/- text/html
1549909001.853      0 185.120.188.220 TAG_NONE/400 3940 ^C mstshash=hello - HIER_NONE/- text/html
1549911701.751      0 185.120.188.220 TAG_NONE/400 3940 ^C mstshash=hello - HIER_NONE/- text/html
1549914407.038      0 185.120.188.220 TAG_NONE/400 3940 ^C mstshash=hello - HIER_NONE/- text/html
1549917106.225      0 185.120.188.220 TAG_NONE/400 3940 ^C mstshash=hello - HIER_NONE/- text/html
1549919804.441      0 185.120.188.220 TAG_NONE/400 3940 ^C mstshash=hello - HIER_NONE/- text/html
1549922502.777      0 185.120.188.220 TAG_NONE/400 3940 ^C mstshash=hello - HIER_NONE/- text/html
1549925207.102      0 185.120.188.220 TAG_NONE/400 3940 ^C mstshash=hello - HIER_NONE/- text/html
1549926847.544      0 223.105.4.249 TCP_DENIED/200 0 CONNECT 213.109.8.37:3129 - HIER_NONE/- -
1549926883.504      0 223.105.4.249 TCP_DENIED/403 4220 GET http://112.35.63.31:10083/index.php - HIER_NONE/- text/html
1549927520.831      0 91.123.157.56 TCP_DENIED/403 4058 GET http://ipdb-bot.ru/HttpRequest/spider3.ashx? - HIER_NONE/- text/html
1549927521.783    951 91.123.157.56 TCP_DENIED/403 4058 GET http://ipdb-bot.ru/HttpRequest/spider3.ashx? - HIER_NONE/- text/html
1549927841.656      0 172.104.100.117 TCP_DENIED/403 3946 GET http://213.109.8.37:3128/ - HIER_NONE/- text/html
1549927904.727      0 185.120.188.220 TAG_NONE/400 3940 ^C mstshash=hello - HIER_NONE/- text/html
1549930602.675      0 185.120.188.220 TAG_NONE/400 3940 ^C mstshash=hello - HIER_NONE/- text/html
1549933300.007      0 185.120.188.220 TAG_NONE/400 3940 ^C mstshash=hello - HIER_NONE/- text/html
1549935999.096      0 185.120.188.220 TAG_NONE/400 3940 ^C mstshash=hello - HIER_NONE/- text/html
1549938699.466      0 185.120.188.220 TAG_NONE/400 3940 ^C mstshash=hello - HIER_NONE/- text/html
1549941394.071      0 185.120.188.220 TAG_NONE/400 3940 ^C mstshash=hello - HIER_NONE/- text/html
1549944087.932      0 185.120.188.220 TAG_NONE/400 3940 ^C mstshash=hello - HIER_NONE/- text/html
1549946787.897      0 185.120.188.220 TAG_NONE/400 3940 ^C mstshash=hello - HIER_NONE/- text/html
1549949486.596      0 185.120.188.220 TAG_NONE/400 3940 ^C mstshash=hello - HIER_NONE/- text/html
1549952184.943      0 185.120.188.220 TAG_NONE/400 3940 ^C mstshash=hello - HIER_NONE/- text/html
1549954888.015      0 185.120.188.220 TAG_NONE/400 3940 ^C mstshash=hello - HIER_NONE/- text/html
1549957593.142      0 185.120.188.220 TAG_NONE/400 3940 ^C mstshash=hello - HIER_NONE/- text/html



Добавлено: 14 Марта 2019, 12:51:38
В общем теперь пускает в интернет через прокси сервер порт 3130 после прописывания в браузере, поправил конфиг.

Есть два куска запрещающие выход на сайты, но почему-то
не работает вот этот кусок:
Код:
acl block1ssl ssl::server_name "/usr/local/etc/squid/blocklist"
acl step1 at_step SslBump1
ssl_bump peek step1
ssl_bump terminate block1ssl
ssl_bump splice !deny_users

блокировка сайтов появляется после добавления правила:

Код:
http_access deny block1 deny_users

где block1  -----acl block1 url_regex -i "/usr/local/etc/squid/blocklist"  # список сайтов под блокировку
      deny_users ----acl deny_users src "/usr/local/etc/squid/deny_user" # список компов с блокировкой
« Последнее редактирование: 14 Марта 2019, 12:54:58 от wrag » Записан

живущий в консоли
начальник отдела системотехники Люцифеp
wrag
Небритый одмин
*****

Карма: 0
Сообщений: 673


ОС:
Windows 7 Windows 7
Браузер:
Chrome 72.0.3626.109 Chrome 72.0.3626.109


Награды
« Ответ #6 : 18 Марта 2019, 09:34:50 »

пока конфиг выглядит так:
 
Код:
acl localnet src 192.168.88.0/24
acl deny_users src "/usr/local/etc/squid/deny_user"
acl block1 url_regex -i "/usr/local/etc/squid/blocklist"


# временно закрыл в дальнейшие правила, добавлю для более тонкой настройки правил фильтрации позже
# acl allow_users src "/usr/local/etc/squid/allow_user"
# acl boss_users src "/usr/local/etc/squid/boss_user"
# acl block2 url_regex -i "/usr/local/etc/squid/blocked_https.txt"


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

visible_hostname some_name.loc
dns_nameservers xx.xx.xx.xx

# Recommended minimum Access Permission configuration:

http_access deny !Safe_ports
http_access deny CONNECT !SSL_ports
http_access allow localhost manager
http_access deny manager

# INSERT YOUR OWN RULE(S) HERE TO ALLOW ACCESS FROM YOUR CLIENTS
http_access deny block1 deny_users  # или обратное правило можно всем кроме deny_users  ---- http_access allow block1 !deny_users
http_access allow localnet
http_access allow localhost
http_access deny all

# Squid  port 3128

http_port 192.168.88.1:3128 intercept
http_port 192.168.88.1:3130
https_port 192.168.88.1: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


acl block1ssl ssl::server_name "/usr/local/etc/squid/blocklist"
acl step1 at_step SslBump1
ssl_bump peek step1
ssl_bump terminate block1ssl
ssl_bump splice !deny_users


sslcrtd_program /usr/local/libexec/squid/security_file_certgen -s /var/log/squid/ssl_db -M 16MB
cache_dir ufs /var/squid/cache 100 16 256
дальше не менял

Добавлено: 19 Марта 2019, 15:43:40
скрипт управления файрволом насколько верно завернут трафик на скуид?:

#!/bin/sh
cmd="ipfw -q add"                                                          #  переменная для задания команды файрволу
ipfw -q -f flush                                                               # сброс старых правил
ks="keep-state"                                                              # пока не ясно зачем
$cmd 100 allow ip from any to any
$cmd 120 fwd 127.0.0.1,3128 tcp from 192.168.88.0/24 to any 80 out via re0 $ks  # вместо 127.0.0.1 возможно прописать внутренний адрес 192.168.88.251
$cmd 121 fwd 127.0.0.1,3129 tcp from 192.168.88.0/24 to any 443 out via re0 $ks
$cmd 124 divert natd ip from any to any via re0
« Последнее редактирование: 19 Марта 2019, 15:43:40 от wrag » Записан

живущий в консоли
начальник отдела системотехники Люцифеp
Страниц: [1]   Вверх
  Печать  
 
Перейти в:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2011, Simple Machines

Valid XHTML 1.0! Valid CSS! Dilber MC Theme by HarzeM