Lookup lists / arrays?

Phil Mayers p.mayers at imperial.ac.uk
Wed Nov 2 14:02:29 CET 2016


On 02/11/16 12:40, David Hartburn wrote:

> Build a better database infrastructure is one solution, but I was
> wondering if there is a better way of doing this?

Better DB infra. *is* the better way in my opinion - for what it's 
worth, we run our radius servers with a local (same box) SQL read-only 
replica of the DB - but you can easily wrap this in a cache instance 
(which we *also* do):

cache staticip {
   key = "%{Calling-Station-Id}"
   update request {
     Tmp-Integer-0 := "%{sql:select count...}"
   }
}

...then in the policy:

post-auth {
    staticip
    if (Tmp-Integer-0 != 0) {
      update reply ...
    }
}

> Being such a small dataset, is it possible to maintain an array or list,
> then use a function to say something like 'if (%{Calling-Station-Id} is
> in list) {.....'?

You could store the list in a text file and read it with rlm_passwd, or 
a users file with rlm_files. We've got a couple of "outside-of-SQL" 
exceptions stored in things like that.

You can iterate over the list with foreach.


More information about the Freeradius-Users mailing list