Dynamic session timeout
Alan DeKok
aland at deployingradius.com
Sat Nov 10 03:38:24 CET 2018
On Nov 9, 2018, at 8:30 PM, Sam T <givemesam at gmail.com> wrote:
> So if this expression is indeed corrected now, i guess my question lies
> with how to handle the output? Take a look
>
> if (reply:WISPr-Session-Terminate-Time) {
> update reply {
>
> Session-Timeout :=
> "%{expr:%{integer:reply:WISPr-Session-Terminate-Time} - %l}"
It turns out that WISPr-Session-Terminate-Time isn't a "date" attribute. It's just a "string".
So no, you can't convert a string to an integer. The v3.0.x code in GitHub gives descriptive errors that explain what's going wrong.
> ...
> WISPr-Session-Terminate-Time = "2018-12-02T12:22:23+00:00"
Which is a *string* that represents a date, and not actually a date. <sigh> Why can't people design their RADIUS dictionaries correctly?
The solution is this:
1) use the v3.0.x branch from GitHub in order to get better error messages, and to fix some "expr" parsing issues
2) edit mods-available/date, and add:
date wispr2date {
format = "%Y-%m-%dT%H:%M:%S"
}
3) use this in the "authorize" section:
if (reply:WISPr-Session-Terminate-Time) {
update reply {
Tmp-Date-0 := "%{wispr2date:&reply:WISPr-Session-Terminate-Time}"
}
update reply {
Session-Timeout = "%{expr:%{integer:reply:Tmp-Date-0} - %l}"
}
}
And that should work.
If the WISPr people had used the correct data types, this would be much easier.
Alan DeKok.
More information about the Freeradius-Users
mailing list