Scripting Overview
The Steel-Belted Radius Carrier server invokes many built-in functional modules while processing RADIUS requests. These modules are configured by initialization files in the Steel-Belted Radius Carrier home directory. For example, you configure the realm selection module with settings in the proxy.ini file.
With scripting, you can supplement or override specific functional modules within the Steel-Belted Radius Carrier server by implementing custom processing logic written in JavaScript. JavaScript APIs allow scripts to perform tasks like these:
Manipulate RADIUS request attributes.
Select the processing realm for a request.
Query external SQL and LDAP servers.
Print information and debug messages to the server log.
Note Changing passwords through scripting or filters is not supported.
Scripts are part of special initialization files that contain both the script text and settings required by Steel-Belted Radius Carrier to execute (and optionally debug) the script. JavaScript initialization (.jsi) files use a parameter syntax similar to that of other Steel-Belted Radius Carrier configuration files.
To configure a script to load and run, you refer to it by name using the Script keyword at the appropriate place in a Steel-Belted Radius Carrier initialization file. The context in which a script executes, which determines the data objects and JavaScript APIs available to it, depends on where the script reference appears in the Steel-Belted Radius Carrier configuration.
For the LDAP authentication plug-in, script settings are embedded directly in the ldapauth.aut file.
Scripts are loaded, then compiled, when the server boots or when the script is first invoked. If a script fails to load or compile, a diagnostic error message is added to the log and the associated function is either disabled or reverts to its default behavior.
Your script executes each time the flow of control within Steel-Belted Radius Carrier enters a functional module that is configured to run that script. The scripting infrastructure automatically sets up the correct environment for the script, depending on its type. The script executes until it returns normally or it encounters a runtime exception. To prevent the script from being caught in an infinite loop, you can configure an optional watchdog counter to terminate the script after it has executed a preset number of operations.
Logging and tracing functions are provided as an aid to script debugging. Scripts can send messages directly to the Steel-Belted Radius Carrier server log. Additionally, you can use the script trace feature to write line-by-line debug information to the log. Each script trace frame contains the text, filename, and line number of the next JavaScript statement for the script to execute, and the names and values of user-specified script variables.