OUR SITES NetworkRADIUS FreeRADIUS

Python Module

The python module processes attributes through a Python interpreter.

  • Please see the src/modules/rlm_python/example.py sample.

  • Please see https://www.python.org/doc/ for more information about the Python language.

Uncomment any func_* configuration items below which are included in your module. If the module is called for a section which does not have a function defined, it will return noop.

Please see the file global.d/python for server-global configuration items which control the Python path.

Configuration Settings

The Python API threading.local() may be used store thread specific data such as connection handles.

module

Module to load functions from.

  • You may set mod_<section> for any of the section to module mappings below, if you want to reference a function in a different module.

  • Uncomment func_<section> lines your module provides methods for.

func_instantiate

Called on module instantiation.

func_detach

Called on module unload.

config { …​ }

You can define configuration items (and nested sub-sections) in python config { …​ } section. These items will be accessible in the Python script through radiusd.config dict for instance:

e.g:

radiusd.config['name']
radiusd.config['sub-config']['name']

Default Configuration

python {
	module = example
#	func_instantiate = instantiate
#	func_detach = detach
#	func_authorize = authorize
#	func_authenticate = authenticate
#	func_preacct = preacct
#	func_accounting = accounting
#	func_pre_proxy = pre_proxy
#	func_post_proxy = post_proxy
#	func_post_auth = post_auth
#	config {
#		name = "value"
#		sub-config {
#			name = "value of name from config.sub-config"
#		}
#	}
}