Radius stale sessions

Renato Sousa rensousa at gmail.com
Fri Apr 12 16:30:14 CEST 2019


Hello Jorge,


Em sex, 12 de abr de 2019 às 10:34, Jorge Pereira <jpereira at freeradius.org>
escreveu:

> Renato,
>
> But, if you do a select() for all opened sessions for %{User-Name} removing
> the first result
> it could be enough.
>
> ps: Sometimes the NAS don't send the Acct-Stop, than can't be good to use
> it as a parameter.
>

I've created a SQL statement to select as old sessions and would like to
share for reviews.

SELECT
b.radacctid,b.username,b.callingstationid,b.acctstarttime,nasipaddress FROM
radacct b WHERE b.acctstoptime is null and b.acctstarttime < (SELECT
max(c.acctstarttime) FROM radacct c WHERE c.acctstoptime is NULL and
c.callingstationid=b.callingstationid and TIMEDIFF(now(),c.acctstarttime) >
'1:00:00')

Basically the SQL statement above selects all open sessions with more than
one occurrence and even mac address with session start more than 1 hour.
Is this effective? Is there any other situation you should anticipate?

Regards,



> Boa sorte,
>
Valeu amigo ;)

>
> On Fri, Apr 12, 2019 at 9:47 AM Renato Sousa <rensousa at gmail.com> wrote:
>
> > Hello everyone,
> >
> > I am fine-tuning the radius accountig sql information and noticed that
> > there are multiple stale sessions.
> > I would like to use a script in cron to delete these sessions but I have
> a
> > question.
> >
> > How should I select a session as stale? Time difference (acctstarttime
> and
> > now()) ? Other records with the same mac-address and open sessions
> > (acctstoptime is null) ?
> >
> > Regards,
> >
> > Renato L. Sousa
> > -
> > List info/subscribe/unsubscribe? See
> > http://www.freeradius.org/list/users.html
> -
> List info/subscribe/unsubscribe? See
> http://www.freeradius.org/list/users.html


More information about the Freeradius-Users mailing list