Can't figure out Group Authentication

Julson, Jim jjulson at MARKETRON.COM
Sat Jun 23 17:24:30 CEST 2012


Okay, so I think I'm getting closer.  But I have a few challenges still.  I am slowly learning how to parse the RADIUS -X debug output, now it's a matter of knowing what to do with the information.

I know that when I've setup Cacti servers or other Linux based servers that bind to LDAP, I've had problems with 2 different facets of the implementation.

1.  Domain Groups with spaces sometimes would or wouldn't work.  (Is that the case with FreeRADIUS?)
2.  Recursive searches were a problem.  See below for how the basic Active Directory structure looks for us (Note the spaces in the names).  For Cacti, I had to create a new OU, with a new Security Group that didn't have spaces in it.  That was the only way I could get LDAP Binds to work for Group Authentication.  (I find it hard to belive that's the case with FreeRADIUS...I tend to lean more towards my bad configuration).

DOMAIN.EXAMPLE.COM
        ADMIN - Users
        ADMIN - Groups
        ADMIN - Servers
        Computers
        Users
        Domain Controllers
        Built-In
        Etc..

So, in that example, if I wanted to have a user be Authenticated who resides in "ADMIN - Users", but the group is in "ADMIN - Groups", does it matter to the RADIUS LDAP module?


Now,  in /etc/raddb/modules/ldap , we would have the binding setup as follows.  Note that the Base DN is the top level of the domain because it has to be able to recursively search all sub-OU's to find both users, and groups.

**************************************
/etc/raddb/modules/ldap

        server = "172.16.5.200"
        identity = "CN=Administrator,CN=Users,DC=DOMAIN,DC=EXAMPLE,DC=COM"
        password = MyPasswordForBIND
        basedn = "DC=DOMAIN,DC=EXAMPLE,DC=COM"
        filter = "(&(sAMAccountName=%{Stripped-User-Name:-%{User-Name}}))"
        #filter = "(uid=%{%{Stripped-User-Name}:-%{User-Name}})"
        #base_filter = "(objectclass=radiusprofile)"

        groupname_attribute = cn
        groupmembership_filter = "(|(&(objectClass=group)(member=%Ldap-UserDn}))(&(objectClass=top)(uniquemember=%{Ldap-UserDn})))"
        groupmembership_attribute = memberOf

**************************************


NOTE:  I am kind of lost here.  I see so many people using so many different syntaxes that I'm not sure if I'm using the right one.  At present, the "users" file is completely default except for the following lines I've added at the very top.   So, no matter what my LDAP output shows, If I uncomment the two lines for ntlm_auth, I can login with any Domain User regardless of the top 2 lines that say "Domain Admins", and all others are rejected.  So I'm thinking ultimately my problem is not just here, but also with the LDAP bind taking place as you can see below.
**************************************
/etc/raddb/users

DEFAULT Ldap-Group == "CN=Domain Admins,CN=ADMIN - Groups,DC=DOMAIN,DC=HOME,DC=COM", Auth-Type = ntlm_auth
DEFAULT Auth-Type = Reject

#DEFAULT        Auth-Type = ntlm_auth
#               Reply-Message = "You have been successfully authenticated! "
**************************************



Here's the checklist of what I've done.

