четверг, 20 декабря 2007 г.

squid + авторизация по логину и паролю

решил я всётаки поставить squid

# cd /usr/ports/www/squid26
# make install clean

вот мой конфиг

http_port 192.168.1.1:3128
icp_port 0
#htcp_port 0
hierarchy_stoplist cgi-bin ?
acl QUERY urlpath_regex cgi-bin \?
no_cache deny QUERY
cache_mem 64 MB
cache_swap_low 85
cache_swap_high 95
# specify your cache size and location (dont forget to "squid -z" after that)
cache_dir ufs /usr/local/squid/cache 1000 16 128
cache_store_log none
maximum_object_size 90096 KB
maximum_object_size_in_memory 4096 KB


log_ip_on_direct on
# access_log /usr/local/squid/logs/access.log
# by tray
client_netmask 255.255.255.255
ftp_user tray.irk@gmail.com
ftp_list_width 64
ftp_passive on
ftp_sanitycheck on
# specify auth helper and parameters
#auth_param basic program /usr/local/squid/libexec/mysql_auth
auth_param basic program /usr/local/libexec/ncsa_auth /usr/local/squid/passwd
auth_param basic children 5
auth_param basic realm Proxy on 192.168.1.1
auth_param basic credentialsttl 5 hours
refresh_pattern ^ftp: 1440 20% 10080
refresh_pattern ^gopher: 1440 0% 1440
refresh_pattern . 0 20% 4320
quick_abort_min 16 KB
quick_abort_max 16 KB
quick_abort_pct 95
range_offset_limit 0 KB

# time ALC's
# ПВСЪБФЕМШОП
acl night time SMTWHFA 00:00-07:00
acl time1700 time SMTWHFA 17:00-23:59
acl time1900 time SMTWHFA 19:00-23:59
acl time2000 time SMTWHFA 20:00-23:59
acl time2100 time SMTWHFA 21:00-23:59

acl all src 192.168.1.0/255.255.255.0
acl localhost src 127.0.0.1/255.255.255.255
acl to_localhost dst 127.0.0.0/8
acl SSL_ports port 443 563
acl Safe_ports port 80 # http
acl Safe_ports port 21 # ftp
acl Safe_ports port 443 563 # https, snews
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 5190 # icq
acl Safe_ports port 17078 # torrent
acl CONNECT method CONNECT

# Deny requests to unknown ports
http_access deny !Safe_ports
# Deny CONNECT to other than SSL ports
http_access deny CONNECT !SSL_ports
acl users proxy_auth REQUIRED
#http_access allow users our_net
#begin of acl
# There will placed users ACL's
http_access allow users
#acl time1700
acl time1700 time MTWHF 17:00-23:59
acl time1700 time SA 0:00-23:59
acl time1700 time MTWHF 0:00-8:59
#acl time1900
acl time1900 time MTWHF 19:00-23:59
acl time1900 time MTWHF 0:00-8:59
acl time1900 time SA 0:00-23:59
#acl CONNECT
#acl CONNECT method CONNECT
#acl time2000
acl time2000 time MTWHF 20:00-23:59
#acl time2100
acl time2100 time MTWHF 21:00-23:59
#acl fulltime
acl fulltime time SMTWHFA 00:00-23:59
acl group_fulltime proxy_auth "/usr/local/etc/squid/squid.conf.fulltime"
# необходимо создать файл /usr/local/etc/squid/squid.conf.fulltime
http_access allow group_fulltime fulltime
http_access allow group_fulltime CONNECT
http_access deny all
http_reply_access allow all
icp_access allow all




cache_mgr root@ru
cache_effective_user nobody
visible_hostname ServeR
#logfile_rotate 10
#err_html_text http://localhost/
memory_pools off
#memory_pools_limit 50 MB
forwarded_for off
# log_icp_queries on
# store_avg_object_size 13 KB
# store_objects_per_bucket 20
client_db off
# netdb_low 900
# netdb_high 1000
# netdb_ping_period 5 minutes
# query_icmp off
# test_reachability off
buffered_logs off
# reload_into_ims off
# icon_directory /usr/local/squid/share/icons
error_directory /usr/local/squid/errors/Russian-1251
# поставить chmod 777 /usr/local/squid/errors/
# поставить chmod 777 /usr/local/squid/
# minimum_retry_timeout 5 seconds
# maximum_single_addr_tries 3


coredump_dir /usr/local/squid/var/cache
sleep_after_fork 1000
sleep_after_fork 1000
sleep_after_fork 1000


запуск
# squid -z
# squid -D

смотрим в процесах есть ли он ....

# ps ax | grep squid
если есть то отлично ... еси нет то (( смотри логи

а да ... ещё чуть не забыл ... для всего этого нужно htpasswd (приложение из апача для добавления юзеров)

Комментариев нет: