Help us improve your experience.

Let us know what you think.

Do you have time for a two-minute survey?

Navigation  Back up to About Overview 
[+] Expand All
[-] Collapse All

Sample Script

This is an example of a simple realm selection script and its configuration settings.

  1. To test this script, copy these lines to a new text file named SampleScript.jsi in the server’s \radiusdir\scripts directory.
    [Settings]LogLevel = 2ScriptTraceLevel = 1 [Script]// Print a message in the SBR log.SbrWriteToLog(“Executing SampleScript.jsi” ); // Allocate a new Realm Selector object.var selector = new RealmSelector(); // Invoke the built-in Suffix realm selection method to obtain// the realm for the request.var realm = selector.Execute(“suffix” );SbrWriteToLog(“Suffix method returned ‘” + realm + “‘” ); // Print a trace frame to the log.SbrTrace(); //Return the realm name as the script result.return realm; [ScriptTrace]var = realm [Failure]DefaultRealm
  2. Next, edit the \radiusdir\proxy.ini file.

    In the [Processing] section at the top of the file, you see this comment line:

    ;Script <RealmScript>

    Remove the “;” and replace <RealmScript> with the actual file name (omit the file extension):

    [Processing]SuffixPrefixDNISAttribute-MappingScript SampleScript

    Note: Use only the script file base name only when configuring the Script setting. If you specify the .jsi extension, Steel-Belted Radius Carrier fails to load the file.

  3. If you wish to check the script syntax and environment, set up and run the scriptcheck utility, discussed in scriptcheck.
  4. Restart the Steel-Belted Radius Carrier process.
    When the server starts, log messages should indicate that the script loaded and is ready to run:
    Loading script from file ‘C\radius\Service\scripts\SampleScript’Extended Proxy: Enabled precedence 4 processing for Script SampleScript
  5. When a RADIUS request is received, the script executes and messages similar to these appear in the log:
    Executing ‘SampleScript’Suffix method returned ‘realm1’*** Script Trace (C:\radius\Service\scripts\SampleScript)    (line 41) SbrTrace();    realm=realm1CreateRequestEx: using virtual realm realm1 for authentication.

    Note: The actual realm name returned by the script depends on the Steel-Belted Radius Carrier configuration and the suffix decoration of the username specified in the RADIUS request.

For detailed information about the proxy.ini file, see Realm Configuration Files of the SBR Carrier Reference Guide.

Modified: 2017-09-27