[RADIATOR] Variables

Michael ringo at vianet.ca
Tue Nov 26 14:38:20 CST 2013


sample of the perl Hook?  Well, if you're going to just need 1 value, 
and you are ok with using the Class attribute directly, then you don't 
need a hook.  You would just need to configure:
AddToReply Class = "somevalue"
then, when the Stop comes back, the same Class value should be there.


but, here's a sample of what i do for multiple saved values in the 
Class. Notice how i load the values into new attributes.  Then i use/log 
those attributes:

sub {
   my $req         = ${$_[0]};
   my $script_name = "hook.PreHandlerHook.pl";
   &main::log($main::LOG_DEBUG, "$script_name: executing.");

   if( $req->code eq 'Accounting-Request' ) {
     if( my $class = $req->get_attr('Class') ) {
         my( $zone, $uid, $authed_un, $old_zone, $un_only ) = ( 
split(',', $class) )[0,1,2,3,4];
         $req->change_attr('zone', $zone) if $zone;
         $req->change_attr('uid', $uid) if $uid;
         $req->change_attr('auth-un', $authed_un) if $authed_un;

         &main::log($main::LOG_DEBUG, "$script_name: loading csv values 
from Class into their own attributes: 
[zone=$zone,uid=$uid,auth-un=$authed_un,old_zone=$old_zone,un_only=$un_only]");
     }
   }

# end sub
}




On 26/11/13 02:59 PM, rohan.henry @cwjamaica.com wrote:
>
> Thanks Michael.
>
> Would you be able to share a sample?
>
>
> On Tue, Nov 26, 2013 at 2:39 PM, Michael <ringo at vianet.ca 
> <mailto:ringo at vianet.ca>> wrote:
>
>     to save other values, you have to place it in the Class attribute
>     in the Reply packet going back to your device.  The Class should
>     get saved in the device, and will be there when the Stop packet
>     comes in.  I personally save a few values in the Class as coma
>     separated values.  When it comes back in, I have a PreHandlerHook
>     to pull the Class attribute out, separate the values, and place
>     them into their own attributes for later use and logging.  But if
>     you just want to save 1 value in the Class, and later log the
>     Class value, no Hook should be needed.
>
>
>     Mike
>
>
>     On 26/11/13 02:20 PM, rohan.henry @cwjamaica.com
>     <http://cwjamaica.com> wrote:
>>     Thanks Hugh.
>>
>>     I am already seeing the attributes using trace 4. Just exploring
>>     other possible ways to obtain and store the Start time of a
>>     session without having to calculate using session time
>>     (Acct-Session-Time).
>>
>>     Rohan
>>
>>
>>     On Mon, Nov 25, 2013 at 10:21 PM, Hugh Irvine <hugh at open.com.au
>>     <mailto:hugh at open.com.au>> wrote:
>>
>>
>>         Hello Rohan -
>>
>>         Most if not all of these attributes should be included in the
>>         RADIUS accounting stop request, assuming RADIUS accounting is
>>         turned on in the NAS device.
>>
>>         Note that there is a difference between "Event-Timestamp" as
>>         shown below which may be sent by the NAS, and "Timestamp"
>>         which is internal to Radiator.
>>
>>         Have a look at a trace 4 debug to see exactly what you are
>>         receiving in the RADIUS accounting requests.
>>
>>         regards
>>
>>         Hugh
>>
>>
>>         On 26 Nov 2013, at 08:26, rohan.henry @cwjamaica.com
>>         <http://cwjamaica.com> <rohan.henry at cwjamaica.com
>>         <mailto:rohan.henry at cwjamaica.com>> wrote:
>>
>>         > Hello,
>>         >
>>         > Are values for any of the foll. attributes automatically
>>         stored somewhere in Radiator where they can be fetched
>>         anytime during or at the end of the session? For example the
>>         Timestamp attribute.
>>         >
>>         > If not, how can I store values for use later in or at the
>>         end of the session?
>>         >
>>         > Attributes:
>>         >         Acct-Status-Type = Start
>>         >         User-Name =
>>         >         Event-Timestamp =
>>         >         Acct-Delay-Time =
>>         >         NAS-Identifier =
>>         >         Acct-Session-Id =
>>         >         NAS-IP-Address =
>>         >         Class =
>>         >         Service-Type =
>>         >         Framed-Protocol =
>>         >         Framed-Compression =
>>         >         Unisphere-Pppoe-Description =
>>         >         Framed-IP-Address =
>>         >         Framed-IP-Netmask =
>>         >         Calling-Station-Id =
>>         >         Connect-Info =
>>         >         NAS-Port-Type =
>>         >         NAS-Port =
>>         >         NAS-Port-Id =
>>         >         Acct-Authentic =
>>         >
>>         > Thanks.
>>         >
>>         > Regards,
>>         > Rohan
>>         > _______________________________________________
>>         > radiator mailing list
>>         > radiator at open.com.au <mailto:radiator at open.com.au>
>>         > http://www.open.com.au/mailman/listinfo/radiator
>>
>>
>>         --
>>
>>         Hugh Irvine
>>         hugh at open.com.au <mailto:hugh at open.com.au>
>>
>>         Radiator: the most portable, flexible and configurable RADIUS
>>         server
>>         anywhere. SQL, proxy, DBM, files, LDAP, NIS+, password, NT,
>>         Emerald,
>>         Platypus, Freeside, TACACS+, PAM, external, Active Directory,
>>         EAP, TLS,
>>         TTLS, PEAP, TNC, WiMAX, RSA, Vasco, Yubikey, MOTP, HOTP, TOTP,
>>         DIAMETER etc.
>>         Full source on Unix, Windows, MacOSX, Solaris, VMS, NetWare etc.
>>
>>
>>
>>
>>     _______________________________________________
>>     radiator mailing list
>>     radiator at open.com.au  <mailto:radiator at open.com.au>
>>     http://www.open.com.au/mailman/listinfo/radiator
>
>
>
>
> _______________________________________________
> radiator mailing list
> radiator at open.com.au
> http://www.open.com.au/mailman/listinfo/radiator

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.open.com.au/pipermail/radiator/attachments/20131126/62409f54/attachment-0001.html 


More information about the radiator mailing list