Freeradius + acctupdate option

nextime at nexlab.it nextime at nexlab.it
Mon Aug 20 21:57:41 UTC 2007


Just because isn't documented:

If you need to manage multiple concurrent login and you want to have 
Session-Timeout dinamically update on coovachilli when a user login
multiple time, David add an amazing option, --acctupdate, that get
the NON-standard response to acctupdate packets to radius with some
attributes, like the Session-Timeout.

But now the problem is: How to make it working with freeradius and mysql?

Well, this is how:

Firt of all, look at
http://coova.org/wiki/index.php/CoovaChilli/WithFreeRADIUS and do the
required changes to attrs.accounting_response file.

Now, on radiusd.conf, in the module {} section, 
add this:

   attr_rewrite updatesessiontimeout {
      attribute = Session-Timeout
      searchin = reply
      searchfor = "[+ ]"
      replacewith = "%{sql:SELECT ch.Value-IF(SUM(acct.AcctSessionTime) IS NULL, 0, SUM(acct.AcctSessionTime)) \
                      FROM radcheck AS ch LEFT JOIN radacct AS acct \
                      ON acct.Username=ch.UserName AND acct.AcctSessionId!='%{Acct-Session-Id}'\
                      AND acct.AcctUniqueId!='%{Acct-Unique-Session-Id}' \
                      WHERE ch.UserName='%{User-Name}' AND ch.Attribute='Max-All-Session'"
      new_attribute = yes
      append = no
   }

Now, in the acctupdate {} section add simply updatesessiontimeout and voila', le jeux son fait!

This assume that you have Max-All-Session in radcheck table, if you have it in radgroupcheck you need to 
modify a bit the sql query.




-- 

Franco (nextime) Lanza
Busto Arsizio - Italy
SIP://casa@casa.nexlab.it

NO TCPA: http://www.no1984.org
you can download my public key at:
http://danex.nexlab.it/nextime.asc || Key Servers
Key ID = D6132D50
Key fingerprint = 66ED 5211 9D59 DA53 1DF7  4189 DFED F580 D613 2D50
-----------------------------------
echo 16i[q]sa[ln0=aln100%Pln100/snlbx]sbA0D212153574F444E49572045535520454D20454B414D204F54204847554F4E452059415020544F4E4E4143205345544147204C4C4942snlbxq | dc
-----------------------------------

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://lists.coova.org/pipermail/chilli/attachments/20070820/f0a3b5b8/attachment.pgp>


More information about the Chilli mailing list