session timeout eval random only during night hours

Krzysztof Drewicz krzysztofdrewicz at
Thu Mar 14 21:47:52 CET 2019

czw., 14 mar 2019 o 21:02 Alan DeKok <aland at> napisaƂ(a):

> > Session-Timeout = 24*60*60 (secons so = one day)
> > 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?
Nothing in particular, in other words, if user gets 10 disconnects during
2-6 night hours, well - he/she is unlucky, but it's ok for me.

>   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.

Thanks,  this is just what i've thought.
If i've got something working, i whould share.
to fire up perl/python every session well, looks like cpu consuming thing.

More information about the Freeradius-Users mailing list