rewrite User-Name in received Access-Request - tough question :)

Alan DeKok aland at deployingradius.com
Sun Oct 28 11:17:05 CET 2012


Bojan Pogacar wrote:
> Alan: I've posted so much garbage solutions, because I wanted to show
> you, that I've tried many things, before writing to this mailing list :)

  Sure.  My point is that most solutions are similar: write down a
COMPLETE description of the problem.  Then, implement it.

> Alan: Even if UserName rewrite would happen, I could track different
> users by Attribute Calling-Station-Id. I wrote this counter:

  That may work.  But as I said, you don't need to re-write the
User-Name.  So don't.

> I will write all the logic in unlang, without username rewrite. I will
> get user parameters with
> 
> update reply {
>     Session-Timeout := %{sql: SELECT 1800 - SUM(acctsessiontime - \
>                  GREATEST((%b - UNIX_TIMESTAMP(acctstarttime)), 0)) \
>                  FROM radacct WHERE callingstationid =
> '%{Calling-Station-ID}' AND \
>                  UNIX_TIMESTAMP(acctstarttime) + acctsessiontime > '%b'}
> 
> 
> .... and so on for bandwidth caping.   
> }
>
> Is there more elegant solution, or this is it?

  That's pretty much it.

  Alan DeKok.


More information about the Freeradius-Users mailing list