Multiple authorize methods with python module

Alan DeKok aland at deployingradius.com
Fri Dec 8 03:53:53 CET 2017


On Dec 7, 2017, at 7:46 PM, Gary Gwin <garygwin at gmail.com> wrote:
> 
> If I reference the same python module from mypython1 and mypython2
> 
> python mypython1 {
>        module = example
>        ...
> }
> 
> python mypython2 {
>        module = example
>        ...
> }
> 
> Then FreeRADIUS initializes and functions properly.

  Due to limitation in the Python interpreter, FreeRADIUS *cannot* instantiate multiple independent Python interpreters.

  Any module you load has to be from one global Python module space / namespace.

> However, if I use a
> different module for each, and in this test case a copy of same tested and
> functioning python program with a different name:
> 
> python mypython1 {
>        module = example
>        ...
> }
> 
> python mypython2 {
>        module = example2
>        ...
> }
> 
> I get the following error initializing:
> 
> # Instantiating module "mypython2" from file
> /etc/freeradius/3.0/mods-enabled/mypython2
> python_function_load - Module 'example2' not found
> <type 'exceptions.SystemError'> (null argument to internal routine)
> python_function_load - Failed to import python function 'example2.authorize'
> /etc/freeradius/3.0/mods-enabled/mypython2[2]: Instantiation failed for
> module "mypython2"

  You should be able to load completely different Python modules, but they will both largely be running in the same interpreter.

  i.e. if you can't load the same module twice in Python, you can't load it twice in FreeRADIUS.

  Alan DeKok.




More information about the Freeradius-Users mailing list