Search code examples
freeradius

Failed to link to module 'rlm_python': rlm_python.so


I was trying to create a python authentication for freeradius 3.0.8. I followed this example. But when I'm trying to start freeradius in debug mode using command radiusd -X It shows following error.

/usr/local/etc/raddb/mods-enabled/python[9]: Failed to link to module 'rlm_python': rlm_python.so: cannot open shared object file: No such file or directory

I looked /usr/local/lib/ folder and found that rlm_python module is not there. How can I add that module? My python module inside /raddb/mods-available/ is as follows.

  python {
  module = example

  mod_authorize = ${.module}
  func_authorize = authorize
}

Appreciate any help.


Solution

  • rlm_python isn't always packaged depending on the distribution.

    Basic build instructions can be found here: http://wiki.freeradius.org/building/Home

    You will also need to have installed the python-dev/python-devel package on your system. If python still doesn't work you may need to specify the path to the python binary manually by passing it to configure e.g. ./configure --with-rlm-python-bin=/usr/bin/python2.7.

    If you just wan to verify the configure scripts have picked up python cd src/modules/rlm_python; ./configure

    On my system (macOS 10.11.6) the output when python is found is:

    checking for gcc... /usr/local/opt/llvm/bin/clang
    checking whether the C compiler works... yes
    checking for C compiler default output file name... a.out
    checking for suffix of executables... 
    checking whether we are cross compiling... no
    checking for suffix of object files... o
    checking whether we are using the GNU C compiler... yes
    checking whether /usr/local/opt/llvm/bin/clang accepts -g... yes
    checking for /usr/local/opt/llvm/bin/clang option to accept ISO C89... none needed
    checking how to run the C preprocessor... /usr/local/opt/llvm/bin/clang -E
    checking for python2.7... python2.7
    configure: Python sys.prefix "/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7"
    configure: Python sys.exec_prefix "/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7"
    configure: Python sys.version "2.7"
    configure: Python local_mod_libs ""
    configure: Python base_mod_libs ""
    configure: Python other_libs "-u _PyMac_Error $(PYTHONFRAMEWORKINSTALLDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK) -ldl -framework CoreFoundation"
    checking for Python.h in /usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/include/python2.7/... yes
    checking for Py_Initialize in -lpython2.7 in /usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/config... yes
    configure: creating ./config.status
    config.status: creating all.mk
    

    Once the configure script find the python binary, it'll generally all "just work", as it can then get compilation and linking flags from python itself.