Ldap Scripting
Ldap Scripting
Ldap Scripting
Release 5.4
March 2006
Copyright 20042006 Juniper Networks, Inc. All rights reserved. Printed in the USA.
Steel-Belted Radius, Juniper Networks, and the Juniper Networks logo, are registered trademarks of Juniper
Networks, Inc. in the United States and other countries. All other trademarks, service marks, registered trademarks, or
registered service marks are the property of their respective owners. All specifications are subject to change without
notice.
Juniper Networks assumes no responsibility for any inaccuracies in this document. Juniper Networks reserves the
right to change, modify, transfer, or otherwise revise this publication without notice.
M06223
Contents
Chapter 1
Chapter 2
Chapter 3
Contents
iii
Chapter 4
Chapter 5
Index
iv
Contents
March 2006
The LDAP Scripting Guide describes how to use scripts written in the JavaScript
programming language to enhance the search capabilities of the Steel-Belted Radius
LDAP Authentication module.
Chapter 1, LDAP Authentication and JavaScript, describes how the LDAP plugin
handles authentication requests and describes how JavaScript integrates into that
process.
Chapter 3, Creating LDAP Scripts, describes how to write LDAP scripts and how
to interpret return codes.
Typographical Conventions
This manual uses the following conventions to present special types of text.
Computer Text
Filenames, directory names, IP addresses, URLs, commands, and file listings appear in a
plain fixed-width font:
For more information, go to http://www.funk.com...
[EventDilutions]
SQLConnectFailure=8
Variable Text
Variable text that you must replace with your own information appears in italics. For
example, you would enter your name and password in place of YourName and
YourPassword in the following interaction.
Enter your name: YourName
Password: YourPassword
File names and computer text can also be displayed in italics to indicate that you should
replace the values shown with values appropriate for your enterprise. For example, you
would enter your own information in place of the italicized text in the following
example:
[EventDilutions]
EventName=DilutionCount
Key Names
Names of keyboard keys appear in SMALL CAPS. When you need to press two or more
keys simultaneously, the key names are joined by a + sign:
Press RETURN.
Press CTRL+ALT+DEL.
vi
March 2006
Syntax
X
radiusdir represents the directory into which Steel-Belted Radius has been
installed. By default, this is C:\Radius\Service for Windows systems and
/opt/funk/radius on Linux and Solaris systems.
Angle brackets < > enclose a list from which you must choose an item in format
and syntax descriptions.
A vertical bar ( | ) separates items in a list of choices. In the following example, you
must specify add or replace (but not both):
[AttributeName]
<add | replace> = Attribute [,Attribute]
Related Documentation
The following documents supplement the information in this manual.
The Steel-Belted Radius Getting Started manual describes how to install, configure, and
administer the Steel-Belted Radius software on a server running the Solaris, Linux,
or Windows operating system.
The Steel-Belted Radius Reference Guide describes the configuration files and settings
used by Steel-Belted Radius.
vii
RFC 2618, RADIUS Authentication Client MIB. B. Aboba, G. Zorn. June 1999.
RFC 2619, RADIUS Authentication Server MIB. G. Zorn, B. Aboba. June 1999.
RFC 2620, RADIUS Accounting Client MIB. B. Aboba, G. Zorn. June 1999.
RFC 2621, RADIUS Accounting Server MIB. G. Zorn, B. Aboba. June 1999.
RFC 2865, Remote Authentication Dial In User Service (RADIUS). C. Rigney, S. Willens,
A. Rubens, W. Simpson. June 2000.
RFC 2867, RADIUS Accounting Modifications for Tunnel Protocol Support. G. Zorn, B.
Aboba, D. Mitton. June 2000.
RFC 2868, RADIUS Attributes for Tunnel Protocol Support. G. Zorn, D. Leifer, A.
Rubens, J. Shriver, M. Holdrege, I. Goyret. June 2000.
RFC 2882, Network Access Servers Requirements: Extended RADIUS Practices. D. Mitton.
July 2000.
RFC 3162, RADIUS and IPv6. B. Aboba, G. Zorn, D. Mitton. August 2001.
Third-Party Products
For more information about configuring your access servers and firewalls, consult the
manufacturers documentation provided with each device.
viii
March 2006
1-617-491-6503
Email:
support@funk.com
Web:
If you're located outside the U.S. and Canada, please contact the authorized Funk
Software partner in your area to obtain support.
X
Our Technical Support department is open weekdays between 9:00 AM and 5:30
PM (Eastern) to customers who are on warranty support, who are evaluating the
product, or who are not covered by a support contract.
Our Technical Support department is open weekdays between 9:00 AM and 8:00
PM (Eastern) to customers who hold a current annual maintenance and support
contract.
Information about the server configuration and operating system, including any OS
patches that have been applied.
Any documentation that may help in resolving the problem, such as error messages,
memory dumps, compiler listings, and error logs.
You can use the Funk Software website (http://www.funk.com) to register your
software, display answers to frequently asked questions, search the Steel-Belted Radius
technical support database, and download product documentation in Adobe Reader
(.pdf) format.
ix
March 2006
Chapter 1
LDAP Authentication and JavaScript
This chapter describes how the LDAP plugin handles authentication requests and
describes how JavaScript integrates into that process.
Steel-Belted Radius performs one or more LDAP searches. Parameters for each
search are given in the [Search/name] sections of the configuration file. After a
search is performed, selected attributes are copied from the LDAP response and
placed in the variable table.
Steel-Belted Radius uses the [Response] section to select information from the
variable table to be returned to the RADIUS client in the RADIUS response packet.
Figure 1 illustrates how the LDAP variable table is populated with information coming
from a RADIUS access-request message, default values, and the results of LDAP Bind,
Base, and Search requests. The information in the variable table is then used to format
the access-response packet returned to the RADIUS client.
AccessRequest
AccessResponse
RADIUS
Authentication
Packets
xxxxxxxxx
xxxxxxx
xxx
xxxxxxxxx
xxx
xxxxxx
.
.
.
xxx
xxxxxxx
xxx
LDAP
Bind,
Base, and
Search
LDAP
Database
xx
xxxxxxx
xxxxx
Variable
Table
LDAP Server
Default Values,
Template Strings
RADIUS
Server
March 2006
LDAP Scripting
Execute
Query 1
Found
NotFound
Execute
Query 2
Found
NotFound
Success
- Access Granted
- Access Refused
Execute
Query 4
Found
Execute
Query 3
Found
Success
Success
NotFound
Failure
NotFound
Failure
LDAP Scripting
LDAP scripting is used when more sophisticated decision logic or attribute
manipulation is required than can be implemented using unscripted searches.
Incorporating JavaScript into the Steel-Belted Radius ldapauth.aut file gives you
much greater flexibility in the processing of LDAP authentication queries. Scripted
authentication allows a level of control comparable to SQL stored procedures.
For example, LDAP scripts can combine data from several LDAP queries and analyze
the results to determine which query to invoke next. LDAP scripts can evaluate loops
and complicated if-then-else logic, build up RADIUS attribute value strings from
scratch, and write status messages to the Steel-Belted Radius log.
Figure 3 illustrates the data flow involved in a scripted query. Instead of following a rigid
branch structure, the request is processed according to the logic of the LDAP script,
which may be arbitrarily complex. The script executes one or more LDAP queries,
computes intermediate results from the return values, updates the LDAP variable table,
and possibly executes additional queries against the LDAP server. Once the script has
completed processing the request and made an authentication decision, it returns a result
code to the plugin.
Error Handling
LDAP
Request
Execute Query 1
Execute Query 2
Script
Logic
Read
Variable
Table
Update
Execute Query n
Result
Code
Figure 3 Scripted Query Data Flow
About JavaScript
Scripts for the Steel-Belted Radius LDAP authentication plugin are written in
ECMAScript (ECMA-262), which .is the international standard corresponding roughly
to JavaScript 1.5. JavaScript is a compact, cross-platform, object-based scripting
language that combines a powerful syntax with simplicity and ease of use.
NOTE: The JavaScript compiler that runs LDAP scripts is a component of
Steel-Belted Radius, and does not depend on the browser or JVM you have installed
on your computer.
Error Handling
Processing of an LDAP authentication request may not always be successful.
Steel-Belted Radius may be unable to contact any of the LDAP servers listed in the
configuration file, or the requested user may not be found. Settings in the
ldapauth.aut file control how Steel-Belted Radius handles error conditions.
[Failure] Section
The [Failure] section of the ldapauth.aut file is used to determine the result when
Steel-Belted Radius is unable to connect to any of the configured LDAP servers. Either
an accept or reject response may be sent. If configured to accept on failure, the user's
full name and a Steel-Belted Radius profile entry may be specified for the return result.
March 2006
Return Codes
master accounts server to check for a user entry that has not yet propagated out to the
rest of the LDAP server cluster.
Return Codes
Once the LDAP plugin has finished processing a request, it must return a result to the
Steel-Belted Radius core. The plugin may signal that the user should be accepted or
rejected, or (if it is unable to process the request) it may ask Steel-Belted Radius to defer
the decision to another authentication method. Finally, the plugin may indicate to
Steel-Belted Radius that a software failure occurred during processing. It is up to
Steel-Belted Radius to interpret the plugin return code and determine what action to
take next.
The return code from the plugin to Steel-Belted Radius is a numerical value that it sent
via the Steel-Belted Radius authentication plugin application programming interface
(API). For unscripted requests, the return code is generated internally by hard-coded
logic within the LDAP plugin. When LDAP scripting is used, the plugin return code is
generated by the LDAP plugin depending on the value returned by the script when it
terminates.
NOTE: The authentication plugin API is not visible to LDAP script programmers.
Password Processing
For BindName authentication, the %Password attribute is used to return the value of the
user password obtained by the LDAP search to the LDAP plugin. The LDAP plugin
compares the %Password attribute with the password supplied in the incoming
Access-Request and accepts the user if the passwords match. If the passwords do not
match, the user is rejected, even if the script returned SBR_RET_SUCCESS.
For more information on password process, see Script Return Codes on page 14.
LDAP Scripting Guide
Return Codes
March 2006
Chapter 2
LDAP Script Configuration
This chapter describes how to configure the ldapauth.aut file to support LDAP
scripting.
[Settings] Section
Two scripting parameters have been added to the ldapauth.aut file.
The MaxScriptSteps parameter lets you specify the maximum number of statements
a script can execute before terminating. You can use the MaxScriptSteps parameter
to make sure a script does not get caught in an infinite loop.
Function
MaxScriptSteps
ScriptTraceLevel
[ScriptTrace] Section
The [ScriptTrace] section specifies which RADIUS attributes and script variables appear
in script trace logs. You can use the [ScriptTrace] section to identify the trace
information you want to record in the log file.
Table 2. [ScriptTrace] Section in ldapauth.aut
Parameter
Function
attr
var
Each line in the [ScriptTrace] section defines a single attribute or variable. In the
following example, the identifiers User-Name and Service-Type refer to RADIUS
attributes in the variable table. The identifiers count and userid refer to program
variables in the JavaScript execution context.
[ScriptTrace]
attr = User-Name
attr = Service-Type
var = count
var = userid
March 2006
[Script] Section
The [Script] section contains the body of your LDAP script. Unlike other configuration
file sections, where parameters appear on individual lines, the LDAP script is entered as
multi-line block of text. The script is processed until a line is encountered that begins
with a left bracket ( [ ) or the end of the file is reached.
The following example is a simple script that writes a message to the log and accepts the
user regardless of the supplied credentials.
[Script]
// Define a function that writes its arguments to the log.
function logArgs(ival, sval) {
SbrWriteToLog("logArgs: ival=" + ival + ", sval=" + sval);
}
// Declare two variables and pass them to the logging function.
var i = 1;
var s = "Hello";
logArgs(i, s);
// Accept the user unconditionally.
return SBR_RET_SUCCESS;
10
March 2006
Chapter 3
Creating LDAP Scripts
This chapter describes how to write LDAP scripts and how to interpret return codes.
Get, set, and reset values of variables stored in the LDAP variable table
Write diagnostic messages and script traces to the Steel-Belted Radius log
Exit the script and return a result code string to the LDAP plugin
When Steel-Belted Radius starts, it reads the text of the [Script] section from
ldapauth.aut and passes it as a block to the JavaScript interpreter, which compiles it
into bytecodes. The bytecodes are stored for execution during subsequent LDAP
authentication requests. If syntax errors are detected in the JavaScript text, the script
does not compile and the LDAP authentication plugin is disabled. Any error messages
generated during script compilation appear in the Steel-Belted Radius log file.
If you are using the Global Enterprise Edition or Service Provider Edition of
Steel-Belted Radius, you can use the scriptcheck utility to check your LDAP scripts
for syntax errors without having to start Steel-Belted Radius. See Scriptcheck Utility
on page 16 for more information about scriptcheck.
11
The LdapVariables object is available to your script for manipulating attributes in the
variable table. The LdapVariables object exposes three methods that scripts can call:
X
variable.
X
Other Recommendations
12
ECMAScript comments begin with // or /*. Lines in the ldapauth.aut file that
begin with a semicolon (;) are ignored. For clarity, you should use // or /* to
identify script comments.
Thoroughly test all scripts for speed, and monitor the performance of Steel-Belted
Radius after you deploy a new script. In general, the complexity of an LDAP script
has a direct impact on server performance.
If a [Script] section is present in the ldapauth.aut file, then the Search= line in
the [Settings] section of the file is ignored. To prevent a script from running, change
the [Script] heading to [NoScript] in the ldapauth.aut file.
After you modify LDAP scripts, you must restart Steel-Belted Radius. You cannot
reload the LDAP plugin with the radhup command.
March 2006
It can convert the script return code to a plugin return code and send that code
directly to Steel-Belted Radius, ending the processing of that request by the plugin.
It can perform failure processing, and generate a plugin return code from the
[Failure] section in ldapauth.aut.
It can re-execute the script against a different LDAP server and process the new
result when the script is finished.
The script programmer must understand exactly how the LDAP plugin processes script
return codes. This information is given in detail in the following sections.
SBR_RET_SUCCESS
The SBR_RET_SUCCESS code indicates to the Steel-Belted Radius core that the
authentication request was processed successfully and the user should be accepted.
SBR_RET_DO_NOT_AUTHENTICATE
The SBR_RET_DO_NOT_AUTHENTICATE code indicates that the authentication failed
and a hard reject should be performed immediately. No other authentication methods
should be called.
SBR_RET_NOT_AUTHENTICATED
The SBR_RET_NOT_AUTHENTICATED code indicates that the plugin was unable to
authenticate the user, but the user should not be rejected yet. The next authentication
method in the server configuration should be tried.
SBR_RET_FAILURE
The SBR_RET_FAILURE code indicates that an unspecified software failure occurred in
the plugin during processing of the request. Steel-Belted Radius should reject the user
and write a failure message to the log.
LDAP Scripting Guide
13
SBR_RET_SUCCESS
The SBR_RET_SUCCESS code indicates to the LDAP plugin that the script was
processed successfully.
X
If the script returns SBR_RET_SUCCESS and a value for the %Password return list
attribute is not configured in the [Response] section of the applicable .aut file, the
user is accepted.
If the script returns SBR_RET_SUCCESS and a value has been set for the
%Password return list attribute, the plugin validates the user-supplied password
against the value in the return list attribute. If the passwords match, the user is
accepted and normal attribute processing continues.
NOTE: Because the value of the %Password return list attribute is encrypted, you
cannot pass it into a script to compare values. You can configure a script variable to
pass out a value for %Password.
SBR_RET_DO_NOT_AUTHENTICATE
The SBR_RET_DO_NOT_AUTHENTICATE code indicates to the LDAP plugin that a
hard reject should be performed by the server. The plugin finishes processing the
request and sends the plugin return code SBR_RET_DO_NOT_AUTHENTICATE to
the Steel-Belted Radius core.
SBR_RET_TRY_NEXT_AUTH_METHOD
The SBR_RET_NOT_TRY_NEXT_AUTH_METHOD code indicates that the LDAP plugin
should stop processing the request and ask Steel-Belted Radius to try the next
authentication method without immediately rejecting the user. The plugin sends the
plugin return code SBR_RET_NOT_AUTHENTICATED to the Steel-Belted Radius
core. Last resort processing is not performed.
SBR_RET_NOT_AUTHENTICATED
The SBR_RET_NOT_AUTHENTICATED code indicates to the LDAP plugin that the
script could not authenticate the user. If a last resort server is defined, the LDAP plugin
14
March 2006
should re-execute the script against that server. If there is no last resort server, this
return code has the same effect as SBR_RET_NOT_TRY_NEXT_AUTH_METHOD.
SBR_RET_FAILURE
The SBR_RET_FAILURE code indicates to the LDAP plugin that a communication
failure with the LDAP server occurred. The plugin should re-execute the script against
the next LDAP server in the configuration, if defined. If only one server is defined, or
the last server has already been tried, the LDAP plugin should process the [Failure]
section to determine the plugin return code. If there is no [Failure] section, this return
code has the same effect as SBR_RET_NOT_TRY_NEXT_AUTH_METHOD.
Script Tracing
A script trace is a block of program status information written to the Steel-Belted Radius
log file prior to the execution of a JavaScript statement. Information in the script trace
includes:
X
The names and values of specified program variables at the time the trace is written
The names and values of specific RADIUS attributes (from the variable table) at the
time the trace is written
You define the names of program variables and RADIUS attributes to be displayed in
script traces by entering them in the [ScriptTrace] section of the ldapauth.aut file. See
[ScriptTrace] Section on page 8 for information on configuring script tracing in the
LDAP plugin.
You have two options for enabling tracing of your LDAP scripts.
X
Manual tracing You can set the ScriptTraceLevel parameter in the [Settings]
section of ldapauth.aut to 1 and call the SbrTrace() function from within
your script. This causes a single script trace record to appear in the log from the
point in your script where the SbrTrace() function was called.
Automatic tracing You can set the ScriptTraceLevel parameter in the [Settings]
section of ldapauth.aut to 2 to enable automatic tracing. In this mode, a script
trace is performed every time a JavaScript statement is executed in your script.
NOTE: Because of the large volume of information produced and the resulting
performance impact on Steel-Belted Radius, the use of automatic script tracing is not
recommended for production environments.
15
The following example lists a small script and a portion of the automatic script trace
generated from it.
[Script]
var a = 1;
var s = "Hello";
return SBR_RET_SUCCESS;
[ScriptTrace]
attr = User-Name
var = a
var = s
. . .
*** Script Trace (c:\radius\service\ldapauth.aut)
(line 1) var a = 1;
User-Name = testuser
a = <not found>
s = <not found>
*** Script Trace (c:\radius\service\ldapauth.aut)
(line 2) var s = "Hello";
User-Name = testuser
a = 1
s = <not found>
*** Script Trace (c:\radius\service\ldapauth.aut)
(line 3) return SBR_RET_SUCCESS;
User-Name = testuser
a = 1
s = Hello
. . .
Note that traces are produced just prior to execution of the JavaScript statement
referenced in the trace. For instance, the value of variable "a" is not reflected in the trace
on line 1, but appears in the trace on line 2, after the assignment statement has executed.
If a variable or attribute has not yet been assigned, or if a variable is out of scope at the
time of the trace, the value is displayed in the log as <not found>.
Scriptcheck Utility
The scriptcheck utility, which is included in the Global Enterprise Edition (GEE)
and Service Provider Edition (SPE) of Steel-Belted Radius, lets you check your LDAP
scripts for syntax errors.
NOTE: The scriptcheck utility verifies that your script is syntactically correct. The
scriptcheck utility does not guarantee your script is free of runtime errors or
produces correct results. If your script does not appear to be working properly, review
the Steel-Belted Radius log for error messages and enable script tracing to diagnose
the problem.
16
March 2006
When the scriptcheck utility runs, it loads the [Script] section in the specified .aut
file and uses the JavaScript interpreter to compile the script text. Any error messages
produced during script compilation are printed on the console. You can then correct the
errors and rerun scriptcheck to verify that the script compiles correctly.
NOTE: Syntax error line numbers reported by the scriptcheck utility are counted
relative to the first line of the ldapauth.aut file. This is different from the error
messages produced by Steel-Belted Radius at server start time. When Steel-Belted
Radius prints script syntax error messages, the line numbers are counted relative to
the first line of the [Script] section in the ldapauth.aut file.
Installation Location
By default, the scriptcheck utility (which is named scriptcheck on Solaris/Linux
and scriptcheck.exe on Windows) is installed in two locations:
X
The loose copies of the program are included for the case where Steel-Belted Radius is
installed on one platform, but script development is done on a different platform. This
saves users the bother of doing a dummy SBR install just to get a platform-specific copy
of the scriptcheck utility.
You can copy the appropriate scriptcheck executable version to any convenient
location and run it there, provided you also copy the radius.lic file (described in the
next section) to the same location.
If you install the JavaScript upgrade license using SBR Administrator, the
radius.lic file is updated automatically in the radiusdir home directory.
After that, you can run scriptcheck in that directory with no additional
configuration. To run the scriptcheck utility in another location, place a copy of
your radius.lic file to the same directory.
Alternatively, you can use a text editor to create a radius.lic file and enter the
JavaScript upgrade license string into the file by hand.
Creating LDAP Scripts
17
18
March 2006
Chapter 4
LDAP Scripting Reference
This chapter describes the functions, objects, and methods used in LDAP scripting.
Function Reference
Ldap Object
The Ldap object exposes methods for invoking LDAP queries from scripts.
Ldap.Search()
Purpose
Syntax
Ldap.Search(SearchSection)
Parameters
SearchSection
Ldap.FOUND
Ldap.NOTFOUND
Ldap.FAILURE
Ldap.NOSUCHSEARCH
Returns
Example
19
Function Reference
Timeout = 20
%DN = dn
you would use the following JavaScript command to invoke the query:
Ldap.Search("vpn");
LdapVariables Object
The LdapVariables object exposes methods for manipulating attributes in the LDAP
plugin variable table.
LdapVariables.Get()
Purpose
Syntax
LdapVariables.Get(variableName[, nItem])
Parameters
VariableName
nItem
Specifies the index of the value for multi-valued attributes. You can
specify the value of nItem as part of the command, or you can use a
separate variable to set the value of nItem (as shown in the
following example).
Returns
The value of the specified attribute, or a null value if the attribute doesn't exist or if the
index is out of bounds.
Examples
LdapVariables.Add()
Purpose
Syntax
Parameters
variableName
value
Specifies the value of the variable, which may be text or binary data.
raw
20
March 2006
Function Reference
Returns
Nothing.
Example
LdapVariables.Add("Vpn-User-Name", "Fred");
LdapVariables.Reset()
Purpose
Syntax
LdapVariables.Reset(variableName)
Parameters
VariableName
Returns
Nothing.
Example
LdapVariables.Reset("Vpn-User-Name");
SbrWriteToLog()
Purpose
The SbrWriteToLog() function writes text strings to the Steel-Belted Radius log file.
Syntax
SbrWriteToLog([logLevel, ]msg)
Parameters
logLevel
msg
Returns
Nothing.
Example
SbrTrace()
Purpose
The SbrTrace() function writes a script trace to the log from the point in the script
where the statement appears.
Syntax
SbrTrace([logLevel])
Parameters
logLevel
Specifies the message log level. The log level must be greater than or
equal to this value for the script trace to appear in the log.
21
Returns
Nothing.
Example
SbrTrace(1);
Action
SBR_RET_SUCCESS
SBR_RET_DO_NOT-AUTHENTICATE
if the %Password response attribute is
set but does not match the password in
the Access-Request.
SBR_RET_DO_NOT_
AUTHENTICATE
SBR_RET_DO_NOT_AUTHENTICATE
SBR_RET_TRY_NEXT_
AUTH_METHOD
SBR_RET_NOT_AUTHENTICATED
SBR_RET_FAILURE
A communication
error occurred. Retry
the script with the
next server in the
list, or go to [Failure]
section if no server
is available.
SBR_RET_NOT_AUTHENTICATED,
depending on configuration
SBR_RET_NOT_
AUTHENTICATED
22
March 2006
Chapter 5
LDAP Scripting Examples
This chapter provides examples of how LDAP scripting can be used to search and
modify the LDAP variable tables in Steel-Belted Radius.
23
24
March 2006
25
The following LDIF entries present the data objects holding the "Radius-Profile"
attributes associated with each employee type:
dn: ou=radius, dc=funk,dc=com
ou: radius
objectClass: top
objectClass: organizationalunit
dn: name=VendorType, ou=radius, dc=funk,dc=com
Radius-Profile: Vendor-Profile
name: VendorType
objectClass: top
objectClass: radius
dn: name=FacultyType, ou=radius, dc=funk,dc=com
Radius-Profile: Faculty-Profile
name: FacultyType
objectClass: top
objectClass: radius
dn: name=StudentType, ou=radius, dc=funk,dc=com
Radius-Profile: Student-Profile
name: StudentType
objectClass: top
objectClass: radius
26
March 2006
Finally, here are the configuration settings and the LDAP search script:
[Request]
%UserName = User-Name
[Response]
%Profile = Radius-Profile
%Password = userpassword
[Attributes/UserAttributes]
employeetype
userpassword
[Attributes/TypeAttributes]
radius-profile
[Search/FindUser]
Base=ou=people,dc=funk,dc=com
Scope = 2
Filter = uid=<User-Name>
Attributes = UserAttributes
Timeout = 20
%DN = dn
[Search/Student]
Base=ou=radius,dc=funk,dc=com
Scope = 2
Filter = name=StudentType
Attributes = TypeAttributes
Timeout = 20
[Search/Faculty]
Base=ou=radius,dc=funk,dc=com
Scope = 2
Filter = name=FacultyType
Attributes = TypeAttributes
Timeout = 20
[Search/Vendor]
Base=ou=radius,dc=funk,dc=com
Scope = 2
Filter = name=VendorType
Attributes = TypeAttributes
Timeout = 20
[Script]
// Look up the specified user in the LDAP repository.
var status = Ldap.Search("FindUser");
if (status != Ldap.FOUND) {
return SBR_RET_NOT_AUTHENTICATED;
}
// Get the employeetype attribute from the query result.
var type = LdapVariables.Get("employeetype");
27
28
March 2006
Index
A
access-request attributes 1
angle brackets, meaning of vii
attr 8
attribute maps 2
attribute normalization 25
Attributes/name section 12
interpreter 11
J
JavaScript 4
compiler 4
interpreter 11
JavaScript upgrade license 17
Base strings 1
Bind strings 1
brackets, meaning of vii
bytecodes 11
C
Calling-Station-ID attribute 25
comments 12
contacting technical support ix
conventions vi
D
Distinguished Names (DNs) 2
E
ECMAScript 4
comments 12
employeetype attribute 26
F
Failure section 4
filter strings 2
I
input/output (I/O) operations 12
Internet Engineering Task Force (IETF) viii
LDAP Scripting Guide
M
MaxScriptSteps 7, 8
methods 19
N
nItem 20
normalization 25
Index
29
O
OnFound 2
OnNotFound 2
P
plugin return codes 5, 13
profile 4, 24
Q
query tree 2
Search strings 1
Search/name section 12
Search/name sections 1
syntax errors 11
T
technical support, contacting ix
tracing 15
U
unscripted searches 2
upgrade license 17
R
radhup command 12
radius.lic file 17
radiusattrs attribute 24
radiusdir vii, 17
Radius-Profile attribute 26
Request section 1, 11
Requests for Comments viii
Response section 1, 11
return code 13
return codes 5, 22
RFCs viii
V
var 8
variable table 1, 11
VariableName 20
vertical bar, meaning of vii
S
SBR_RET_DO_NOT_AUTHENTICATE 13, 14, 22
SBR_RET_FAILURE 13, 15, 22
SBR_RET_NOT_AUTHENTICATED 13, 14, 22
SBR_RET_SUCCESS 13, 14, 22
SBR_RET_TRY_NEXT_AUTH_METHOD 22
SbrTrace() 21
SbrTrace() function 12
SbrWriteToLog() 15, 21
SbrWriteToLog() function 12
script return codes 5, 14, 22
Script section 9, 11
script tracing 15
scriptcheck utility 11, 16
scriptcheck.exe 17
scripted queries 3
ScriptTrace section 8
ScriptTraceLevel 7, 8
30
Index
March 2006