Re: inactive users can authenticate

2013-06-28 Thread Phil Mayers

On 28/06/13 17:31, Mathieu Simon wrote:


The result was same when using radtest with "-t mschap" if that's what
you're pointing out.


Interesting. I would not have expected that.
-
List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html


Re: inactive users can authenticate

2013-06-28 Thread Mathieu Simon
G'day all

I've taken out a configuration from a earlier prototype that I used with
Samba/Winbind authentication but didn't use the rlm_ldap for authorization
back then.  (Having some archives can be quite useful sometimes...) ;-)

Since ntlm_auth properly leads to Access-Rejects for disabled users I can
ignore
how good or how bad rlm_ldap behaves for disabled users as long as it
properly
checks for group memberships (that's what I'm interested in for LDAP checks)

And even if Arran points out the brokenness of rlm_ldap code in FR 2.x,
group-checks based
on rlm_ldap are working as expected - and thats what I'm required to get
working with this Setup.

Regarding...
> Since your testing auth request was PAP, mschap will never be
> called for this, so you're stuck basically.
The result was same when using radtest with "-t mschap" if that's what
you're pointing out.

I guess for the current time I'm going to stay with an ADS-joined Samba and
use LDAP
only for the authorization part. Summing up, I feel ending up with less
components taming
overall complexiness a bit.

Thank you guys for your Inputs!

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

Re: inactive users can authenticate

2013-06-28 Thread Phil Mayers

On 28/06/13 14:03, Arran Cudbard-Bell wrote:


On 28 Jun 2013, at 11:50, Phil Mayers 
wrote:


On 28/06/13 08:14, Mathieu Simon wrote:


Second, I can't remember if mschap checks the acct control
flags in "authorize" or "authenticate". If the latter you'll
need to move away from using LDAP bind for auth

Hmm, I guess that would require me studying the code :-\


I've just taken a look - sure enough, rlm_mschap only
checks/enforces the SMB-Account-CTRL attribute during "authenticate
{}".

Since your testing auth request was PAP, mschap will never be
called for this, so you're stuck basically.


Seeing as it's a string value, can't he just pull it out of the
directory using the attribute map and check it with a regex?


Sorry, yes. "stuck" is not correct. I meant "can't use the mschap module 
for this".


Numerous other solutions exist, and regexp is probably the easiest.
-
List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html


Re: inactive users can authenticate

2013-06-28 Thread Arran Cudbard-Bell

On 28 Jun 2013, at 11:50, Phil Mayers  wrote:

> On 28/06/13 08:14, Mathieu Simon wrote:
> 
>>> Second, I can't remember if mschap checks the acct control flags in 
>>> "authorize"
>>> or "authenticate". If the latter you'll need to move away from using LDAP 
>>> bind for auth
>> Hmm, I guess that would require me studying the code :-\
> 
> I've just taken a look - sure enough, rlm_mschap only checks/enforces the 
> SMB-Account-CTRL attribute during "authenticate {}".
> 
> Since your testing auth request was PAP, mschap will never be called for 
> this, so you're stuck basically.

Seeing as it's a string value, can't he just pull it out of the directory using 
the attribute map and check it with a regex?

Or is it more complicated than that?

-Arran

Arran Cudbard-Bell 
FreeRADIUS Development Team

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


Re: inactive users can authenticate

2013-06-28 Thread Phil Mayers

On 28/06/13 08:14, Mathieu Simon wrote:


Second, I can't remember if mschap checks the acct control flags in "authorize"
or "authenticate". If the latter you'll need to move away from using LDAP bind 
for auth

Hmm, I guess that would require me studying the code :-\


I've just taken a look - sure enough, rlm_mschap only checks/enforces 
the SMB-Account-CTRL attribute during "authenticate {}".


Since your testing auth request was PAP, mschap will never be called for 
this, so you're stuck basically.

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


Re: inactive users can authenticate

2013-06-28 Thread Arran Cudbard-Bell

