View previous topic :: View next topic |
Author |
Message |
ntsite Tux's lil' helper

Joined: 13 Dec 2008 Posts: 86 Location: Khabarovsk, Russia
|
Posted: Mon Jan 26, 2009 2:41 am Post subject: Авторизация в squid [Решено] |
|
|
Доброе время суток.
Начал настраивать авторизацию в squid (net-proxy/squid-2.7.5-r1) с помощью ncsa_auth. Но тут возникла проблема. При попытке выйти в интернет, мне вылетает окно для ввода логина и пароля, ввожу, а в ответ вот такой вот ответ:
Code: | Unable to forward this request at this time |
Хотя время стоит рабочее.
Вот мой конфиг squid.conf
Code: | http_port 3128
hierarchy_stoplist cgi-bin ?
acl QUERY urlpath_regex cgi-bin \?
no_cache deny QUERY
cache_mem 80 MB
ftp_user anonymous@rex.mail.ru
auth_param basic program /usr/libexec/squid/ncsa_auth /etc/squid/passwd
quick_abort_min 5 KB
quick_abort_max 5 KB
negative_ttl 1 minutes
read_timeout 4 minutes
client_lifetime 500 minutes
acl all src all
#User ----------------------------------
acl work_time time SMTWHFA 09:00-21:00
acl good proxy_auth "/etc/squid/good"
acl normal proxy_auth "/etc/squid/normal"
acl password proxy_auth REQUIRED
acl porn url_regex "/etc/squid/porn"
acl noporn url_regex "/etc/squid/noporn"
#acl bigfiles url_regex \.mp3$ \.avi$ \.mpeg$ \.mpg$
http_access allow good
#http_access deny bigfiles normal
http_access allow noporn all
http_access deny porn all
http_access deny !work_time normal
http_access allow normal
http_access allow password
#End User ------------------------------
acl manager proto cache_object
acl localhost src 127.0.0.1/255.255.255.255
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 CONNECT method CONNECT
http_access allow manager localhost
http_access deny manager
# Deny requests to unknown ports
http_access deny !Safe_ports
# Deny CONNECT to other than SSL ports
http_access deny CONNECT !SSL_ports
http_access allow localhost
http_access deny all
icp_access allow all
cache_mgr noc@dvtgik.ru
never_direct allow all |
Не могу понять в чем ошибка, почему меня не пускает
P.S. Если все получится, получится мануал для авторизации в сквиде, которого тут нет
Если нужна будет еще какая то информация о сервере, говорите, обязательно дам. И еще хотел спросить, когда настраиваю авторизацию, я так понимаю прозрачный прокси работать ужен е будет?
Забыл добавить, правила для времени коменитировал и тот же самый ответ
Содержание файла /etc/squid/passwd
Last edited by ntsite on Thu Jan 29, 2009 3:16 pm; edited 1 time in total |
|
Back to top |
|
 |
ba l33t


Joined: 25 May 2003 Posts: 804
|
Posted: Mon Jan 26, 2009 7:03 am Post subject: Re: Авторизация в squid |
|
|
ntsite wrote: | Доброе время суток.
Начал настраивать авторизацию в squid (net-proxy/squid-2.7.5-r1) с помощью ncsa_auth. Но тут возникла проблема. При попытке выйти в интернет, мне вылетает окно для ввода логина и пароля, ввожу, а в ответ вот такой вот ответ:
Code: | Unable to forward this request at this time |
|
без аутентификации работает? юзер которым пробуешь случаем в это правило Code: | http_access deny !work_time normal | не попадает?
ntsite wrote: | И еще хотел спросить, когда настраиваю авторизацию, я так понимаю прозрачный прокси работать ужен е будет? |
не будет |
|
Back to top |
|
 |
ntsite Tux's lil' helper

