From linux-umbrella-bounces@lug.lk Mon Sep 28 10:27:11 2009
Received: from localhost.pdn.ac.lk ([127.0.0.1] helo=penguin.lug.lk)
	by penguin.lug.lk with esmtp (Exim 4.63)
	(envelope-from <linux-umbrella-bounces@lug.lk>)
	id 1Ms8IR-0000cJ-7G; Mon, 28 Sep 2009 10:27:11 +0530
Received: from [192.248.40.1] (helo=hantana.pdn.ac.lk)
	by penguin.lug.lk with esmtp (Exim 4.63)
	(envelope-from <tidalbobo@gmail.com>) id 1Ms8IO-0000cB-Q1
	for linux@lug.lk; Mon, 28 Sep 2009 10:27:08 +0530
Received: from localhost (localhost.pdn.ac.lk [127.0.0.1])
	by hantana.pdn.ac.lk (Postfix) with ESMTP id A316F5C01D
	for <linux@lug.lk>; Mon, 28 Sep 2009 10:27:08 +0530 (LKT)
X-Virus-Scanned: amavisd-new at pdn.ac.lk
Received: from hantana.pdn.ac.lk ([127.0.0.1])
	by localhost (hantana.pdn.ac.lk [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id j2-A3dG7iu6t for <linux@lug.lk>;
	Mon, 28 Sep 2009 10:27:07 +0530 (LKT)
Received: from kitul.learn.ac.lk (kitul.learn.ac.lk [192.248.1.163])
	by hantana.pdn.ac.lk (Postfix) with ESMTP id 8674D5C006
	for <linux@lug.lk>; Mon, 28 Sep 2009 10:27:07 +0530 (LKT)
Received: from localhost (localhost [127.0.0.1])
	by kitul.learn.ac.lk (Postfix) with ESMTP id 6E88617B890
	for <linux@lug.lk>; Mon, 28 Sep 2009 10:27:07 +0530 (IST)
X-Virus-Scanned: amavisd-new at learn.ac.lk
Received: from kitul.learn.ac.lk ([127.0.0.1])
	by localhost (kitul.learn.ac.lk [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id 0FMIlB-tAtC1 for <linux@lug.lk>;
	Mon, 28 Sep 2009 10:26:57 +0530 (IST)
Received: from mail-px0-f175.google.com (mail-px0-f175.google.com
	[209.85.216.175])
	by kitul.learn.ac.lk (Postfix) with ESMTP id F32CD17B811
	for <linux@lug.lk>; Mon, 28 Sep 2009 10:26:33 +0530 (IST)
Received: by pxi5 with SMTP id 5so4674594pxi.12
	for <linux@lug.lk>; Sun, 27 Sep 2009 21:56:32 -0700 (PDT)
MIME-Version: 1.0
Received: by 10.142.1.24 with SMTP id 24mr218649wfa.8.1254113792221; Sun, 27 
	Sep 2009 21:56:32 -0700 (PDT)
In-Reply-To: <b646832c0909232329y50a5bf63y1d5fb55f12e455c2@mail.gmail.com>
References: <d05326450909232132qff9c828scbcea906503c8335@mail.gmail.com>
	<b646832c0909232155q27eb1911k40fdba2cb838076@mail.gmail.com>
	<d05326450909232218qde255d7u3bace13d579b3b8a@mail.gmail.com>
	<b646832c0909232329y50a5bf63y1d5fb55f12e455c2@mail.gmail.com>
Date: Mon, 28 Sep 2009 10:26:32 +0530
Message-ID: <d05326450909272156j65eb3c1dw64b8c6b182247595@mail.gmail.com>
From: tidalbobo <tidalbobo@gmail.com>
To: =?UTF-8?B?WWFqaXRoIEFqYW50aGEgRGF5YXJhdGhuYSB8IOC2uuC2ouC3kuC2reC3iiDgtoXgtqLgtrHgt4o=?=
	=?UTF-8?B?4LatIOC2r+C2uuC3j+C2u+C2reC3iuC2sQ==?= <yajith@gmail.com>,
 linux@lug.lk
Content-Type: multipart/alternative; boundary=001636b2be5717e40b04749c1fbf
X-BeenThere: linux-umbrella@lug.lk
X-Mailman-Version: 2.1.9
Precedence: list
Sender: linux-umbrella-bounces@lug.lk
Errors-To: linux-umbrella-bounces@lug.lk
X-Mailman-Approved-At: Mon, 28 Sep 2009 15:17:44 +0530
Subject: Re: [linux] SQUID-LDAP problem
X-BeenThere: linux@lug.lk
List-Id: <linux.lug.lk>
List-Unsubscribe: <https://secure.lug.lk/mailman/listinfo/linux>,
	<mailto:linux-request@lug.lk?subject=unsubscribe>
List-Archive: <http://secure.lug.lk/pipermail/linux>
List-Post: <mailto:linux@lug.lk>
List-Help: <mailto:linux-request@lug.lk?subject=help>
List-Subscribe: <https://secure.lug.lk/mailman/listinfo/linux>,
	<mailto:linux-request@lug.lk?subject=subscribe>
X-List-Received-Date: Mon, 28 Sep 2009 04:57:11 -0000

--001636b2be5717e40b04749c1fbf
Content-Type: text/plain; charset=ISO-8859-1

Problem fixed. Thank you for all the help.

i wrote an external helper using perl. If any one needs it, feel free to
use.
Its pretty crude, but functional.


--------------------------------------
external_acl_type *ldap_ip* %LOGIN %SRC /usr/lib/squid/squid_ldap_ip
 acl iplocked external *ldap_ip*


this is the squid_ldap_ip
---------------------------------------
#!/usr/bin/perl
# author : tidalbobo@gmail.com
# use : validate ip from ldap for squid
# GNU GPL
# 2009/09/24
$|=1;

$ldap_server_ip = "__________________";
$ldap_search_base = "______________________"
while(<>) {
  chomp;
  @vals = split(/ /,$_);
  $name=$vals[0];
  $ip=$vals[1];

  $cmd="ldapsearch -h $ldap_server_ip -x -b O=$ldap_search_base -LLL
\"(&(uid=$name)(c=$ip))\" $name";
  $returncode = `$cmd`;

  if (!$returncode) {
         print "ERR\n";
  } else {
         print "OK\n";
  }
}


---------------------------------------

--001636b2be5717e40b04749c1fbf
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

Problem fixed. Thank you for all the help.<br><br>i wrote an external helpe=
r using perl. If any one needs it, feel free to use.<br>Its pretty crude, b=
ut functional.<br><br><br>--------------------------------------<br>externa=
l_acl_type <b>ldap_ip</b> %LOGIN %SRC /usr/lib/squid/squid_ldap_ip<br>

<div>
acl iplocked external <b>ldap_ip</b></div><br><br>this is the squid_ldap_ip=
<br>---------------------------------------<br>#!/usr/bin/perl<br># author =
: <a href=3D"mailto:tidalbobo@gmail.com" target=3D"_blank">tidalbobo@gmail.=
com</a><br>

# use : validate ip from ldap for squid<br>
# GNU GPL<br># 2009/09/24<br>$|=3D1;<br><br>$ldap_server_ip =3D &quot;_____=
_____________&quot;;<br>$ldap_search_base =3D &quot;______________________&=
quot;<br>while(&lt;&gt;) {<br>=A0 chomp;<br>=A0 @vals =3D split(/ /,$_);<br=
>=A0 $name=3D$vals[0];<br>

=A0 $ip=3D$vals[1];<br><br>=A0 $cmd=3D&quot;ldapsearch -h $ldap_server_ip -=
x -b O=3D$ldap_search_base -LLL \&quot;(&amp;(uid=3D$name)(c=3D$ip))\&quot;=
 $name&quot;;<br>
=A0 $returncode =3D `$cmd`;<br><br>=A0 if (!$returncode) {<br>=A0=A0=A0=A0=
=A0=A0=A0=A0 print &quot;ERR\n&quot;;<br>=A0 } else {<br>=A0=A0=A0=A0=A0=A0=
=A0=A0 print &quot;OK\n&quot;;<br>=A0 }<br>}<br><br><br>-------------------=
--------------------<br><br>

--001636b2be5717e40b04749c1fbf--