1.       Added an entry simply as "ldap" under the "Instantiate" section in /etc/raddb/radiusd.conf
2.      Added the LDAP information as shown above in /etc/raddb/modules/ldap
3.      Configured ntlm_auth under /etc/raddb/modules/ntlm_auth
4.      Configured the mschap module under /etc/raddb/modules/mschap
5.      Added a list of clients who can authenticate in /etc/raddb/clients.conf
6.      Added an entry to check against LDAP groups in /etc/raddb/users (I believe this is still a problem for me.  I don't think I have it configured properly.  I think I need to visually see an example as it's just not "clicking" with me for some reason.



Here's the RADIUSD -X output from my last auth attempt.

BEGIN RADIUS - X DEBUG OUTPUT
NOTE:  I've changed all my domain information for this troubleshooting, and also highlighted anywhere it's referenced.  I'm hoping I'm
On the right track with what I've highlighted below as to where I believe the problem is.
#######################################################################################################
#######################################################################################################
#######################################################################################################
#######################################################################################################

rad_recv: Access-Request packet from host 10.10.0.5 port 1645, id=72, length=73
        User-Name = "USERNAMEHERE"
        User-Password = "PASSWORDOMMITTED"
        NAS-Port = 389
        NAS-Port-Id = "tty389"
        NAS-Port-Type = Virtual
        NAS-IP-Address = 10.10.0.5
# Executing section authorize from file /etc/raddb/sites-enabled/default
+- entering group authorize {...}
++[preprocess] returns ok
++[chap] returns noop
++[mschap] returns noop
++[digest] returns noop
[suffix] No '@' in User-Name = "USERNAMEHERE", looking up realm NULL
[suffix] No such realm "NULL"
++[suffix] returns noop
[eap] No EAP-Message, not doing EAP
++[eap] returns noop
  [ldap] Entering ldap_groupcmp()
[files]         expand: DC=domain,DC=example,DC=com -> DC=domain,DC=example,DC=com
[files] WARNING: Deprecated conditional expansion ":-".  See "man unlang" for details
[files]         ... expanding second conditional
[files]         expand: %{User-Name} -> USERNAMEHERE
[files]         expand: (&(sAMAccountName=%{Stripped-User-Name:-%{User-Name}})) -> (&(sAMAccountName=USERNAMEHERE))
  [ldap] ldap_get_conn: Checking Id: 0
  [ldap] ldap_get_conn: Got Id: 0
  [ldap] attempting LDAP reconnection
  [ldap] (re)connect to 172.16.5.200:389, authentication 0
  [ldap] bind as CN=Administrator,CN=Users,DC=domain,DC=example,DC=com/ADMINPASSHERE to 172.16.5.200:389
  [ldap] waiting for bind result ...
  [ldap] Bind was successful
  [ldap] performing search in DC=domain,DC=example,DC=com, with filter (&(sAMAccountName=USERNAMEHERE))
  [ldap] rebind to URL ldap://DomainDnsZones.domain.example.com/DC=DomainDnsZones,DC=domain,DC=example,DC=com
  [ldap] rebind to URL ldap://ForestDnsZones.domain.example.com/DC=ForestDnsZones,DC=domain,DC=example,DC=com
  [ldap] rebind to URL ldap://domain.example.com/CN=Configuration,DC=domain,DC=example,DC=com
  [ldap] ldap_release_conn: Release Id: 0
[files]         expand: (|(&(objectClass=group)(member=%Ldap-UserDn}))(&(objectClass=top)(uniquemember=%{Ldap-UserDn}))) -> (|(&(objectClass=group)(member=/var/log/radiusdap-UserDn}))(&(objectClass=top)(uniquemember=)))
  [ldap] ldap_get_conn: Checking Id: 0
  [ldap] ldap_get_conn: Got Id: 0
  [ldap] performing search in CN=Domain Admins,CN=Users,DC=example,DC=domain,DC=com, with filter (|(&(objectClass=group)(member=/var/log/radiusdap-UserDn}))(&(objectClass=top)(uniquemember=)))
  [ldap] object not found
  [ldap] ldap_release_conn: Release Id: 0
  [ldap] ldap_get_conn: Checking Id: 0
  [ldap] ldap_get_conn: Got Id: 0
  [ldap] performing search in CN=USER HERE,OU=Admin-Sec_Groups,DC=example,DC=domain,DC=com, with filter (objectclass=*)
  [ldap] performing search in CN=SSHADMINS,OU=Security Groups,OU=ADMIN - Groups, DC=example,DC=domain,DC=com, with filter (cn=CN=Domain Admins,CN=Users,DC=example,DC=domain,DC=com)
  [ldap] object not found
  [ldap] performing search in CN=VPN Users,OU=Security Groups,OU=ADMIN - Groups, DC=example,DC=domain,DC=com, with filter (cn=CN=Domain Admins,CN=Users,DC=example,DC=domain,DC=com)
  [ldap] object not found
  [ldap] performing search in CN=Cacti_Users,OU=Admin-Sec_Groups,DC=example,DC=domain,DC=com, with filter (cn=CN=Domain Admins,CN=Users,DC=example,DC=domain,DC=com)
  [ldap] object not found
  [ldap] performing search in CN=HSP Admins,OU=ASP Security Groups,DC=example,DC=domain,DC=com, with filter (cn=CN=Domain Admins,CN=Users,DC=example,DC=domain,DC=com)
  [ldap] object not found
  [ldap] performing search in CN=LoginWeb,CN=Users,DC=example,DC=domain,DC=com, with filter (cn=CN=Domain Admins,CN=Users,DC=example,DC=domain,DC=com)
  [ldap] object not found
  [ldap] performing search in CN=SSO,OU=ASP Security Groups,DC=example,DC=domain,DC=com, with filter (cn=CN=Domain Admins,CN=Users,DC=example,DC=domain,DC=com)
  [ldap] object not found
  [ldap] performing search in CN=Schema Admins,CN=Users,DC=example,DC=domain,DC=com, with filter (cn=CN=Domain Admins,CN=Users,DC=example,DC=domain,DC=com)
  [ldap] object not found
  [ldap] performing search in CN=Enterprise Admins,CN=Users,DC=example,DC=domain,DC=com, with filter (cn=CN=Domain Admins,CN=Users,DC=example,DC=domain,DC=com)
  [ldap] object not found
  [ldap] performing search in CN=Domain Users,CN=Users,DC=example,DC=domain,DC=com, with filter (cn=CN=Domain Admins,CN=Users,DC=example,DC=domain,DC=com)
  [ldap] object not found

