无法 link 到模块 'rlm_python':rlm_python.so

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

我正在尝试为 freeradius 3.0.8 创建 python 身份验证。我关注了this example。但是当我尝试使用命令 radiusd -X 在调试模式下启动 freeradius 时,它显示以下错误。

/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

我查看了 /usr/local/lib/ 文件夹,发现 rlm_python 模块不存在。我怎样才能添加那个模块?我的 python 里面的模块 /raddb/mods-available/ 如下。

  python {
  module = example

  mod_authorize = ${.module}
  func_authorize = authorize
}

感谢任何帮助。

rlm_python 并不总是打包,具体取决于发行版。

可在此处找到基本构建说明:http://wiki.freeradius.org/building/Home

您还需要在您的系统上安装 python-dev/python-devel 软件包。如果 python 仍然不起作用,您可能需要通过将其传递给配置来手动指定 python 二进制文件的路径,例如./configure --with-rlm-python-bin=/usr/bin/python2.7.

如果您只是想验证配置脚本是否已启动 python cd src/modules/rlm_python; ./configure

在我的系统 (macOS 10.11.6) 上,找到 python 时的输出是:

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

一旦配置脚本找到 python 二进制文件,它通常都是 "just work",因为它可以从 python 本身获取编译和链接标志。