This is the main look at the installation of Freeradius, as well as the example of Python expansion, there are billing fields to expand according to manufacturers.
Installation of version 3.0
Reference articles
yum install libtalloc-devel-c ftp://ftp.freeradius.org/pub/freeradius/freeradius-server-3.0.11.tar.gztar zxvf freeradius-server-3.0.11.tar.gzcd freeradius-server-3.0.11./configuremakemake installldconfig如果需要用mysql 和 python拓展 yum 安装下 python-devel, mysql-devel默认的安装位置 /usr/local/etc/raddb/
Open Python expansion
mods-available/python
connect the soft to the mods-enabled/python
Edit the Mods-enabled/python file, this is where the Python modules are configured at different stages, and I just need to get rid #func_authorize = authorize
of this line of comments
Specify the path to Pythonexport PYTHONPATH=‘/usr/local/etc/raddb/mods-config/python‘
Document Address
Because only the authenticated part is enabled, the default configuration is the example.py file, so this is the part to experiment with.
Print some operation information
def authorize(p): print"*** authorize ***" print ‘*** radlog call in authorize llllll***‘) print print p print sys.path print os.getcwd() ‘*** python part end ***‘) return radiusd.RLM_MODULE_OK
Custom reply
def authorize(p): Print "* * * * authorize" PrintRadiusd.radlog (RADIUSD. L_info,' * * * Radlog call in authorize llllll*** ')Print PrintP reply = ((' Reply-message ',': = ',' Hello from Rlm_python '), (' Benu-redirection-url ',': = ',' http://baidu.com '),) config = ((' Cleartext-password ',' benu123 '), Radiusd.radlog (RADIUSD). L_info,' * * * python part end * * *)return(RADIUSD. Rlm_module_ok, reply, config)
Config is the user's password, look at the test results
# echo "user-name=cc:ff:ff:ff:ff,user-password=benu123" |radclient 127.0.0.1:1812 auth testing123-xSent access-request Id182 from 0.0. 0. 0:48733 to 127.0. 0. 1:1812 length WuUser-name ="Cc:ff:ff:ff:ff"User-password ="Benu123"Cleartext-password ="Benu123"Received access-accept Id182 from 127.0. 0. 1:1812 to 0.0. 0. 0:0 length theReply-message ="Hello from Rlm_python"benu-redirection-URL="Http://baidu.com"
Expand the Billing table field
Take MySQL as a billing table for example.
Adjust the fields of the billing table in MySQL
/mods-enabled/sql
To set up the MySQL database, or load the default SQLite
mods-config/sql/main/mysql/queries.conf
in the modified INSERT and UPDATE statements, according to already have the statement as the reference syntax, the SQL can be adjusted.
After the modification radiusd -Xx
is used to start, if the syntax is correct can start normally, otherwise it will be an error.
You can then use Radclient to simulate the authentication request test.
"FREERADIUS3" Installation and expansion requirements