LUA Redis Integration

Gabriel Marais gabriel.j.marais at gmail.com
Wed Nov 20 06:00:34 UTC 2024


Good morning,

I was wondering if anyone has successfully integrated LUA with Redis
in freeRADIUS.
I am trying to build in a LUA function in
/etc/freeradius/mods-enabled/redis that calls for a result from a
redis db but I get a syntax error in my LUA {} code :-
/etc/freeradius/mods-enabled/redis[108]: Expecting section start brace
'{' after "local imei"

This is my code block:-

    lua {
       function imei_locking {
           local imei = redis.call('HGET',KEYS[1],'imei')
           local result = 'false'
           if imei == ARGV[1] then
               result = 'true'
           end
           return result
      }
   }

The idea is to reject connections based on the result returned from
the LUA call in the authorize {} section.

Hope I'm making sense. If anyone can share their ideas, I'd appreciate it.

Regards, Gabriel


More information about the Freeradius-Users mailing list