On 28 Jun 2013, at 10:45, Michael Rigoni 
 wrote:

> I had a quick look at the output you sent, and I see this:
>  base_filter = "(sambaAcctFlags=[U  ]"
> Seems like your are missing a closing bracket... but that should have 
> triggered an error, so I looked at rlm_ldap source, and it seems base filter 
> is only used for the "profile user" whatever that is... (seems to be an entry 
> in the directory that store extra checks to be made, but I never used that)
> 
> I would suggest you trying to set the filter to: 
> "(&(uid=%{mschap:User-Name:-%{User-Name}})(sambaAcctFlags=[U  ]))"  
> (or something like that, my LDAP is rusty), and leave the base_filter 
> commented.

Yep that'd be correct.

Why is called base_filter? Because platypus kittens.

The rlm_ldap module was completely rewritten for version 3. The old code was so 
bad, it had gotten to the point where it was impossible to maintain. Out of the 
50 odd modules which ship with the server, rlm_ldap was one of only two that 
got this treatment (the other one was rlm_krb5).

-Arran

Arran Cudbard-Bell 
FreeRADIUS Development Team

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


Re: inactive users can authenticate

2013-06-28 Thread Michael Rigoni
I had a quick look at the output you sent, and I see this:

>  base_filter = "*(*sambaAcctFlags=[U  ]"
>
Seems like your are missing a closing bracket... but that should have
triggered an error, so I looked at rlm_ldap source, and it seems base
filter is only used for the "profile user" whatever that is... (seems to be
an entry in the directory that store extra checks to be made, but I never
used that)

I would suggest you trying to set the filter to:
"(&(uid=%{mschap:User-Name:-%{User-Name}})(sambaAcctFlags=[U  ]))"
(or something like that, my LDAP is rusty), and leave the base_filter
commented.


I hope this helps,

Michael


On Fri, Jun 28, 2013 at 9:14 AM, Mathieu Simon wrote:

> G'day all, and thanks Phil for your hints
>
> (Arran I'd want to leave 3.0 as an option of last resort even though it's
> considered RC by now) ;-)
>
> > try moving mschap after LDAP in "authorise"
> Tried this one, no change unfortunately.
>
> >Second, I can't remember if mschap checks the acct control flags in
> "authorize"
> > or "authenticate". If the latter you'll need to move away from using
> LDAP bind for auth
> Hmm, I guess that would require me studying the code :-\
>
> Anyway, I'm not entirely sure if I'm going to stay with this setup of this
> Debian derivative since
> it uses its own AD to local OpenLDAP replication and It didn't entirely
> convince me
> (too many replications and components talking to each other)
>
> Best regards
> Mathieu
>
>
>
>
> 2013/6/26 Phil Mayers 
>
>> Couple of things:
>>
>> IIRC the account control flags are checked by the "mschap" module, which
>> I see is running before the LDAP lookup - try moving mschap after LDAP in
>> "authorise"
>>
>> Second, I can't remember if mschap checks the acct control flags in
>> "authorize" or "authenticate". If the latter you'll need to move away from
>> using LDAP bind for auth
>> --
>> Sent from my phone with, please excuse brevity and typos
>>
>
>
>
> --
> Mathieu Simon
> mathieu@gmail.com
>
> -
> List info/subscribe/unsubscribe? See
> http://www.freeradius.org/list/users.html
>
-
List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html

Re: inactive users can authenticate

2013-06-28 Thread Mathieu Simon
G'day all, and thanks Phil for your hints

(Arran I'd want to leave 3.0 as an option of last resort even though it's
considered RC by now) ;-)

> try moving mschap after LDAP in "authorise"
Tried this one, no change unfortunately.

>Second, I can't remember if mschap checks the acct control flags in
"authorize"
> or "authenticate". If the latter you'll need to move away from using LDAP
bind for auth
Hmm, I guess that would require me studying the code :-\

