Python Module
The python
module processes attributes through a Python interpreter.
-
Please see the
src/modules/rlm_python/example.py
sample. -
Please see https://www.python.org/doc/ for more information about the Python language.
Uncomment any func_* configuration items below which are
included in your module. If the module is called for a section which
does not have a function defined, it will return noop .
|
As of FreeRADIUS v4, the Python function names called when the python
module is called are automatically derived from the section in which
they are called.
|
e.g. if python
is called in recv Access-Request
, firstly a function
recv_access_request
will be looked for. If that does not exist, then
a function recv
will be looked for.
This can be overridden by setting func_recv_access_request
or func_recv
to point to a different function name.
Similarly, mod_recv_access_request
or mod_recv
can be used to
load the function from a module other than the one specified in the
module
option.
Please see the file global.d/python for server-global configuration items which control the Python path.
See |
Configuration Settings
The Python API threading.local()
may be used store thread
specific data such as connection handles.
- module
-
Module to load functions from.
|
- func_instantiate
-
Called on module instantiation.
- func_detach
-
Called on module unload.
- config { … }
-
You can define configuration items (and nested sub-sections) in python
config { … }
section. These items will be accessible in the Python script throughfreeradius.config
dict for instance:
e.g:
freeradius.config['name']
freeradius.config['sub-config']['name']