rlm_python example?

Hristo Trendev dist.lists at gmail.com
Tue Mar 31 14:43:15 CEST 2009


I am trying to figure out how to properly setup freeradius with
rlm_python. The module loads and scripts execute, but I seem to miss
something when I try to return value pairs to be used in the reply
packet (Access-Accept). I have tried with the following  script:

def authorize (params):
        print params
        return (0, ('Reply-Message', 'banned1'), ('Reply-Message', 'banned2'))

and received (when I run with -X option):
-----snip-----
+- entering group authorize {...}
rlm_python:authorize: tuple element 0 is not a tuple
rlm_python:authorize: tuple element 1 is not a tuple
rlm_python:authorize: tuple element 0 is not a tuple
rlm_python:authorize: tuple element 1 is not a tuple
++[python] returns reject
-----snip-----


I have also tried changing it to:
def authorize (params):
        print params
        return (0, ('Reply-Message', 'banned'))

but then I get:
-----snip-----
+- entering group authorize {...}
rlm_python:authorize: tuple must be (return, replyTuple, configTuple)
++[python] returns ??
-----snip-----

Can someone point me in the right direction? What is supposed to be
passed in configTuple? How do I return multiple value pairs at? I was
able to make it work with rlm_exec, but I'd like to use the the python
module instead.

I am using freeradius on ubuntu 8.04. installed via apt-get from
hardy-backports (2.1.0+dfsg-0ubuntu2~hardy1)

BR,
Hristo



More information about the Freeradius-Users mailing list