Anyway, I'm not entirely sure if I'm going to stay with this setup of this
Debian derivative since
it uses its own AD to local OpenLDAP replication and It didn't entirely
convince me
(too many replications and components talking to each other)

Best regards
Mathieu




2013/6/26 Phil Mayers 

> Couple of things:
>
> IIRC the account control flags are checked by the "mschap" module, which I
> see is running before the LDAP lookup - try moving mschap after LDAP in
> "authorise"
>
> Second, I can't remember if mschap checks the acct control flags in
> "authorize" or "authenticate". If the latter you'll need to move away from
> using LDAP bind for auth
> --
> Sent from my phone with, please excuse brevity and typos
>



-- 
Mathieu Simon
mathieu@gmail.com
-
List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html

Re: inactive users can authenticate

2013-06-26 Thread Phil Mayers
Couple of things:

IIRC the account control flags are checked by the "mschap" module, which I see 
is running before the LDAP lookup - try moving mschap after LDAP in "authorise"

Second, I can't remember if mschap checks the acct control flags in "authorize" 
or "authenticate". If the latter you'll need to move away from using LDAP bind 
for auth
-- 
Sent from my phone with, please excuse brevity and typos-
List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html

Re: inactive users can authenticate

2013-06-26 Thread Arran Cudbard-Bell

On 26 Jun 2013, at 16:49, Mathieu Simon  wrote:

> G'day all
> 
> I've been working with Mihailo on this matter although he's been more into it
> I try to provide the data you ask for:
> 
> Prelude:
> A Samba-disabled user has the following sambaAcctFlags in the LDAP Directory 
> during an ldapsearch i.e.:
> The user kw978 used for this is a disabled user and thus ldapsearch lists: 
> sambaAcctFlags: [UD ]
> A not-disabled user would  have: sambaAcctFlags: [U  ]
> 
> The radtest command used was:
> radtest -x kw978 TestRadius1234$ localhost 10 testing123
> 
> Now what follows is the output of 'freeradius -X' with the authentication 
> test.
> Using '-t mschap' doesn't change anything so I guess testing with PAP is 
> (yet?) ok.
> 
> I hope that help shedding some light - as you can see base_filter is read 
> while starting the daemon, 
> but no matter what is set in base_filter, even invalid stuff, it's simply 
> going to get ignored.
> 
> The server does LDAP group matching with if-else unlang statements - removing 
> them
> didnt change the behaviour so I don't think they're the cause.

Weird. Well if no one on the list can spot an obvious issue it's probably worth 
upgrading to 3.0.0 and using the module there. It's much better.

else, have you tried the same query with something like ldapsearch?

Arran Cudbard-Bell 
FreeRADIUS Development Team

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


Re: inactive users can authenticate

2013-06-26 Thread Matt Zagrabelny
On Wed, Jun 26, 2013 at 9:27 AM, Alan DeKok  wrote:
> Mihajlo Joksimovic wrote:
>> i have an uptodate Debian derivate with samba4.
>> The base_filter rule in the modules/ldap file is not accepted. There i
>> gave sambaacctflags but nothing happens. still all users get accepted.
>> in Base_filter I can write what I want, it always like skips this point.
>> So everyone can login, also the disabled accounts.
>
>   If only there was a way to debug this.  That was documented in the
> "man" page.  Or the web pages.  Or daily on this list.

That's funny. :)

Because Alan makes us smile, I'll add:

radiusd -X

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


Re: inactive users can authenticate

2013-06-26 Thread Alan DeKok
Mihajlo Joksimovic wrote:
> i have an uptodate Debian derivate with samba4.
> The base_filter rule in the modules/ldap file is not accepted. There i
> gave sambaacctflags but nothing happens. still all users get accepted.
> in Base_filter I can write what I want, it always like skips this point.
> So everyone can login, also the disabled accounts.

  If only there was a way to debug this.  That was documented in the
"man" page.  Or the web pages.  Or daily on this list.

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