Need example mod_python

A.L.M.Buxey at lboro.ac.uk A.L.M.Buxey at lboro.ac.uk
Fri Jun 15 18:06:40 CEST 2007


Hi,
> Hello,
> 
> as I have mentioned before in one of my e-mails, is there anyone who can provide me a practical example of the python module?

google?

take the default docs and a few queries and you can do eg

        python {
                mod_instantiate = radiusd_test
                func_instantiate = instantiate

                mod_authorize = radiusd_test
                func_authorize = authorize

                mod_accounting = radiusd_test
                func_accounting = accounting

                mod_preacct = radiusd_test
                func_preacct = preacct

                mod_detach = radiusd_test
                func_detach = detach

        }

where each of these is a pointer to some python code....eg  radiusd_test.py

in radiusd_test.py you define each of the methods ... 

def preacct(params):
    print params

def authorize(params):
    print params
    return (5, ('Reply-Message', 'banned'))

def accounting(params):
    print params

The RADIUS value-pairs are passed as a 
tuple of tuple pairs as the first argument, e.g. (('attribute1', 'value1'), ('attribute2', 'value2'))

i was tempted at one point but our skillset here is more PERL weighted

alan




More information about the Freeradius-Users mailing list