Terminate dsl ppp sessions daily

Alan DeKok aland at deployingradius.com
Tue Oct 15 17:51:22 CEST 2013


Volker Lieder wrote:
> we try to calculate it via sql statement and other stuff, like this:
> 
> For Expiration: %{sql:select (TIMESTAMPADD(HOUR, 4, TIMESTAMPADD(DAY, 1,
> CURDATE())))}
> 
> For Session-Timeout direct: %{(exp:$(date +%s --date="next day
> 04:00:00") - $(date +%s)}

  That works.

> but dont find the right way, how to add this to specific users or as an
> attribute of a group.

  You just add it as an attribute and value.  The server takes care of
expanding it.  In the radreply table, just put:

	Expiration := "%{sql:select (TIMESTAMPADD(HOUR, 4, TIMESTAMPADD(DAY, 1,
CURDATE())))}"

  It *really* is that easy.

> If its so easy, why dont easily send back the solution?

  Because it's already documented.  See "man unlang".  Attributes have
names and values.  If you put %{...} into a value, it's expanded
automatically.  (With some caveats... see the documentation).

> And believe, i googled and read a lot ;-)

  I don't really see what the problem is.  The configs, documentation,
and examples do a lot of dynamic expansion, like above.  Just follow the
examples.

  Alan DeKok.


More information about the Freeradius-Users mailing list