How do I see if the user has disconnected?

Mark Antony mark.antony.4 at protonmail.com
Sat May 15 19:06:56 CEST 2021


> What does that mean? Is your NAS behind a flaky internet connection?

Sort of. The NAS is OpenVPN (Software), mobile phones that connect to it create the user-sessions. Mobile phones tend to loose connection.

> If the user goes away, the NAS is supposed to sent an accounting packet which says "session is stopped". If the NAS doesn't do that, then throw it in the garbage, and buy one that works.

Not every NAS is a piece of hardware. (see above)

But what you have said above, gave me an idea to double check the timeout of OpenVPN. It is indeed a tad longer than the timeout of Acct-Interim-Interval on Freeradius.  In other words after Freeradius triggers an update via Acct-Interim-Interval, the NAS is still connected and hasn't declared the timeout yet. That discrepancy threw me off.

Now I can see that it throws a Stop after OpenVPN decided that the session is timed out. That's perfect.

(10)     EXPAND %{Acct-Status-Type}
(10)        --> Stop

I think I have covered all cases now. A session can either be stopped by the user or can time out, and both lead to stop. Hence I can now implement the SQL Update statement under Stop and I have achieved my task.

accounting {
    if (&Acct-Status-Type == "Stop") {
        "%{sql:UPDATE ... WHERE device_id = '%{User-Name}'}"
    }

Out of curiosity when you say see 'cron', do you mean a plain crontab in Linux or a specific functionality of Freeradius?
I couldn't find it in documentation: https://wiki.freeradius.org/search?q=cron


Thanks everyone for your help today,
Mark


>
> > I have expended the variable and it says.
> > (4) EXPAND %{Acct-Status-Type}
> > (4) --> Interim-Update
>
> Which means that the session is still active.
>
> > I was just wondering if Freeradius was able to trigger a timeout event after certain time has passed. In other words do you know of any way to capture timeouts in a different way?
>
> See 'cron'.
>
> Alan DeKok.





More information about the Freeradius-Users mailing list