[prev in list] [next in list] [prev in thread] [next in thread] 

List:       freeradius-users
Subject:    rlm_ldap group search filter
From:       Chris Taylor <Chris.Taylor () corp ! eastlink ! ca>
Date:       2013-02-27 16:49:18
Message-ID: 405CDB4498600447A16CCC4ED3BFCAD30186E91B79 () SCOOBY ! corp ! eastlink ! ca
[Download RAW message or body]

I am have profiles setup for all our users but I am having some trouble with the \
setting the groupmembership_filter correctly. It will query LDAP successfully but \
only after it does a failed search first.

I have tried using numerous filters including the default one but I cant seem to \
separate the username by itself which is causing the initial search failure. I read \
through the rlm_ldap doc a few times but I didn't seem anything that I thought would \
help.


Here is the output from radius -X

This is the part where it uses the search filter and fails.


[files] users: Matched entry DEFAULT at line 214
  [domain1] Entering ldap_groupcmp()
[files]         expand: ou=radius,o=domain.on.ca,dc=placeholder,dc=ca -> \
ou=radius,o=domain.on.ca,dc=placeholder,dc=ca [files]         expand: \
(&(objectClass=radiusProfile)(member=%{control:Ldap-UserDn})) -> \
(&(objectClass=radiusProfile)(member=uid\3d112boy\2cou\3dradius\2co\3ddomain.on.ca\2cdc\3dplaceholder\2cdc\3dca))
  [domain1] ldap_get_conn: Checking Id: 0
  [domain1] ldap_get_conn: Got Id: 0
  [domain1] performing search in ou=radius,o=domain.on.ca,dc=placeholder,dc=ca, with \
filter (&(cn=residential_profile)(&(objectClass=radiusProfile)(member=uid\3d112boy\2cou\3dradius\2co\3ddomain.on.ca\2cdc\3dplaceholder\2cdc\3dca)))
  [domain1] object not found

It starts a second search and succeeds.

  [domain1] ldap_release_conn: Release Id: 0
  [domain1] ldap_get_conn: Checking Id: 0
  [domain1] ldap_get_conn: Got Id: 0
  [domain1] performing search in \
uid=112boy,ou=radius,o=domain.on.ca,dc=palceholder,dc=ca, with filter (objectclass=*) \
rlm_ldap::ldap_groupcmp: User found in group residential_profile  [domain1] \
ldap_release_conn: Release Id: 0 [files] users: Matched entry DEFAULT at line 222
++[files] returns ok


My users file looks like this.

ldap domain1 {
        server = " ldap01.placeholder.ca"
        identity = "username xxx"
        password = xxxx
        basedn = "ou=radius,o=domain.on.ca,dc=placeholder,dc=ca"
        filter = "(&(uid=%{%{Stripped-User-Name}:-%{User-Name}})(objectclass=posixAccount)(cn=true))"
  groupname_attribute = cn
        groupmembership_attribute = radiusGroupName
       groupmembership_filter = \
"(&(objectClass=radiusProfile)(member=%{control:Ldap-UserDn}))"  #do_xlat = yes
       #compare_check_items = yes
       #access_attr_used_for_allow = yes
       ldap_connections_number = 5


My users file

DEFAULT Service-Type == Framed-User, Huntgroup-Name == bras, domain1-Ldap-Group == \
residential_profile  Service-Type = Framed-User,
        Framed-Protocol = PPP,
        Cisco-AVPair += "ip:inacl#100=permit tcp any x.x.0.16 0.0.0.15 eq 25",
        Cisco-AVPair += "ip:inacl#200=deny tcp any any eq 25",
        Cisco-AVPair += "ip:inacl#300=permit ip any any",
        Fall-Through = No
Any help is apprecaited.
Thanks,

Chris


[Attachment #3 (text/html)]

<html xmlns:v="urn:schemas-microsoft-com:vml" \
xmlns:o="urn:schemas-microsoft-com:office:office" \
xmlns:w="urn:schemas-microsoft-com:office:word" \
xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" \
xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type \
content="text/html; charset=us-ascii"><meta name=Generator content="Microsoft Word 12 \
(filtered medium)"><style><!-- /* Font Definitions */
@font-face
	{font-family:Calibri;
	panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
	{margin:0in;
	margin-bottom:.0001pt;
	font-size:11.0pt;
	font-family:"Calibri","sans-serif";}
a:link, span.MsoHyperlink
	{mso-style-priority:99;
	color:blue;
	text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
	{mso-style-priority:99;
	color:purple;
	text-decoration:underline;}
span.EmailStyle17
	{mso-style-type:personal-compose;
	font-family:"Calibri","sans-serif";
	color:windowtext;}
.MsoChpDefault
	{mso-style-type:export-only;}
@page WordSection1
	{size:8.5in 11.0in;
	margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
	{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body lang=EN-US link=blue vlink=purple><div \
class=WordSection1><p class=MsoNormal>I am have profiles setup for all our users but \
I am having some trouble with the setting the groupmembership_filter correctly. It \
will query LDAP successfully but only after it does a failed search \
first.<o:p></o:p></p><p class=MsoNormal><o:p>&nbsp;</o:p></p><p class=MsoNormal \
style='margin-bottom:10.0pt;line-height:107%'>I have tried using numerous filters \
including the default one but I cant seem to separate the username by itself which is \
causing the initial search failure. I read through the rlm_ldap doc a few times but I \
didn&#8217;t seem anything that I thought would help.<o:p></o:p></p><p \
class=MsoNormal><o:p>&nbsp;</o:p></p><p class=MsoNormal><o:p>&nbsp;</o:p></p><p \
class=MsoNormal>Here is the output from radius &#8211;X<o:p></o:p></p><p \
class=MsoNormal><o:p>&nbsp;</o:p></p><p class=MsoNormal>This is the part where it \
uses the search filter and fails.<o:p></o:p></p><p \
class=MsoNormal><o:p>&nbsp;</o:p></p><p class=MsoNormal><o:p>&nbsp;</o:p></p><p \
class=MsoNormal>[files] users: Matched entry DEFAULT at line 214<o:p></o:p></p><p \
class=MsoNormal>&nbsp; [domain1] Entering ldap_groupcmp()<o:p></o:p></p><p \
class=MsoNormal>[files]&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; expand: \
ou=radius,o=domain.on.ca,dc=placeholder,dc=ca -&gt; \
ou=radius,o=domain.on.ca,dc=placeholder,dc=ca<o:p></o:p></p><p \
class=MsoNormal>[files]&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; expand: \
(&amp;(objectClass=radiusProfile)(member=%{control:Ldap-UserDn})) -&gt; \
(&amp;(objectClass=radiusProfile)(member=uid\3d112boy\2cou\3dradius\2co\3ddomain.on.ca\2cdc\3dplaceholder\2cdc\3dca))<o:p></o:p></p><p \
class=MsoNormal>&nbsp; [domain1] ldap_get_conn: Checking Id: 0<o:p></o:p></p><p \
class=MsoNormal>&nbsp; [domain1] ldap_get_conn: Got Id: 0<o:p></o:p></p><p \
class=MsoNormal>&nbsp; [domain1] performing search in \
ou=radius,o=domain.on.ca,dc=placeholder,dc=ca, with filter \
(&amp;(cn=residential_profile)(&amp;(objectClass=radiusProfile)(member=uid\3d112boy\2cou\3dradius\2co\3ddomain.on.ca\2cdc\3dplaceholder\2cdc\3dca)))<o:p></o:p></p><p \
class=MsoNormal>&nbsp; [domain1] object not found<o:p></o:p></p><p \
class=MsoNormal><o:p>&nbsp;</o:p></p><p class=MsoNormal>It starts a second search and \
succeeds.<o:p></o:p></p><p class=MsoNormal><o:p>&nbsp;</o:p></p><p \
class=MsoNormal>&nbsp; [domain1] ldap_release_conn: Release Id: 0<o:p></o:p></p><p \
class=MsoNormal>&nbsp; [domain1] ldap_get_conn: Checking Id: 0<o:p></o:p></p><p \
class=MsoNormal>&nbsp; [domain1] ldap_get_conn: Got Id: 0<o:p></o:p></p><p \
class=MsoNormal>&nbsp; [domain1] performing search in \
uid=112boy,ou=radius,o=domain.on.ca,dc=palceholder,dc=ca, with filter \
(objectclass=*)<o:p></o:p></p><p class=MsoNormal>rlm_ldap::ldap_groupcmp: User found \
in group residential_profile<o:p></o:p></p><p class=MsoNormal>&nbsp; [domain1] \
ldap_release_conn: Release Id: 0<o:p></o:p></p><p class=MsoNormal>[files] users: \
Matched entry DEFAULT at line 222<o:p></o:p></p><p class=MsoNormal>++[files] returns \
ok<o:p></o:p></p><p class=MsoNormal><o:p>&nbsp;</o:p></p><p class=MsoNormal \
style='margin-bottom:10.0pt;line-height:107%'><o:p>&nbsp;</o:p></p><p class=MsoNormal \
style='margin-bottom:10.0pt;line-height:107%'>My users file looks like \
this.<o:p></o:p></p><p class=MsoNormal \
style='margin-bottom:10.0pt;line-height:107%'><o:p>&nbsp;</o:p></p><p class=MsoNormal \
style='margin-bottom:10.0pt;line-height:107%'>ldap domain1 {<o:p></o:p></p><p \
class=MsoNormal style='margin-bottom:10.0pt;line-height:107%'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
server = &quot; ldap01.placeholder.ca&quot;<o:p></o:p></p><p class=MsoNormal \
style='margin-bottom:10.0pt;line-height:107%'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
identity = &quot;username xxx&quot;<o:p></o:p></p><p class=MsoNormal \
style='margin-bottom:10.0pt;line-height:107%'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
password = xxxx<o:p></o:p></p><p class=MsoNormal \
style='margin-bottom:10.0pt;line-height:107%'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
basedn = &quot;ou=radius,o=domain.on.ca,dc=placeholder,dc=ca&quot;<o:p></o:p></p><p \
class=MsoNormal style='margin-bottom:10.0pt;line-height:107%'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
filter = &quot;(&amp;(uid=%{%{Stripped-User-Name}:-%{User-Name}})(objectclass=posixAccount)(cn=true))&quot;<o:p></o:p></p><p \
class=MsoNormal style='margin-bottom:10.0pt;line-height:107%'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
groupname_attribute = cn<o:p></o:p></p><p class=MsoNormal \
style='margin-bottom:10.0pt;line-height:107%'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
groupmembership_attribute = radiusGroupName<o:p></o:p></p><p class=MsoNormal \
style='margin-bottom:10.0pt;line-height:107%'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
groupmembership_filter = \
&quot;(&amp;(objectClass=radiusProfile)(member=%{control:Ldap-UserDn}))&quot;<o:p></o:p></p><p \
class=MsoNormal style='margin-bottom:10.0pt;line-height:107%'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
#do_xlat = yes<o:p></o:p></p><p class=MsoNormal \
style='margin-bottom:10.0pt;line-height:107%'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
&nbsp;#compare_check_items = yes<o:p></o:p></p><p class=MsoNormal \
style='margin-bottom:10.0pt;line-height:107%'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
&nbsp;#access_attr_used_for_allow = yes<o:p></o:p></p><p class=MsoNormal \
style='margin-bottom:10.0pt;line-height:107%'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
&nbsp;ldap_connections_number = 5<o:p></o:p></p><p class=MsoNormal \
style='margin-bottom:10.0pt;line-height:107%'><o:p>&nbsp;</o:p></p><p class=MsoNormal \
style='margin-bottom:10.0pt;line-height:107%'><o:p>&nbsp;</o:p></p><p class=MsoNormal \
style='margin-bottom:10.0pt;line-height:107%'>My users file<o:p></o:p></p><p \
class=MsoNormal style='margin-bottom:10.0pt;line-height:107%'><o:p>&nbsp;</o:p></p><p \
class=MsoNormal style='margin-bottom:10.0pt;line-height:107%'>DEFAULT Service-Type == \
Framed-User, Huntgroup-Name == bras, domain1-Ldap-Group == \
residential_profile<o:p></o:p></p><p class=MsoNormal \
style='margin-bottom:10.0pt;line-height:107%'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
Service-Type = Framed-User,<o:p></o:p></p><p class=MsoNormal \
style='margin-bottom:10.0pt;line-height:107%'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
Framed-Protocol = PPP,<o:p></o:p></p><p class=MsoNormal \
style='margin-bottom:10.0pt;line-height:107%'>&nbsp;&nbsp;&nbsp; \
&nbsp;&nbsp;&nbsp;&nbsp;Cisco-AVPair += &quot;ip:inacl#100=permit tcp any x.x.0.16 \
0.0.0.15 eq 25&quot;,<o:p></o:p></p><p class=MsoNormal \
style='margin-bottom:10.0pt;line-height:107%'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
Cisco-AVPair += &quot;ip:inacl#200=deny tcp any any eq 25&quot;,<o:p></o:p></p><p \
class=MsoNormal style='margin-bottom:10.0pt;line-height:107%'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
Cisco-AVPair += &quot;ip:inacl#300=permit ip any any&quot;,<o:p></o:p></p><p \
class=MsoNormal style='margin-bottom:10.0pt;line-height:107%'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
Fall-Through = No<o:p></o:p></p><p class=MsoNormal \
style='margin-bottom:10.0pt;line-height:107%'>Any help is \
apprecaited.<o:p></o:p></p><p class=MsoNormal \
style='margin-bottom:10.0pt;line-height:107%'>Thanks,<o:p></o:p></p><p \
class=MsoNormal style='margin-bottom:10.0pt;line-height:107%'><o:p>&nbsp;</o:p></p><p \
class=MsoNormal style='margin-bottom:10.0pt;line-height:107%'>Chris<o:p></o:p></p><p \
class=MsoNormal><o:p>&nbsp;</o:p></p></div></body></html>



-
List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html
--===============8777642959304031341==--

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic