rlm_python example?

Mike O'Connor freeradius at pineview.net
Wed Apr 1 14:10:50 CEST 2009


Hi Hristo

Could you supply a quick example ?

Its always good to get working example after a problem is resolved (even
if the person is resolved by the questioner)

Mike


Hristo Trendev wrote:
> The examples in src/modules/rlm_python gave me some hints and I
> figured it out. Thanks anyway.
>
> On Tue, Mar 31, 2009 at 3:43 PM, Hristo Trendev <dist.lists at gmail.com> wrote:
>   
>> 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
>>
>>     
>
> -
> List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html
>   




More information about the Freeradius-Users mailing list