LinuxForum.Fans
Тема

настройка squid3

Автор: bigzom 43 сообщений 10078 просмотров
#267427
Vadimsky написал:
На сколько мне не изменяет слероз это уже билинг называется и делается отдельным велосипедом на других костылях.
Для примера можно скачать лив-СD UTM и посмотреть как там это реализовано, и что то сделать по аналогии.

спасибо. я пожалуй трафиком ограничусь)

в принципе время проведения на сайте как то пропорционально трафику. грубая арифметика. но все же.
а если фильмы будет смотреть? фильмы то при чем? кстати, трафик фильма можно как то отличить от трафика серфинга?

#267447

"kisil" написал:
А попробуйте пул прописать в самом конце конфига
прописал не помогло(((
Показать
acl admin src 192.168.3.170 192.168.3.58 192.168.3.59
acl my_network src 192.168.3.0
acl manager proto cache_object
acl localhost src 127.0.0.1/32 ::1
acl to_localhost dst 127.0.0.0/8 0.0.0.0/32 ::1
acl SSL_ports port 443
acl SSL_ports port 1025-65535
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 Safe_ports port 110 #pop3
acl Safe-ports port 25 #smtp
acl CONNECT method CONNECT



http_access allow manager localhost
http_access deny manager
http_access deny !Safe_ports
http_access deny CONNECT !SSL_ports
http_access allow localhost
http_access deny all
http_port 192.168.3.174:3128 transparent
hierarchy_stoplist cgi-bin ?
coredump_dir /var/spool/squid3
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
shutdown_lifetime 5.00 second

maximum_object_size 10024.00 bytes

delay_pools 1
delay_class 1 1
delay_parameters 1 30000/30000
delay_access 1 deny admin
delay_access 1 allow my_network
delay_access 1 deny all
#267462

Вопервых

"bigzom" написал:
acl my_network src 192.168.3.0
замените на такую строчку acl my_network src 192.168.3.0/16
И покажыте пожалуйста cache.log сквида после старта.
#267477

в общем

"kisil" написал:
замените на такую строчку acl my_network src 192.168.3.0/16
заменил. при рестарте выдало ошибку -
Показать
Restarting Squid HTTP Proxy 3.x: squid3 Waiting......done.
2012/08/02 11:12:06| aclIpParseIpData: WARNING: Netmask masks away part of the specified IP in '192.168.3.0/16'

по поводу кэша, я не смог создать каталог( и мне выдает -

Показать
Restarting Squid HTTP Proxy 3.x: squid3 Waiting......done.
cd: 147: can't cd to /var/cache/squid
так что я этот адрес удалил из конфига.

#267482

Значит попробуй написать сеть так 192.168.3.0/24
И пропишы в конфиг вот это

text
cache_effective_user nobody
cache_effective_group nobody
cache_dir ufs /var/run/squid/cache 1024 16 256

Потом создай из под рута кеш командой

text
squid -z
chown -R nobody:nobody /var/run/squid/cache

и пробуй запускать

#267490

kisil написал:
Вопервых [quote="bigzom"]acl my_network src 192.168.3.0
замените на такую строчку acl my_network src 192.168.3.0/16
[/quote]

А что это за сеть такая: 192.168.3.0/16??? Такое бывает?
#267492

обшыбся

#268038

Извиняюсь что долго не отвечал не мог написать, но теперь, можно продолжать обучение )
в общем дела такие, я написал в конце конфигa -

Показать
cache_effective_user nobody
cache_effective_group nobody
cache_dir ufs /var/run/squid/cache 1024 16 256

потом

"kisil" написал:
Потом создай из под рута кеш командой
squid -z

в ответ выдает -

Показать
root@ase:/home/user/Desktop# squid3 -z
WARNING: Cannot write log file: /var/log/squid3/cache.log
/var/log/squid3/cache.log: Permission denied
messages will be sent to 'stderr'.
2012/08/06 08:52:49| Creating Swap Directories
FATAL: Failed to make swap directory /var/run/squid/cache: (2) No such file or directory
Squid Cache (Version 3.1.6): Terminated abnormally.
CPU Usage: 0.008 seconds = 0.008 user + 0.000 sys
Maximum Resident Size: 16240 KB
Page faults with physical i/o: 0

что эт может быть ? o_O

#268050

WARNING: Cannot write log file: /var/log/squid3/cache.log
/var/log/squid3/cache.log: Permission denied

нет прав на запись в файл /var/log/squid3/cache.log

#268054

"riso" написал:
нет прав на запись в файл /var/log/squid3/cache.log
а как получить права ? под рутом ?
#268059

Скорее всего squid запускается не под root'ом, поэтому нужно либо разрешить запись в файл для всех

text
chmod 777 /var/log/squid3/cache.log (от рута) 

либо

text
chown squid_user:squid:user /var/log/squid3/cache.log

эта команда сделает владельцем файла пользователя, из под которого запускается squid. Заметьте, что "squid_user" я взял для примера.

#268064

Нужно так

text
chown -R nobody:nobody /var/run/squid/cache
chown -R nobody:nobody /var/log/squid3

А вообщето какая у вас система???

#268066

дела такие, cache.log создался, потом ошибка выдавалась мол не может создать каталог /var/run/squid/cache/ , я его создал в ручную через chmod 777 далее рестар выдает

Показать
root@ase:/home/user/Desktop# /etc/init.d/squid3 restart
Restarting Squid HTTP Proxy 3.x: squid3Creating Squid HTTP Proxy 3.x cache structure ... (warning).
2012/08/06 08:43:39| Creating Swap Directories
2012/08/06 08:43:39| /var/run/squid/cache exists
2012/08/06 08:43:39| Making directories in /var/run/squid/cache/00
2012/08/06 08:43:39| Making directories in /var/run/squid/cache/01
2012/08/06 08:43:39| Making directories in /var/run/squid/cache/02
2012/08/06 08:43:39| Making directories in /var/run/squid/cache/03
2012/08/06 08:43:39| Making directories in /var/run/squid/cache/04
2012/08/06 08:43:39| Making directories in /var/run/squid/cache/05
2012/08/06 08:43:39| Making directories in /var/run/squid/cache/06
2012/08/06 08:43:39| Making directories in /var/run/squid/cache/07
2012/08/06 08:43:39| Making directories in /var/run/squid/cache/08
2012/08/06 08:43:39| Making directories in /var/run/squid/cache/09
2012/08/06 08:43:39| Making directories in /var/run/squid/cache/0A
2012/08/06 08:43:39| Making directories in /var/run/squid/cache/0B
2012/08/06 08:43:39| Making directories in /var/run/squid/cache/0C
2012/08/06 08:43:39| Making directories in /var/run/squid/cache/0D
2012/08/06 08:43:39| Making directories in /var/run/squid/cache/0E
2012/08/06 08:43:39| Making directories in /var/run/squid/cache/0F
что это значит? и интернет не появился (

#268067

это значит, что директории под кеш созданы успешно.

#268075

"riso" написал:
это значит, что директории под кеш созданы успешно.
эт хорошо) а почему интернет тогды не появляется? что еще можно настроить ?
#268079

А что пишетса в cache.log ещё. Может там какието есть ошыбки.

#268080
"kisil" написал:
А что пишетса в cache.log

вот конец лога

Показать
Squid Cache (Version 3.1.6): Terminated abnormally.
CPU Usage: 0.012 seconds = 0.004 user + 0.008 sys
Maximum Resident Size: 41408 KB
Page faults with physical i/o: 0
2012/08/06 10:18:58| Starting Squid Cache version 3.1.6 for i486-pc-linux-gnu...
2012/08/06 10:18:58| Process ID 2743
2012/08/06 10:18:58| With 65535 file descriptors available
2012/08/06 10:18:58| Initializing IP Cache...
2012/08/06 10:18:58| DNS Socket created at [::], FD 7
2012/08/06 10:18:58| DNS Socket created at 0.0.0.0, FD 8
2012/08/06 10:18:58| Adding domain workgroup from /etc/resolv.conf
2012/08/06 10:18:58| Adding nameserver 192.168.1.1 from /etc/resolv.conf
FATAL: Cannot open '/var/log/squid3/access.log' for writing.
The parent directory must be writeable by the
user 'nobody', which is the cache_effective_user
set in squid.conf.
Squid Cache (Version 3.1.6): Terminated abnormally.
CPU Usage: 0.008 seconds = 0.004 user + 0.004 sys
Maximum Resident Size: 41408 KB
Page faults with physical i/o: 0
2012/08/06 10:19:01| Starting Squid Cache version 3.1.6 for i486-pc-linux-gnu...
2012/08/06 10:19:01| Process ID 2745
2012/08/06 10:19:01| With 65535 file descriptors available
2012/08/06 10:19:01| Initializing IP Cache...
2012/08/06 10:19:01| DNS Socket created at [::], FD 7
2012/08/06 10:19:01| DNS Socket created at 0.0.0.0, FD 8
2012/08/06 10:19:01| Adding domain workgroup from /etc/resolv.conf
2012/08/06 10:19:01| Adding nameserver 192.168.1.1 from /etc/resolv.conf
FATAL: Cannot open '/var/log/squid3/access.log' for writing.
The parent directory must be writeable by the
user 'nobody', which is the cache_effective_user
set in squid.conf.
Squid Cache (Version 3.1.6): Terminated abnormally.
CPU Usage: 0.008 seconds = 0.000 user + 0.008 sys
Maximum Resident Size: 41408 KB
Page faults with physical i/o: 0

я думаю полностью лог не нужен,если нужен как скопировать весь лог файл?
я так понял что то с пользователем не то

#268081

Вот мой конфиг, поправте под свои нужды.

text
acl manager proto cache_object
acl localhost src 127.0.0.1/32
acl to_localhost dst 127.0.0.0/8
acl localnet src 192.168.0.0/16

acl SSL_ports port 443 22 acl safe_ports port 22 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 acl FTP proto FTP acl HTTPS proto HTTPS

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

http_port 3128

hierarchy_stoplist cgi-bin ? cache_mem 512 MB cache_dir ufs /var/run/squid/cache 1024 16 256 access_log /var/run/squid/var/log/access.log squid cache_log /var/run/squid/var/log/cache.log cache_store_log none pid_filename /var/run/squid/var/log/squid.pid

refresh_pattern ^ftp: 1440 20% 10080 refresh_pattern ^gopher: 1440 0% 1440 refresh_pattern (cgi-bin|\?) 0 0% 0 refresh_pattern . 0 20% 4320 cache_effective_user nobody cache_effective_group nobody visible_hostname rm-proxy

acl media urlpath_regex -i \.mp3$ \.asf$ \.wma$ \.rar$ .\zip$ .\avi$ .\flv$ acl class src 127.0.0.1 192.168.0.21-192.168.0.50 192.168.0.75-192.168.0.98 192 .168.0.101-192.168.0.112 192.168.0.114-192.168.0.129 192.168.0.161-192.168.0.200 192.168.0.204-192.168.0.255 acl admin_class src 192.168.0.100 192.168.0.99 192.168.0.113 192.168.0.160 acl admin53 src 192.168.0.113 delay_pools 2 delay_class 1 2 delay_parameters 1 2000000/2000000 400000/400000 delay_access 1 allow class delay_access 1 deny localnet delay_access 1 deny all delay_class 2 1 delay_parameters 2 700000/700000 delay_access 2 allow admin_class delay_access 2 allow localnet delay_access 2 deny all snmp_port 0 icp_port 0 htcp_port 0 nonhierarchical_direct on dns_nameservers 127.0.0.1 coredump_dir /var/run/squid/cache

Если что не так пишыте.

#268082
kisil написал:
Нужно так
text
chown -R nobody:nobody /var/run/squid/cache
chown -R nobody:nobody /var/log/squid3

А вообщето какая у вас система???

Тут я ж написал что нуна сделать
Ясно же написано что владельцем родительского каталога должен быть пользователь который указан в конфиге

"bigzom" написал:
2012/08/06 10:19:01| Adding nameserver 192.168.1.1 from /etc/resolv.conf
FATAL: Cannot open '/var/log/squid3/access.log' for writing.
The parent directory must be writeable by the
user 'nobody', which is the cache_effective_user
set in squid.conf.
Squid Cache (Version 3.1.6): Terminated abnormally.
CPU Usage: 0.008 seconds = 0.000 user + 0.008 sys
Maximum Resident Size: 41408 KB
Page faults with physical i/o: 0
#268084
"kisil" написал:
А вообщето какая у вас система???

root@ase:/home/user/Desktop# uname -a
Linux ase 2.6.39-bpo.2-686-pae #1 SMP Thu Aug 4 11:02:22 UTC 2011 i686 GNU/Linux

root@ase:/home/user/Desktop# cat /proc/version
Linux version 2.6.39-bpo.2-686-pae (Debian 2.6.39-3~bpo60+1) (norbert@tretkowski.de) (gcc version 4.4.5 (Debian 4.4.5-8) ) #1 SMP Thu Aug 4 11:02:22 UTC 2011

Войдите или зарегистрируйтесь, чтобы ответить.