Страница 1 из 1

SQUID + SAMS + AD + PERL

Добавлено: 2010-02-08 9:05:16
menai
Пролазил, прогуглил, но так и ненашел решение.... У меня стоит 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;
  }
}

Re: SQUID + SAMS + AD + PERL

Добавлено: 2010-03-07 11:00:45
Alex Keda
ф топку самсы ваши.