##########################################################################################
Now this just isn't true...Below, highlighted in green it says the username is authorized for remote access...

rlm_ldap::groupcmp: Group CN=Domain Admins,CN=Users, DC=example,DC=domain,DC=com not found or user not a member
##########################################################################################



  [ldap] ldap_release_conn: Release Id: 0
++[files] returns noop
[ldap] performing user authorization for USERNAMEHERE
[ldap] WARNING: Deprecated conditional expansion ":-".  See "man unlang" for details
[ldap]  ... expanding second conditional
[ldap]  expand: %{User-Name} -> USERNAMEHERE
[ldap]  expand: (&(sAMAccountName=%{Stripped-User-Name:-%{User-Name}})) -> (&(sAMAccountName=USERNAMEHERE))
[ldap]  expand: DC=example,DC=domain,DC=com -> DC=example,DC=domain,DC=com
  [ldap] ldap_get_conn: Checking Id: 0
  [ldap] ldap_get_conn: Got Id: 0
  [ldap] performing search in DC=example,DC=domain,DC=com, with filter (&(sAMAccountName=USERNAMEHERE))
  [ldap] rebind to URL ldap://DomainDnsZones.domain.example.com/DC=DomainDnsZones,DC=example,DC=domain,DC=com
  [ldap] rebind to URL ldap://ForestDnsZones.domain.example.com/DC=ForestDnsZones,DC=example,DC=domain,DC=com
  [ldap] rebind to URL ldap://domain.example.com/CN=Configuration,DC=example,DC=domain,DC=com
[ldap] looking for check items in directory...
[ldap] looking for reply items in directory...
WARNING: No "known good" password was found in LDAP.  Are you sure that the user is configured correctly?
[ldap] user USERNAMEHERE authorized to use remote access
  [ldap] ldap_release_conn: Release Id: 0
++[ldap] returns ok
++[expiration] returns noop
++[logintime] returns noop
[pap] WARNING! No "known good" password found for the user.  Authentication may fail because of this.
++[pap] returns noop

###################################################################

Is this what the actual problem is?  Looks like it to me.  I thought I addressed this with the line I put in /etc/raddb/users stating that the Auth-Type = ntlm_auth was good for Ldap-Group "Domain Admins"  Is my syntax wrong?

ERROR: No authenticate method (Auth-Type) found for the request: Rejecting the user
Failed to authenticate the user.
Using Post-Auth-Type Reject
# Executing group from file /etc/raddb/sites-enabled/default
+- entering group REJECT {...}
####################################################################

[attr_filter.access_reject]     expand: %{User-Name} ->USERNAMEHERE
 attr_filter: Matched entry DEFAULT at line 11
++[attr_filter.access_reject] returns updated
Sending Access-Reject of id 72 to 10.10.0.5 port 1645
Finished request 0.
Going to the next request
Waking up in 4.9 seconds.
Cleaning up request 0 ID 72 with timestamp +10
Ready to process requests.

#######################################################################################################
#######################################################################################################
#######################################################################################################
#######################################################################################################
END OF RADIUSD -X DEBUG OUTPUT





