Different databases with single freeradius

Alan Buxey alan.buxey at gmail.com
Wed Feb 7 23:00:55 CET 2018


okay...this is quite easy

so, in the authorise section of the main server, you cre just calling


db1
db2

this means you are checking whether a user is in db1....if so
great...but then you are then falling through to db2 and checking
there okay

1) thats okay if theres unique users in each db...not so great if you
have a match in one and then a clash with same name in the other....
so you may want to
skip db2 if db1 gives an answer

HOWEVER, your problem is that you are then doing the same thing for
the post-auth and the detail log etc etc -

ie you are slapping details into db1....and THEN doing the same with db2

this is why info is going into both databases.

what you need to do is upon getting a value from db1 in the authorise
section, you need to set a local variable eg  create a local
dictionary value in dictionary-file eg
MYDATABASEANSWER and then set that value to 1 if the answer was from
db1, or set it to 2 if the answer was from db2

THEN you wrap a protector around your detail/log/post-auth clauses eg

if(&MYDATABASEANSWER=1) {
db1
}
if(&MYDATABASEANSWER=2){
db2
}

(you could use an if/else construct instead....its up to you and how
many databases you are going to end up with)


read the unlang man page for further info on server logic.

http://freeradius.org/radiusd/man/unlang.html

alan


More information about the Freeradius-Users mailing list