How to run a perl script

Fajar A. Nugraha list at
Thu Jul 21 15:09:36 CEST 2011

On Thu, Jul 21, 2011 at 7:45 PM, Tyller D <tyllerd at> wrote:
> Hi
> I would like to run a perl script, using rlm_perl, at specific times.
> For example, when a Stop request comes in run, when an
> interim-update comes in run
> Can someone tell me where to do this. I am sorry if my question seems vague
> but I am fairly lost. I can write the script I just don't know how to call
> it.
> Any assistance would be appreciated.

Option 1: use combination of unlang (to select accounting packet type)
and rlm_exec (see modules/echo for example). This way the perl script
will be treated just like any other executable (not using rlm_perl, I
know, but some people might find it simpler)

Option 2: use rlm_perl, read modules/perl. You need to know about
creating functions in perl. Some snippet from that file:
        #  The following hashes are given to the module and
        #  filled with value-pairs (Attribute names and values)
        #  %RAD_CHECK           Check items
        #  %RAD_REQUEST         Attributes from the request
        #  %RAD_REPLY           Attributes for the reply
        #  List of functions in the module to call.
        #  Uncomment and change if you want to use function
        #  names other than the defaults.
        #func_authenticate = authenticate
        #func_authorize = authorize
        #func_preacct = preacct
        #func_accounting = accounting

The function assigned to func_accounting should then be able to
differentiate whether it's an accounting stop or interim-update by
looking at values on %RAD_REQUEST.


More information about the Freeradius-Users mailing list