session timeout eval random only during night hours
Alan DeKok
aland at deployingradius.com
Thu Mar 14 21:02:11 CET 2019
On Mar 14, 2019, at 3:35 PM, Krzysztof Drewicz <krzysztofdrewicz at gmail.com> wrote:
>
> basically what i have is:
>
> Session-Timeout = 24*60*60 (secons so = one day)
>
> what i whould like to eval this timeout every time user gets ack/ok reply
> to be (randomly) in hours let's say 0200 - 0600 hours.
That's a little unusual, and therefore a bit more difficult.
There are a few things going on here. What do you want to do *during* that time? i.e. what happens if the user logs in between 0200-0600?
If there's outside of that time, it's a bit simpler. Just calculate how far away 0200 is, and then add 0-(4*3600) random seconds.
Exactly how to do this isn't trivial. TBH, the simplest solution might be a short Perl or Python script. The "unlang" language isn't really intended to be a general purpose programming language.
Alan DeKok.
More information about the Freeradius-Users
mailing list