[RADIATOR] Accounting Hook ?

Patrik Forsberg patrik.forsberg at globalconnect.se
Fri Feb 18 07:31:05 UTC 2022


As usual when you ask for help it just starts working with the exact same code after you've asked!

I just uncommented the lines needed to work with PreProcessingHook and it worked immediately ! exact same thing I tried yesterday without luck works perfectly now..

Anyways.. thanks again for the help! ??

---
Best Regards,
Patrik

> -----Original Message-----
> From: radiator <radiator-bounces at lists.open.com.au> On Behalf Of Patrik
> Forsberg
> Sent: den 18 februari 2022 08:21
> To: radiator at lists.open.com.au
> Subject: Re: [RADIATOR] Accounting Hook ?
> 
> Hm weird I tried that and it didn't work .. guess I'll have another crack at it ??
> (sorry about IPO-Command.. thought I replaced them all with Annex-CLI-
> Command!)
> 
> Thanks for the $request->dump() thing.. that'll help with debugging ??
> 
> ---
> Best Regards,
> Patrik
> 
> > -----Original Message-----
> > From: radiator <radiator-bounces at lists.open.com.au> On Behalf Of
> > Heikki Vatiainen
> > Sent: den 17 februari 2022 18:15
> > To: radiator at lists.open.com.au
> > Subject: Re: [RADIATOR] Accounting Hook ?
> >
> > On 17.2.2022 17.13, Patrik Forsberg wrote:
> >
> > > The extra data seem to be injected into the accounting package but
> > > the
> > AcctLogFileName doesn’t pick it up but if I do a <AcctLog FILE> and
> > reference it in the Handler it shows up in the accounting record!
> >
> > I can confirm this. <AcctLog ...> clauses run the same time as
> > <AuthLog ..> clauses which is when a reply is sent.
> >
> > > Guessing AcctLogFileName picks up its data before the hook gets to
> > > insert
> > its data.
> > > (Tried it in PreProcessingHook as well with the same result)
> >
> > I'd say changes done by PreProcessingHook should have been visible
> > with output generated by AcctLogFileName.
> >
> > Here's what I used for testing, first config:
> >
> > <Handler>
> >     PreProcessingHook file:"%D/hook_compile-command-record.pl"
> >     AcctLogFileName %L/acctlog
> >     AccountingHandled
> > </Handler>
> >
> >
> > Then your hook slightly modified:
> >
> > # Works as PreProcessingHook or PreAuthHook use strict; sub {
> >      my $me = 'hook_compile-command-record.pl';
> >
> >      # Often named as $p and $rp
> >      my ($request, $reply) = (${$_[0]}, ${$_[1]});
> >      my $command = '';
> >
> >      $command = $request->get_attr('Juniper-Interactive-Command');
> >      main::log($main::LOG_DEBUG, "$me - command: $command",
> $request);
> >
> >      $request->change_attr('Annex-CLI-Command', $command);
> >
> >      my $tmp1 = $request->get_attr('Annex-CLI-Command');
> >      main::log($main::LOG_DEBUG, "$me - command: $tmp1", $request);
> >
> >      $reply->change_attr('IPO-Command', $command);
> >
> >      return;
> > }
> >
> > It's not mandatory to pass the request object to logging, but it's
> > helps when PacketTrace, LogTraceId and others are enabled. That is, it
> > helps logger when selective logging is needed.
> >
> > In acctlog I can see something like this:
> >
> > 	Juniper-Interactive-Command = "abc 123 xyz"
> > 	Annex-CLI-Command = "abc 123 xyz"
> >
> > and IPO-Command would be sent out if it were in the dictionary.
> >
> > The packet dump that shows the incoming messages is done much earlier
> > than the hook runs. If you'd want to dump the message from a hook too,
> > use something like this:
> >
> >      main::log($main::LOG_DEBUG, "$me - modified request:\n" .
> > $request->dump(), $request);
> >
> >
> > Thanks,
> > Heikki
> >
> > --
> > Heikki Vatiainen
> > OSC, makers of Radiator
> > Visit radiatorsoftware.com for Radiator AAA server software
> > _______________________________________________
> > radiator mailing list
> > radiator at lists.open.com.au
> > https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Flist
> >
> s.o%2F&data=04%7C01%7Cpatrik.forsberg%40globalconnect.se%7C437
> 8d4c
> >
> 81619424412c908d9f2af33f8%7Cdfbb0d3b8276458197a42b844a84ea35%7C0%
> 7C0%7
> >
> C637807658348791436%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAw
> MDAiLCJQIj
> >
> oiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=163Cuz1
> %2BI%
> > 2F1op8zBHbOybCfFI8PH7z%2BwcOEmrZjTM6U%3D&reserved=0
> >
> pen.com.au%2Fmailman%2Flistinfo%2Fradiator&data=04%7C01%7Cpatr
> >
> ik.forsberg%40globalconnect.se%7C01db26be514844e8602008d9f239525e%7
> >
> Cdfbb0d3b8276458197a42b844a84ea35%7C0%7C0%7C637807150418305439%
> >
> 7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLC
> >
> JBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=dEiFTGczYQnIx4h3Dp
> > B2ISzMLikWTWGeFN%2Bq5MuA0ec%3D&reserved=0
> _______________________________________________
> radiator mailing list
> radiator at lists.open.com.au
> https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.o
> pen.com.au%2Fmailman%2Flistinfo%2Fradiator&data=04%7C01%7Cpatr
> ik.forsberg%40globalconnect.se%7C4378d4c81619424412c908d9f2af33f8%7C
> dfbb0d3b8276458197a42b844a84ea35%7C0%7C0%7C637807658348791436%7
> CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJ
> BTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=%2F%2BBYBWj6cOOf
> pM6HW1G5NT1xf99LK%2B1dOcNgNseN%2BHY%3D&reserved=0


More information about the radiator mailing list