FreeRADIUS modules python vs python3

Jonathan Davis jonathan at prioritycolo.com
Tue Nov 23 23:10:51 CET 2021


I am looking to better understand the python modules under FreeRADIUS. 
My initial assumption was rlm_python was for 2.7.x and rlm_python3 was 
for 3.x. However I am confused about the information at 
https://freeradius.org/modules/

- rlm_python3 is listed as obsolete with the view documentation link 
taking you to 
https://networkradius.com/doc/current/raddb/mods-available/home.html 
where there is neither python or python3
- rlm_python is listed as not obsolete, with "Allows the server to call 
a persistent, embedded Python script."

Installed FreeRADIUS 3.0.25 from the networkRADIUS packages at 
https://networkradius.com/packages/

In the FreeRADIUS dir, I see there is both python and python3 under 
mods-available, and under mods-config only a python dir

Was rlm_python3 made obsolete as 2.7 was EOL back in Jan of 2020 and 
everything is now simply under rlm_python?

Looking at the latest examples on 
https://github.com/FreeRADIUS/freeradius-server/blob/master/src/modules/rlm_python 
I see both example.py and  prepaid.py look to be executed as python3, 
both have #! /usr/bin/env python3 in their headers:

Create the symlink in mods-enabled/python to mods-available/python and 
try with the example provided, which works, then I switch it over to my 
own script, start radiusd -Xx and get the following error:

Tue Nov 23 16:02:41 2021 : Info: Python version: 2.7.18 (default, Oct 11 2021, 11:39:27)  [GCC 8.5.0 20210514 (Red Hat 8.5.0-3)]a
Tue Nov 23 16:02:41 2021 : Error: python_function_load - Module 'dr_yubikey' not found
Tue Nov 23 16:02:41 2021 : Error: <type 'exceptions.ImportError'> (No module named requests)
Tue Nov 23 16:02:41 2021 : Error: [0] /etc/raddb/mods-config/python/dr_yubikey.py:13 at <module>()
Tue Nov 23 16:02:41 2021 : Error: python_function_load - Failed to import python function 'dr_yubikey.authorize'
Tue Nov 23 16:02:41 2021 : Error: /etc/raddb/mods-enabled/python[9]: Instantiation failed for module "python"

I'm aware the above is failing because requests can't be imported, but 
request is installed under python3, and that first info line is not 
python3, but Python 2.7.18 ?

python2 pip install requests does get me to Tue Nov 23 16:19:55 2021 : 
Info: Ready to process requests when starting debug.


Trying with python3 symlinked in mods-enabled, and creating 
mods-config/python3 and dropping my .py in there:

Tue Nov 23 17:02:11 2021 : Error: /etc/raddb/mods-enabled/python3[9]: Failed to link to module 'rlm_python3': /usr/lib64/freeradius/rlm_python3.so: cannot open shared object file: No such file or directory

Which is true, there is no rlm_python3.so that exists under 
/usr/lib64/freeradius/

Are my assumptions wildly incorrect or am I missing something super obvious?



Thank you,
  Jonathan


More information about the Freeradius-Users mailing list