Lua script context API reference for accessing AAA request data

Script Context API

The context object provides access to AAA request data through sub-contexts and methods. See scripts for script structure, parameters, and examples.

Root Context

The root context object provides these fields and methods:

Fields

FieldTypeDescription
idstringUnique request identifier
instance_idstringServer instance identifier (for HA deployments)
cluster_idstring?Cluster identifier (if configured)
versionstringRadiator server version
hostnamestringServer hostname
rootcontext?Root context (for nested contexts)
parentcontext?Parent context (for nested contexts)

Nested Contexts

Nested contexts are created automatically during tunneled EAP methods like EAP-TTLS, PEAP, and EAP-TEAP. When inner authentication runs inside the TLS tunnel, a child context is created with:

  • parent — the outer tunnel's context
  • root — the original request context (the outermost context)

For non-tunneled requests, both root and parent are nil.

The vars sub-context is shared between parent and child contexts, allowing data to be passed between outer and inner authentication phases.

Sub-contexts

FieldTypeDescription
aaaaaaAAA processing state
acctacctAccounting data
authauthAuthentication state
cachecacheCache operations
certcertCertificate information
eapeapEAP protocol data
eap_teapeap_teapEAP-TEAP specific data
eap_ttlseap_ttlsEAP-TTLS specific data
httphttpHTTP request/response
radiusradiusRADIUS packet data
radiusproxyradiusproxyRADIUS proxy data
statsstatsProcess/system stats
tacacsplustacacsplusTACACS+ protocol data
tlstlsTLS connection info
useruserUser data from backend
varsvarsCustom variables

Methods

MethodParametersReturnsDescription
log(name, message)logger name, message-Write to named AAA logger
backend(name, query?)backend name, optional queryresultExecute backend query
challenge(timeout, message?)seconds, optional message-Send challenge and wait for response
count(namespace)namespace array-Increment a statistics counter
map(name, value)map name, lookup valueresult?Execute a named policy map lookup