How to find if the LDAP server is not rechable
Hi, I've a setup with freeradius-server-2.2.3 and Windows AD 2008 [LDAP server]for authentication. I need to implement fall back feature where if Windows AD server is not reachable , I need to authenticate using local database. The problem I'm facing is : When LDAP server is reachable and giving wrong password result is RLM_MODULE_REJECT. LDAP server not reachable the result is RLM_MODULE_FAIL. But for both the case reply code will be PW_AUTHENTICATION_REJECT. So please guide me in how to differentiate LDAP server not reachability from error due to wrong credentials. Thanks, Adarsha
On Apr 14, 2015, at 7:10 AM, Adarsha S <s.adarsha@gmail.com> wrote:
I've a setup with freeradius-server-2.2.3 and Windows AD 2008 [LDAP server]for authentication. I need to implement fall back feature where if Windows AD server is not reachable , I need to authenticate using local database.
That's simple enough.
The problem I'm facing is : When LDAP server is reachable and giving wrong password result is RLM_MODULE_REJECT. LDAP server not reachable the result is RLM_MODULE_FAIL.
Yes... see "man unlang". You can check for different return codes from modules. You can also put the modules into a "redundant" block, where the second one is called only when the first one fails. e.g. redundant { ldap other_database } See "man unlang". Alan DeKok.
Thanks for the help Alan. But the other_database I'm holding is just a simple C-language hash table which is unknown to free radius process. So I've a logic where based on the result obtained from free-radius I'll have to proceed to query my local database which is a simple hashing table. If I get same response from free-radius for not reachability and wrong credentials , I wont be able to proceed to lookup local database because only when ldap server is not reachable I should proceed for local data base. So I need a logic where in free radius returns different error messages. Please guide me in the same. Thanks, Adarsha On Tue, Apr 14, 2015 at 5:33 PM, Alan DeKok <aland@deployingradius.com> wrote:
On Apr 14, 2015, at 7:10 AM, Adarsha S <s.adarsha@gmail.com> wrote:
I've a setup with freeradius-server-2.2.3 and Windows AD 2008 [LDAP server]for authentication. I need to implement fall back feature where if Windows AD server is not reachable , I need to authenticate using local database.
That's simple enough.
The problem I'm facing is : When LDAP server is reachable and giving wrong password result is RLM_MODULE_REJECT. LDAP server not reachable the result is RLM_MODULE_FAIL.
Yes... see "man unlang". You can check for different return codes from modules. You can also put the modules into a "redundant" block, where the second one is called only when the first one fails.
e.g.
redundant { ldap other_database }
See "man unlang".
Alan DeKok.
- List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html
On Tue, Apr 21, 2015 at 5:17 PM, Adarsha S <s.adarsha@gmail.com> wrote:
> Thanks for the help Alan.
> But the other_database I'm holding is just a simple C-language hash table
> which is unknown to free radius process.
>
> So I've a logic where based on the result obtained from free-radius I'll
> have to proceed to query my local database which is a simple hashing table.
> If I get same response from free-radius for not reachability and wrong
> credentials , I wont be able to proceed to lookup local database because
> only when ldap server is not reachable I should proceed for local data
> base.
>
> So I need a logic where in free radius returns different error messages.
> Please guide me in the same.
>
This is how we do it, we have Reply-Message going into syslog and do
something about it using our syslog monitor. We tell FR to not respond if
the local database is awol as the other redundant servers will respond:
ldap {
fail = 1
}
#If the record was found in ldap
if (ok) {
. do stuff..
}
#If the record was't found in ldap.
elsif (notfound) {
. do other stuff..
}
else {
#Otherwise something very wrong has happened.
update reply {
Reply-Message := "LDAP Server Error"
}
linelog
do_not_respond
}
Works for us.
>
> Thanks,
> Adarsha
>
> On Tue, Apr 14, 2015 at 5:33 PM, Alan DeKok <aland@deployingradius.com>
> wrote:
>
> > On Apr 14, 2015, at 7:10 AM, Adarsha S <s.adarsha@gmail.com> wrote:
> > > I've a setup with freeradius-server-2.2.3 and Windows AD 2008 [LDAP
> > > server]for authentication.
> > > I need to implement fall back feature where if Windows AD server is not
> > > reachable , I need to authenticate using local database.
> >
> > That's simple enough.
> >
> > > The problem I'm facing is :
> > > When LDAP server is reachable and giving wrong password result is
> > > RLM_MODULE_REJECT. LDAP server not reachable the result is
> > RLM_MODULE_FAIL.
> >
> > Yes... see "man unlang". You can check for different return codes from
> > modules. You can also put the modules into a "redundant" block, where
> the
> > second one is called only when the first one fails.
> >
> > e.g.
> >
> > redundant {
> > ldap
> > other_database
> > }
> >
> > See "man unlang".
> >
> > Alan DeKok.
> >
> >
> > -
> > List info/subscribe/unsubscribe? See
> > http://www.freeradius.org/list/users.html
> -
> List info/subscribe/unsubscribe? See
> http://www.freeradius.org/list/users.html
>
On Apr 21, 2015, at 1:17 AM, Adarsha S <s.adarsha@gmail.com> wrote:
But the other_database I'm holding is just a simple C-language hash table which is unknown to free radius process.
So... it's not a database, is it? And perhaps you could have said that at the start.
So I've a logic where based on the result obtained from free-radius I'll have to proceed to query my local database which is a simple hashing table.
Which isn't accessible to the FreeRADIUS process. So.. how are you going to make FreeRADIUS query it?
If I get same response from free-radius for not reachability and wrong credentials , I wont be able to proceed to lookup local database because only when ldap server is not reachable I should proceed for local data base.
That's what the redundant block does.
So I need a logic where in free radius returns different error messages. Please guide me in the same.
$ man unlang And read the debug output. Alan DeKok.
participants (3)
-
Adarsha S -
Alan DeKok -
Peter Lambrechtsen