SQUID + SAMS + AD + PERL

Проблемы с установкой, настройкой и работой системных и сетевых программ.

Модераторы: GRooVE, alexco

Правила форума
Убедительная просьба юзать теги [code] при оформлении листингов.
Сообщения не оформленные должным образом имеют все шансы быть незамеченными.
menai
рядовой
Сообщения: 10
Зарегистрирован: 2009-09-10 7:46:02

SQUID + SAMS + AD + PERL

Непрочитанное сообщение menai » 2010-02-08 9:05:16

Пролазил, прогуглил, но так и ненашел решение.... У меня стоит freebsd + squid + sams + AD на win2008, трабл в том что squid пропускает всех пользователей AD, а нужно только тех кто добавлен в sams... может я неправильно понял external_acl_type...

squid.conf

Код: Выделить всё

# created by SAMS _sams_ 2010-2-4 9:21:57
auth_param basic program /usr/local/libexec/squid/squid_ldap_auth -b "cn=Users,dc=domain,dc=local" -D "squid@domain.local" -w passwords -f "(&(objectClass=person)(sAMAccountName=%s))" -u sAMAccountName -h xxx.xxx.xxx.xxx -p 389
auth_param basic children 5
auth_param basic realm Squid proxy-caching web server
auth_param basic credentialsttl 2 hours
auth_param basic casesensitive off


acl all src all
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.100.0.0/16	
#
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		# 
acl Safe_ports port 5190	        # 
acl Safe_ports port 55870	        # 
acl CONNECT method CONNECT
acl domainUsers proxy_auth REQUIRED
acl InternetUsers proxy_auth_regex -i "/usr/local/etc/squid/default.sams"
acl InternetUsers proxy_auth_regex -i "/usr/local/etc/squid/4a02b83636549.sams"
acl InternetUsers proxy_auth_regex -i "/usr/local/etc/squid/49f582c92e976.sams"
external_acl_type AllowInternetUsers %LOGIN "/usr/local/etc/squid/sams.pl"
acl AllowInternetUsers external AllowInternetUsers %LOGIN
http_access deny !Safe_ports
http_access deny CONNECT !SSL_ports
http_access allow AllowInternetUsers
http_access deny all
icp_access allow localnet
icp_access deny all

http_port xxx.xxx.xxx.xxx:3128

url_rewrite_program /usr/local/rejik3/redirector /usr/local/rejik3/redirector.conf


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

acl shoutcast rep_header X-HTTP09-First-Line ^ICY.[0-9]
upgrade_http0.9 deny shoutcast

acl apache rep_header Server ^Apache
broken_vary_encoding allow apache

access_log /usr/local/squid/logs/access.log squid
cache_log /usr/local/squid/logs/cache.log
cache_store_log /usr/local/squid/logs/store.log

coredump_dir /usr/local/squid/cache

error_directory /usr/local/etc/squid/errors/Russian-koi8-r

ignore_expect_100 on
perl script, первый раз пишу на perl

Код: Выделить всё

#!/usr/bin/perl -w

$file = "</usr/local/etc/squid/default.sams";
$file1 = "</usr/local/etc/squid/4a02b83636549.sams";
$file2 = "</usr/local/etc/squid/49f582c92e976.sams";
$LOGIN = join(' ',@ARGV);
@logins = ();
open(HANDLE, $file);
open(HANDLE1, $file1);
open(HANDLE2, $file2);

while (<HANDLE>) {
  push @logins, split;
}

while (<HANDLE1>) {
  push @logins, split;
}

while (<HANDLE2>) {
  push @logins, split;
}

sub IsLogin {
  my $item = shift;
  if ($item eq $LOGIN) { 
    print "OK";
    return "OK";
  }
  else {
    print "ERR\n";
    return "ERR";
    
  }
}

foreach $s1 (@logins)
{
  if(IsLogin($s1))
  {
    last;
  }
}

Хостинговая компания Host-Food.ru
Хостинг HostFood.ru
 

Услуги хостинговой компании Host-Food.ru

Хостинг HostFood.ru

Тарифы на хостинг в России, от 12 рублей: https://www.host-food.ru/tariffs/hosting/
Тарифы на виртуальные сервера (VPS/VDS/KVM) в РФ, от 189 руб.: https://www.host-food.ru/tariffs/virtualny-server-vps/
Выделенные сервера, Россия, Москва, от 2000 рублей (HP Proliant G5, Intel Xeon E5430 (2.66GHz, Quad-Core, 12Mb), 8Gb RAM, 2x300Gb SAS HDD, P400i, 512Mb, BBU):
https://www.host-food.ru/tariffs/vydelennyi-server-ds/
Недорогие домены в популярных зонах: https://www.host-food.ru/domains/

Аватара пользователя
Alex Keda
стреляли...
Сообщения: 35456
Зарегистрирован: 2004-10-18 14:25:19
Откуда: Made in USSR
Контактная информация:

Re: SQUID + SAMS + AD + PERL

Непрочитанное сообщение Alex Keda » 2010-03-07 11:00:45

ф топку самсы ваши.
Убей их всех! Бог потом рассортирует...