FreeRadius , can't load /import python external library
Edouard Etancelin
etancelin.edouard at gmail.com
Thu May 26 19:37:23 CEST 2016
Hi
Freeradius 3.0.11
Ubuntu 15:10
I am a freeradius newbie and i tring to import an external library into
(PyJWT) for a freeradius authorization, but when i run freeradius -X i get
this error message.
# Instantiating module "python" from file
/etc/freeradius/mods-enabled/python
mod_init done
rlm_python:mod_load_function: module 'example' is not found
rlm_python:EXCEPT:<type 'exceptions.ImportError'>: No module named jwt
rlm_python:mod_load_function: failed to import python function
'example.authorize'
/etc/freeradius/mods-enabled/python[10]: Instantiation failed for
module "python"
When i try to import the package from the terminal, everything is ok.
Python 2.7.10 (default, Oct 14 2015, 16:09:02)
[GCC 5.2.1 20151010] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import jwt
>>> encoded = jwt.encode({'some': 'payload'}, 'secret', algorithm='HS256')
>>> jwt.decode(encoded, 'secret', algorithms=['HS256'])
{u'some': u'payload'}
The python file is :
#! /usr/bin/env python
# ...
import radiusd
import jwt
def instantiate(p):
....
def authorize(p):
print "*** authorize ***"
but if instead i use :
#! /usr/bin/env python
# ...
import radiusd
#import jwt
def instantiate(p):
....
def authorize(p):
print "*** authorize ***"
,freeradius start as espected .
My dockerfile is :
>From ubuntu:15.10
#1;5C radiussrvbase docker image configuration file
# This docker configuration file use ubuntu 15:10 willy distrib and
install freeradius server 3.x.
RUN apt-get update \
&& apt-get install -y software-properties-common \
&& apt-get install -y python2.7-dev \
&& apt-get install -y python-pip \
&& pip install PyJWT \
&& add-apt-repository ppa:freeradius/stable-3.0 \
&& apt-get update \
&& apt-get install -y freeradius-mysql \
&& apt-get install -y freeradius=3.0.11-ppa2~wily
WORKDIR /etc/freeradius
#File import
Should i declare external python library in freeradius ?
Does i miss something ?
Best regards
More information about the Freeradius-Users
mailing list