Joined: 13 Dec 2008 Posts: 86 Location: Khabarovsk, Russia
|
Posted: Mon Jan 26, 2009 12:08 pm Post subject: |
|
|
Вот мой конфиг сейчас
Code: | http_port 3128 transparent
hierarchy_stoplist cgi-bin ?
acl QUERY urlpath_regex cgi-bin \?
no_cache deny QUERY
cache_mem 80 MB
ftp_user anonymous@rex.mail.ru
quick_abort_min 5 KB
quick_abort_max 5 KB
negative_ttl 1 minutes
read_timeout 4 minutes
client_lifetime 500 minutes
acl all src all
acl work_time time SMTWHFA 7:00-22:00
acl good src "/etc/squid/good"
acl normal src "/etc/squid/normal"
acl porn url_regex "/etc/squid/porn"
acl noporn url_regex "/etc/squid/noporn"
acl bigfiles url_regex \.mp3$ \.avi$ \.mpeg$ \.mpg$
http_access allow good
http_access deny bigfiles normal
http_access allow noporn all
http_access deny porn all
http_access deny !work_time normal
http_access allow normal
#End User ------------------------------
acl manager proto cache_object
acl localhost src 127.0.0.1/255.255.255.255
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 CONNECT method CONNECT
http_access allow manager localhost
http_access deny manager
# Deny requests to unknown ports
http_access deny !Safe_ports
# Deny CONNECT to other than SSL ports
http_access deny CONNECT !SSL_ports
http_access allow localhost
http_access deny all
icp_access allow all
cache_mgr noc@dvtgik.lan
|
Все работает отлично, IP адреса в good работают круглосуточно и без ограничений, а normal только в определенное время и с ограничениями на некоторые сайты и закачку файлов.
Вопрос в другом, я делал время разное, разными пользователями из группы good и normal, даже убирал параметры время и все равно почему то вылетало Unable to forward this request at this time. (куки при этом у браузера удалял, но пароль почему то опять не спрашивал...)
Хотел спросить, какой правильный синтаксис для пассов... пользователь:пароль или же пользователь:пароль:дата изменения:IP адрес?
P.S. Я бы оставил бы и с этим конфигом, но просто если студенты окажутся умными, они могут IP настроить статикой (подменить на какой нибудь администраторский пул) и тогда у них не будет ограничения. Активного оборудования пока в организации нет, потому приходится программными средствами.
Если быть точнее, браузер выдает такое вот сообщение (думаю скринить не обязательно, там простой текст)
Code: | ERROR
The requested URL could not be retrieved
While trying to retrieve the URL: http://ссылка/
The following error was encountered:
* Unable to forward this request at this time.
This request could not be forwarded to the origin server or to any parent caches. The most likely cause for this error is that:
* The cache administrator does not allow this cache to make direct connections to origin servers, and
* All configured parent caches are currently unreachable.
Your cache administrator is noc@dvtgik.ru.
Generated Mon, 26 Jan 2009 12:34:33 GMT by gate.dvtgik.lan (squid/2.7.STABLE5) |
Эту ошибку выдает при таком вот конфиге
Code: | acl foo proxy_auth REQUIRED
acl bar proxy_auth admin
acl all src 0/0
http_access allow bar
http_access allow foo
http_access deny all |
|
|
Back to top |
|
 |
ntsite Tux's lil' helper

Joined: 13 Dec 2008 Posts: 86 Location: Khabarovsk, Russia
|
Posted: Wed Jan 28, 2009 7:57 am Post subject: |
|
|
Разобрался, вот конфиг примерный
Code: | http_port 3128
hierarchy_stoplist cgi-bin ?
acl QUERY urlpath_regex cgi-bin \?
no_cache deny QUERY
cache_dir ufs /var/cache/squid 4096 16 256
cache_mem 32 MB
refresh_pattern ^ftp: 1440 20% 10080
refresh_pattern ^gopher: 1440 0% 1440
refresh_pattern . 0 20% 4320
forwarded_for off
coredump_dir /var/cache/squid
ftp_user anonymous@rex.mail.ru
auth_param basic program /usr/libexec/squid/ncsa_auth /etc/squid/passwd
auth_param basic children 6
auth_param basic realm Squid Server bla-bla
auth_param basic credentialsttl 95 minute
auth_param basic casesensitive off
#User ----------------------------------
acl password proxy_auth REQUIRED
acl good proxy_auth "/etc/squid/good"
acl normal proxy_auth "/etc/squid/normal"
acl work_time time 07:00-22:00
acl porn url_regex "/etc/squid/porn"
acl noporn url_regex "/etc/squid/noporn"
acl bigfiles url_regex \.mp3$ \.avi$ \.mpeg$ \.mpg$
acl all src 0/0
http_access allow good
http_access deny all
http_access deny bigfiles normal
http_access allow noporn all
http_access deny porn normal
http_access deny !work_time normal
http_access allow normal
http_access allow password
#End User ------------------------------
acl manager proto cache_object
acl localhost src 127.0.0.1/255.255.255.255
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 purge method PURGE
acl CONNECT method CONNECT
http_access allow manager localhost
http_access deny manager
http_access allow purge localhost
http_access deny purge
# Deny requests to unknown ports
http_access deny !Safe_ports
# Deny CONNECT to other than SSL ports
http_access deny CONNECT !SSL_ports
http_access allow localhost
http_access deny all
icp_access allow all
cache_mgr noc@dvtgik.ru |
Все работает.
Правда решил отказаться от этой идеи, т.к. в учебном заведении ее использовать совсем не выгодно (есть ряд причины, не буду их тут расписывать, они не по теме).
Решил использовать привязку к макам в сквиде, все работает отлично и меньше проблем.
Хотя есть один минус. У меня есть администраторский пул и пул учебных классов. Учебные классы ходят в интернет через сквида, статистика собирается sarg'ом (по нему у меня тоже проблемка, чуть позже отпишусь и по ней в новой теме). Если MAC другой, его конечно же не пускает в интернет.
Админский пул тоже ходит в интернет через сквида с привязкой к макам и так же для него есть правило для маскарада.
Если какой то умник найдется и подменит IP адрес, то его само собой не пустит в интернет через сквида, а вот iptables пустит за маскарадом в интернет. Читал мануалы по поводу привязки к макам в iptables - и узнал, что можно, но только к PREROUTING, FORWARD or INPUT - огорчило...
Хотел спросить, может кто знает как ограничивать маскарад по макам? Или же мне лучше создать отдельную тему? |
|
Back to top |
|
 |
ntsite Tux's lil' helper

Joined: 13 Dec 2008 Posts: 86 Location: Khabarovsk, Russia
|
Posted: Thu Jan 29, 2009 3:15 pm Post subject: |
|
|
Все, думаю вопрос разрешен, кому нибудь да пригодится  |
|
Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|