-----Original Message-----
From: freeradius-users-bounces+jjulson=marketron.com at lists.freeradius.org [mailto:freeradius-users-bounces+jjulson=marketron.com at lists.freeradius.org] On Behalf Of Julson, Jim
Sent: Saturday, June 23, 2012 7:44 AM
To: FreeRadius users mailing list
Subject: RE: Can't figure out Group Authentication

Alan,

That was about the most clear and concise description of the process I've found/heard to date.  Thank you for taking the time to educate me.  I will attempt to get this going today.  I think I have everything that I need at this point.

Have a good one.

-----Original Message-----
From: freeradius-users-bounces+jjulson=marketron.com at lists.freeradius.org<mailto:freeradius-users-bounces+jjulson=marketron.com at lists.freeradius.org> [mailto:freeradius-users-bounces+jjulson=marketron.com at lists.freeradius.org]<mailto:[mailto:freeradius-users-bounces+jjulson=marketron.com at lists.freeradius.org]> On Behalf Of Alan DeKok
Sent: Saturday, June 23, 2012 6:22 AM
To: FreeRadius users mailing list
Subject: Re: Can't figure out Group Authentication

Julson, Jim wrote:
> Now, I then setup my Cisco router accordingly, and then did an SSH
> test to it using my AD Account.  Voila!  It worked great.  _*/However,
> so did every other "Domain User" account in the environment.  /*_ This
> goes back to me being so new to RADIUS and Linux where I don't feel
> like I'm fully grasping all of the directives within the configuration
> files, and exactly how they all tie together.

  Honestly, I don't remember much of that, either.  When I configure the server, I usually go back and read the comments *I wrote* to figure out what to do.

  But for your issue, you told the server to "use AD to authenticate all users".  So that's what it did.

> *So, how do I lock down the SSH Authentication to an Active Directory
> Group of users, or individual users? * Remember, go easy on me.  I'll
> provide whatever you need to help.  I'm assuming you will ask for my
> RADIUSD -X output, so I've attached that as well.

1) configure AD as an LDAP server.  See raddb/modules/ldap

2) add "ldap" to the "instantiate" section of radiusd.conf
   There are references to "ldap" in "authorize" and "authentication"
   You won't need those.

3) Do group checking with LDAP-Group == "group name"

  See the FAQ for examples of rejecting users with a particular group.
The FAQ uses "Group", which is "Unix group from /etc/passwd".  Just use LDAP-Group instead.

> NOTE:  One thing I don't understand is how in Alan DeKok's write up from
> the link above, he says don't use the "DEFAULT    Auth-Type = ntlm_auth"
> in the "/etc/raddb/users" file, but yet that's one of the final steps
> to test in the write-up.

  It's an intermediate step.  It's necessary only when you're forcing authentication back-ends.

>  Maybe it's because I am so new, but I've been through that document
> probably 30 times line by line, and yet every time I remove that
> entry, it breaks the Authentication.

  Yes.  The server needs to now HOW to authenticate the users.  The incoming RADIUS packet contains what KIND of authentication method.
PAP, CHAP, MS-CHAP, etc.  So the server has no choice there.

  But where does it get the passwords from?  Normally this is a DB.  But AD isn't a DB (for various reasons).  Instead, the "Auth-Type = ntlm_auth" reformats and *proxies* the authentication over the Samba protocol, using the ntlm_auth program.

  i.e. it hands off the MSCHAP stuff to ntlm_auth, and asks "is this correct?"

  If the server has passwords from a DB, it can just authenticate the user directly.  If it doesn't have a password for that user, it has to hand off the authentication to someone else.

  Alan DeKok.
-
List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html
The information contained in this e-mail message may be confidential and protected from disclosure.  If you are not the intended recipient, any dissemination, distribution or copying is strictly prohibited. If you think that you have received this e-mail message in error, please notify the sender immediately by replying to this message and then delete it from your system.

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


The information contained in this e-mail message may be confidential and
protected from disclosure.  If you are not the intended recipient, any
dissemination, distribution or copying is strictly prohibited. If you
think that you have received this e-mail message in error, please notify
the sender immediately by replying to this message and then delete it
from your system.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freeradius.org/pipermail/freeradius-users/attachments/20120623/22063e4b/attachment-0001.html>


More information about the Freeradius-Users mailing list