[RADIATOR] Accounting Hook ?

Patrik Forsberg patrik.forsberg at globalconnect.se
Thu Feb 17 15:13:29 UTC 2022


Hello,
Correction!

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!

Guessing AcctLogFileName picks up its data before the hook gets to insert its data.
(Tried it in PreProcessingHook as well with the same result)

---
Best Regards,
Patrik

> -----Original Message-----
> From: radiator <radiator-bounces at lists.open.com.au> On Behalf Of Patrik
> Forsberg
> Sent: den 17 februari 2022 14:50
> To: Hugh Irvine <hugh at irvine.com.au>
> Cc: radiator at lists.open.com.au
> Subject: Re: [RADIATOR] Accounting Hook ?
> 
> Hello,
> Been trying a few different things now but I seem unable to manipulate the
> actual accounting record for some reason.
> 
> Currently I have a AuthBy INTERNAL and use AcctOtherHook and have a very
> simple hook to just add a custom attribute to the request but the request
> never shows up in either a trace 4 or in the accounting file(AcctLogFileName)
> no matter what I do in the hook.
> I can see that it gets executed and it does stuff because I use
> &main::log($main::LOG_DEBUG to add things to the trace 4 log and if I add it
> to the reply it shows up in the trace and the response to the client.
> 
> Hook looks like this(sorta ..)
> "
> use strict;
> 
> sub
> {
>     my $me = 'hook_compile-command-record.pl';
> 
>     my ($request, $reply, $extras) = @_; # stolen from goodies/sqlradacct.pl
>     my $command = '';
> 
>     $command = $request->get_attr('Juniper-Interactive-Command');
>     &main::log($main::LOG_DEBUG, "$me - command: $command"); # shows
> up in a trace 4 log
> 
>     $request->change_attr('Annex-CLI-Command', $command); # never
> makes it to AcctLogFileName file
> 
>     my $tmp1 = $request->get_attr('Annex-CLI-Command');
>     &main::log($main::LOG_DEBUG, "$me - command: $tmp1"); # shows up in
> a trace 4 log
> 
>     $reply->change_attr('IPO-Command', $command); # shows up in the reply
> package to the client
> 
>     return ($main::ACCEPT);
> }
> "
> (using "Annex-CLI-Command" just as an example)
> 
> 
> ---
> Best Regards,
> Patrik
> 
> > -----Original Message-----
> > From: Hugh Irvine <hugh at irvine.com.au>
> > Sent: den 14 februari 2022 10:38
> > To: Patrik Forsberg <patrik.forsberg at globalconnect.se>
> > Cc: radiator at lists.open.com.au
> > Subject: Re: [RADIATOR] Accounting Hook ?
> >
> >
> > Patrik -
> >
> > When setting up this sort of system, Include files and GlobalVar’s are
> > your friend.
> >
> > Let me know if I can help.
> >
> > regards
> >
> > Hugh
> >
> >
> > > On 14 Feb 2022, at 20:05, Patrik Forsberg
> > <patrik.forsberg at globalconnect.se> wrote:
> > >
> > > Hello,
> > >
> > > Hm yea that's food for thought .. I'm using Farm atm to cope with
> > > increased
> > load but might have to split out auth and accounting by themselves as
> > well.. it is tempting as it would add a lot of other benefits as well.. thanks ??
> > >
> > > ---
> > > Best Regards,
> > > Patrik
> > >
> > >> -----Original Message-----
> > >> From: Hugh Irvine <hugh at irvine.com.au>
> > >> Sent: den 11 februari 2022 22:24
> > >> To: Patrik Forsberg <patrik.forsberg at globalconnect.se>
> > >> Cc: radiator at lists.open.com.au
> > >> Subject: Re: [RADIATOR] Accounting Hook ?
> > >>
> > >>
> > >> Hi Patrik -
> > >>
> > >> Good to hear from you as always.
> > >>
> > >> I recommend running separate instances for authentication and
> > accounting.
> > >>
> > >> Ie. one process on ports 1645 and 1812, and another process on 1646
> > >> and 1813.
> > >>
> > >> That way you have all of the authentication requests being
> > >> processed by one instance and all of the accounting requests being
> > >> processed by a separate instance.
> > >>
> > >> Then you can deal with the accounting requests much more easily.
> > >>
> > >> This has the added advantage of much better performance overall.
> > >>
> > >> As you say, there are a variety of hooks available at different
> > >> times during packet processing depending on when you want to modify
> > >> the
> > packet.
> > >>
> > >> You can use a PreClientHook, PreProcessingHook, PreAuthHook, or
> > >> even any of the hooks in a chained AuthBy INTERNAL clause.
> > >>
> > >> hope that helps
> > >>
> > >> cheers
> > >>
> > >> Hugh
> > >>
> > >>
> > >>> On 12 Feb 2022, at 01:16, Patrik Forsberg
> > >> <patrik.forsberg at globalconnect.se> wrote:
> > >>>
> > >>> Hello,
> > >>> Is there a hook I can use to rewrite the accounting record ?
> > >>> Looking at the manual the closest I can find is PreProcessingHook ?
> > >>>
> > >>> I’m trying to create a more generic accounting setup but the way I
> > >>> use it I
> > >> only need specific records from the accounting package and
> > >> depending on vendor this record is different so I figured if I can
> > >> hook into the accounting process before it gets used for
> > >> “logging”(I’m using <AuthBy SQL> and use that with AccountingTable
> > >> and so forth) I can rewrite/add a new record I can later use in
> logging/AcctColumnDef.
> > >>> Using AuthBy I might get away with using PreAuthHook on that
> > >>> specific
> > >> AuthBy clause ?
> > >>>
> > >>> ---
> > >>> Best Regards,
> > >>> Patrik
> > >>>
> > >>> _______________________________________________
> > >>> radiator mailing list
> > >>> radiator at lists.open.com.au
> > >>>
> > >> https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fl
> > >> is
> > >>
> >
> ts.o%2F&data=04%7C01%7Cpatrik.forsberg%40globalconnect.se%7C53c
> > f9
> > >>
> >
> fef8d0446ea0aa208d9ef9dc099%7Cdfbb0d3b8276458197a42b844a84ea35%7C
> > 0%7C
> > >>
> >
> 0%7C637804283432529013%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLj
> > AwMDAiLC
> > >>
> >
> JQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=fuW
> > Q%2B
> > >> 8nGegg%2BbrC5wBEQylJ0b9aupL6QgE9yXFfTmtA%3D&reserved=0
> > >>
> >
> pen.com.au%2Fmailman%2Flistinfo%2Fradiator&data=04%7C01%7Cpatr
> > >>
> >
> ik.forsberg%40globalconnect.se%7C792c03da127a49f8cdff08d9eda4cb1b%7C
> > >>
> >
> dfbb0d3b8276458197a42b844a84ea35%7C0%7C0%7C637802114650486564%7
> > >>
> >
> CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJ
> > >>
> >
> BTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=KL3SShB63%2F%2Fc14
> > >> j7wWpbgPfNILr6ftYks5Uvh1HzvKM%3D&reserved=0
> > >
> > > _______________________________________________
> > > radiator mailing list
> > > radiator at lists.open.com.au
> > > https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fli
> > > st
> > >
> >
> s.open.com.au%2Fmailman%2Flistinfo%2Fradiator&data=04%7C01%7C
> > patri
> > >
> >
> k.forsberg%40globalconnect.se%7C53cf9fef8d0446ea0aa208d9ef9dc099%7C
> > dfb
> > >
> >
> b0d3b8276458197a42b844a84ea35%7C0%7C0%7C637804283432529013%7CUn
> > known%7
> > >
> >
> CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwi
> > LCJXV
> > >
> >
> CI6Mn0%3D%7C3000&sdata=4oabuwNB%2BiGAihmCENJ52YdYXfmkv6
> > mXQINbPv6aP
> > > UI%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%7C1b83ee71dda04196e20a08d9f21c6f02%7
> Cdfbb0d3b8276458197a42b844a84ea35%7C0%7C0%7C637807026199161088%
> 7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLC
> JBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=TJgMZkN%2BpEOakJ
> 0FtVzwvepszP7oZsRY50Ovq%2FEpwT4%3D&reserved=0


More information about the radiator mailing list